Open octavpo opened 6 years ago
Invoke yyerror(...) from within the action. Similar to bison.
If this doesnt work for jison as is, check out jison-gho fork (mine) which is also on npm: there yyerror works and is used extensively: see that fork's lex.y and bnf.y source files for examples of its use. yyerror() is also available in lexer actions if you need that too (jison-gho)
Is there a way to make a grammar rule fail from an action?
We have a grammar for propositional logic and in some contexts we'd like to only accept a fully parenthesized version of the language. Rather than maintaining a second grammar for that purpose, I'd prefer to be able to make some rules just fail when a 'strict' parameter is set and parentheses are missing. How can I do that? Thanks.