You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm writing a pest grammar for the Fountain.io syntax, which includes two different varieties of comment-like elements: [[ notes ]] set off with double-square brackets and /* boneyard */ elements delimited with a C-style comment syntax.
I'm trying to satisfy the test cases for Boneyards and Notes from the reference implementation, and I'm running into problems with the "internal" inline cases.
If I make the text rule atomic, text = @{ bn? ~ head ~ bn? ~ (tail ~ bn?)* } then the results are cleaner and more readable, closer to how I'd like to actually use them:
But sadly that causes the [[ internal ]] notes and boneyards to be miscategorized as generic text lines. I also tried making text a compound-atomic ($) rule, but that didn't make any difference from a non-atomic rule in this case.
Does anyone have any suggestions here? Do I have any options besides taking the character-by-character output and concatenating them all in application code?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm writing a pest grammar for the Fountain.io syntax, which includes two different varieties of comment-like elements:
[[ notes ]]
set off with double-square brackets and/* boneyard */
elements delimited with a C-style comment syntax.I'm trying to satisfy the test cases for Boneyards and Notes from the reference implementation, and I'm running into problems with the "internal" inline cases.
By way of minimal example...
grammar.pest
This almost does what I want, but as you see in the pest editor, it splits each text character and makes the output very noisy:
If I make the
text
rule atomic,text = @{ bn? ~ head ~ bn? ~ (tail ~ bn?)* }
then the results are cleaner and more readable, closer to how I'd like to actually use them:But sadly that causes the
[[ internal ]]
notes and boneyards to be miscategorized as generic text lines. I also tried makingtext
a compound-atomic ($
) rule, but that didn't make any difference from a non-atomic rule in this case.Does anyone have any suggestions here? Do I have any options besides taking the character-by-character output and concatenating them all in application code?
Beta Was this translation helpful? Give feedback.
All reactions