mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 17:23:02 +00:00
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:
committed by
Akim Demaille
parent
d49da0101a
commit
abf5f7f90e
@@ -307,6 +307,11 @@ b4_user_union_members
|
|||||||
private static immutable YYSemanticType yy_semantic_null;])[
|
private static immutable YYSemanticType yy_semantic_null;])[
|
||||||
private int yyerrstatus_ = 0;
|
private int yyerrstatus_ = 0;
|
||||||
|
|
||||||
|
private void yyerrok()
|
||||||
|
{
|
||||||
|
yyerrstatus_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether error recovery is being done. In this state, the parser
|
* Whether error recovery is being done. In this state, the parser
|
||||||
* reads token until it reaches a known state, and then restarts normal
|
* reads token until it reaches a known state, and then restarts normal
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ input:
|
|||||||
line:
|
line:
|
||||||
EOL
|
EOL
|
||||||
| exp EOL { writeln ($exp); }
|
| exp EOL { writeln ($exp); }
|
||||||
| error EOL
|
| error EOL { yyerrok(); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp:
|
exp:
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ input:
|
|||||||
line:
|
line:
|
||||||
EOL
|
EOL
|
||||||
| exp EOL { writeln ($exp); }
|
| exp EOL { writeln ($exp); }
|
||||||
| error EOL
|
| error EOL { yyerrok(); }
|
||||||
;
|
;
|
||||||
|
|
||||||
exp:
|
exp:
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ exp:
|
|||||||
| "-" exp %prec NEG { $$ = -$2; }
|
| "-" exp %prec NEG { $$ = -$2; }
|
||||||
| exp "^" exp { $$ = power ($1, $3); }
|
| exp "^" exp { $$ = power ($1, $3); }
|
||||||
| "(" exp ")" { $$ = $2; }
|
| "(" exp ")" { $$ = $2; }
|
||||||
| "(" error ")" { $$ = 1111; }
|
| "(" error ")" { $$ = 1111; yyerrok(); }
|
||||||
| "!" { $$ = 0; return YYERROR; }
|
| "!" { $$ = 0; return YYERROR; }
|
||||||
| "-" error { $$ = 0; return YYERROR; }
|
| "-" error { $$ = 0; return YYERROR; }
|
||||||
;
|
;
|
||||||
|
|||||||
Reference in New Issue
Block a user