Skip to content
Discussion options

You must be logged in to vote
ident = @{ ('a'..'z' | 'A'..'Z' | "_")+ }

true    =  { "true" }
false   =  { "false" }
boolean = @{ true | false }

if   = @{ "if" }
else = @{ "else" }

// match identifiers at last
expr = { if | else | boolean | ident }

statement = { expr+ }

WHITESPACE = _{ " " }

You match your expressions in decreasing order of specificity. (I am forgetting the exact term)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by tomtau
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants