Ohm-S
Ohm-S copied to clipboard
Unexpected difference between lexical and syntactic rule
I was using the following rules in Ohm-S:
Text {
TextRule
= text
textCharacter
= "\\\""
| "\\\\"
| ~"\\" ~"\"" any
text
= "\"" textCharacter+ "\""
}
When trying to match the input Hello World
starting from text
everything works as expected and the string is correctly matched. When starting from TextRule
, however, the expression can not be matched.
I tried the very same setup in Ohm/JS, which was able to match with either rule as the starting rule.