ohmjs / ohm

A library and language for building parsers, interpreters, compilers, etc.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

# operator not working on syntactic rule inside lexical rule

Lamby777 opened this issue · comments

I feel like I'm doing something wrong, but I read the docs 5 times and couldn't find a fix. Is this a bug? This error stays, even if I use the # example inside the syntax reference. I'm trying to use "Expression" inside this lexical rule.

image

Up to now, this was disallowed because it's usually a grammar smell if you are trying to apply a syntactic rule inside a lexical context — see #136 for a discussion.

As of Ohm v16.1.0 (just released), you can now use the built-in applySyntactic rule to do this.

Note that # is for the opposite: it creates a lexical context in a syntactic rule body.