d: add yyerrok

In D's case, yyerrok() is a private method of the Parser class.
It can be called directly as `yyerrok()` from the grammar rules section.

* data/skeletons/lalr1.d: Add yyerrok().
* examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate yyerrok().
* tests/calc.at: Update D tests to use yyerrok().
This commit is contained in:
Adela Vais
2020-11-06 17:18:04 +02:00
committed by Akim Demaille
parent d49da0101a
commit abf5f7f90e
4 changed files with 8 additions and 3 deletions

View File

@@ -720,7 +720,7 @@ exp:
| "-" exp %prec NEG { $$ = -$2; }
| exp "^" exp { $$ = power ($1, $3); }
| "(" exp ")" { $$ = $2; }
| "(" error ")" { $$ = 1111; }
| "(" error ")" { $$ = 1111; yyerrok(); }
| "!" { $$ = 0; return YYERROR; }
| "-" error { $$ = 0; return YYERROR; }
;