How to do non-recursive atomic rule. #720
Unanswered
lefuturiste
asked this question in
Q&A
Replies: 1 comment 1 reply
-
How about removing |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to create a grammar to have key-value data language
The goal is to have key value pairs separated by at least one newline. But I don't want to go in atomic mode because then it's recursive and I have to explicitly specify every whitespaces I want in my key value pair and in all the different sort of values that I can have.
Ideally I want to declare that a grammar that parse this kind of sample:
Key : value
sequence separated with a newlinebut also allow whitespace between key and value
This is the grammar that I use
I could use :
entry = { key ~ WHITESPACE* ~ ":" ~ WHITESPACE* ~ value }
but my final goal is to make a grammar much more complicated so the value in the pair could have many more language trick and specific grammar that I don't want to specify eachtime the whitespaces.How could I have a whitespace explicit mode (atomic) only on one level and non recursive?
Beta Was this translation helpful? Give feedback.
All reactions