parser: use %empty

Avoid that Bison's own use of "bison -Wall" trigger warnings.

* src/parse-gram.y: Use %empty for every empty rule.
This commit is contained in:
Akim Demaille
2013-02-09 13:47:14 +01:00
parent ae2b48f5c0
commit fd003416d5

View File

@@ -274,7 +274,7 @@ input:
`------------------------------------*/ `------------------------------------*/
prologue_declarations: prologue_declarations:
/* Nothing */ %empty
| prologue_declarations prologue_declaration | prologue_declarations prologue_declaration
; ;
@@ -430,8 +430,8 @@ code_props_type:
%token PERCENT_UNION "%union"; %token PERCENT_UNION "%union";
union_name: union_name:
/* Nothing. */ {} %empty {}
| ID { muscle_code_grow ("union_name", $1, @1); } | ID { muscle_code_grow ("union_name", $1, @1); }
; ;
grammar_declaration: grammar_declaration:
@@ -490,8 +490,8 @@ precedence_declarator:
; ;
tag.opt: tag.opt:
/* Nothing. */ { current_type = NULL; } %empty { current_type = NULL; }
| TAG { current_type = $1; tag_seen = true; } | TAG { current_type = $1; tag_seen = true; }
; ;
/* Just like symbols.1 but accept INT for the sake of POSIX. */ /* Just like symbols.1 but accept INT for the sake of POSIX. */
@@ -607,7 +607,7 @@ rhses.1:
%token PERCENT_EMPTY "%empty"; %token PERCENT_EMPTY "%empty";
rhs: rhs:
/* Nothing. */ %empty
{ grammar_current_rule_begin (current_lhs_symbol, current_lhs_location, { grammar_current_rule_begin (current_lhs_symbol, current_lhs_location,
current_lhs_named_ref); } current_lhs_named_ref); }
| rhs symbol named_ref.opt | rhs symbol named_ref.opt
@@ -627,9 +627,8 @@ rhs:
; ;
named_ref.opt: named_ref.opt:
/* Nothing. */ { $$ = 0; } %empty { $$ = 0; }
| | BRACKETED_ID { $$ = named_ref_new($1, @1); }
BRACKETED_ID { $$ = named_ref_new ($1, @1); }
; ;
/*---------------------------. /*---------------------------.
@@ -645,9 +644,9 @@ variable:
/* Some content or empty by default. */ /* Some content or empty by default. */
content.opt: content.opt:
/* Nothing. */ { $$ = ""; } %empty { $$ = ""; }
| ID { $$ = $1; } | ID { $$ = $1; }
| STRING | STRING { $$ = $1; }
; ;
@@ -706,7 +705,7 @@ string_as_id:
; ;
epilogue.opt: epilogue.opt:
/* Nothing. */ %empty
| "%%" EPILOGUE | "%%" EPILOGUE
{ {
code_props plain_code; code_props plain_code;