I use it to parse keywords and assure the keyword does not appear just as the start of an identifier: Word("keyword")
Now it turns out this gets expanded to: Word!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!"keyword", Spacing)). This is obviously not what I intended.
Putting the call in a <- rule prevents this, but makes things cumbersome when space consumption is wanted around the keyword (which would often be the case). IMO when I explicitly pass a single parser to a parameterized rule, that thing should be passed without addition, no matter the type of rule. Space consumption may happen inside the parameterized rule, if that rule is defined to be space-consuming.
In a grammar I did something like this:
I use it to parse keywords and assure the keyword does not appear just as the start of an identifier:
Word("keyword")
Now it turns out this gets expanded to:
Word!(pegged.peg.wrapAround!(Spacing, pegged.peg.literal!"keyword", Spacing))
. This is obviously not what I intended.Putting the call in a
<-
rule prevents this, but makes things cumbersome when space consumption is wanted around the keyword (which would often be the case). IMO when I explicitly pass a single parser to a parameterized rule, that thing should be passed without addition, no matter the type of rule. Space consumption may happen inside the parameterized rule, if that rule is defined to be space-consuming.