diff --git a/data/skeletons/lalr1.d b/data/skeletons/lalr1.d index 9b7c786c..8e464907 100644 --- a/data/skeletons/lalr1.d +++ b/data/skeletons/lalr1.d @@ -307,6 +307,11 @@ b4_user_union_members private static immutable YYSemanticType yy_semantic_null;])[ private int yyerrstatus_ = 0; + private void yyerrok() + { + yyerrstatus_ = 0; + } + /** * Whether error recovery is being done. In this state, the parser * reads token until it reaches a known state, and then restarts normal diff --git a/examples/d/calc/calc.y b/examples/d/calc/calc.y index 9fea82cd..98ec06c0 100644 --- a/examples/d/calc/calc.y +++ b/examples/d/calc/calc.y @@ -53,7 +53,7 @@ input: line: EOL | exp EOL { writeln ($exp); } -| error EOL +| error EOL { yyerrok(); } ; exp: diff --git a/examples/d/simple/calc.y b/examples/d/simple/calc.y index 0f441431..41800080 100644 --- a/examples/d/simple/calc.y +++ b/examples/d/simple/calc.y @@ -51,7 +51,7 @@ input: line: EOL | exp EOL { writeln ($exp); } -| error EOL +| error EOL { yyerrok(); } ; exp: diff --git a/tests/calc.at b/tests/calc.at index 94a5fdb0..139cc5c5 100644 --- a/tests/calc.at +++ b/tests/calc.at @@ -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; } ;