mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
glr2.cc: example: simplify
* examples/c++/glr/c++-types.yy: Formatting changes. Remove unused support for '@'. * examples/c/glr/c++-types.y: Ditto.
This commit is contained in:
@@ -68,17 +68,15 @@ prog : %empty
|
||||
| prog stmt { std::cout << @2 << ": " << $2 << '\n'; }
|
||||
;
|
||||
|
||||
stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
|
||||
stmt : expr ';' %merge <stmtMerge> { $$ = $1; }
|
||||
| decl %merge <stmtMerge>
|
||||
| error ';' { $$ = Nterm ("<error>"); }
|
||||
| '@' { $$ = $1; YYACCEPT; }
|
||||
| error ';' { $$ = Nterm ("<error>"); }
|
||||
;
|
||||
|
||||
expr : ID
|
||||
| TYPENAME '(' expr ')'
|
||||
{ $$ = Nterm ("<cast>", $3, $1); }
|
||||
| expr '+' expr { $$ = Nterm ("+", $1, $3); }
|
||||
| expr '=' expr { $$ = Nterm ("=", $1, $3); }
|
||||
| TYPENAME '(' expr ')' { $$ = Nterm ("<cast>", $3, $1); }
|
||||
| expr '+' expr { $$ = Nterm ("+", $1, $3); }
|
||||
| expr '=' expr { $$ = Nterm ("=", $1, $3); }
|
||||
;
|
||||
|
||||
decl : TYPENAME declarator ';'
|
||||
|
||||
Reference in New Issue
Block a user