snip&snap extracts from our major JISON grammar file, showcasing 'code sections' a la BISON plus a few other bits & tricks. Note the %{ ... %} sections which are JISON's 'code sections'. Also note the code following that last '%%' marker: that is another 'code section' - and the most important one.
✓ Published0🌍 Public
GGerHobbelt
Last edited Aug 31, 2013
Created on Aug 31, 2013
This example presents a JISON grammar file for a formula parser, highlighting its use of embedded code sections marked by `%{ ... %}`, a feature inherited from BISON. It demonstrates a lexical hack where a dotted identifier regex includes a look-ahead for an open parenthesis to recognize function tokens, using the parser's symbol table lookup. The code also documents how JISON transforms lexer regex macros and how the `this.unput` and `this.matches` APIs manage pushed-back input. The grammar is rendered as a raw source file from a gist.
AI-generated description