[~/srcPLgrado/jison/jison-aSb(error)]$ cat aSb.jison %lex %% \s+ {} [ab] { return yytext; } . { return "INVALID"; } /lex %% S: /* empty */ { $$ = ''; console.log("empty"); } | 'a' S 'b' { $$ = $1 + $2 + $3; console.log("S -> aSb"); } | 'a' S error ; %%
parse: function parse(input) { var self = this, stack = [0], vstack = [null], // semantic value stack lstack = [], // location stack ... recovering = 0, TERROR = 2, EOF = 1; while (true) { // retreive state number from top of stack state = stack[stack.length - 1]; ... // handle parse error >> _handle_error: if (typeof action === 'undefined' || !action.length || ! ...action[0]) { var errStr = ''; if (!recovering) {
Casiano Rodríguez León