]> git.saurik.com Git - bison.git/blobdiff - src/parse-gram.y
maint: update autoconf submodule
[bison.git] / src / parse-gram.y
index a5094350a1bdc8e074d92427b63f3d241ac5ba96..4e887e812a7910d96dc9677a22d0b84e4953edbf 100644 (file)
@@ -46,7 +46,7 @@ static void version_check (location const *loc, char const *version);
 
 static void gram_error (location const *, char const *);
 
-/// A string that describes a char (e.g., 'a' -> "'a'").
+/* A string that describes a char (e.g., 'a' -> "'a'").  */
 static char const *char_name (char);
 %}
 
@@ -64,7 +64,7 @@ static char const *char_name (char);
    */
   static
   void
-  current_lhs(symbol *sym, location loc, named_ref *ref)
+  current_lhs (symbol *sym, location loc, named_ref *ref)
   {
     current_lhs_symbol = sym;
     current_lhs_location = loc;
@@ -250,9 +250,9 @@ static char const *char_name (char);
     {
 #define CASE(In, Out)                                           \
       case param_ ## In: fputs ("%" #Out, stderr); break
-      CASE(lex,   lex-param);
-      CASE(parse, parse-param);
-      CASE(both,  param);
+      CASE (lex,   lex-param);
+      CASE (parse, parse-param);
+      CASE (both,  param);
 #undef CASE
       case param_none: aver (false); break;
     }
@@ -274,7 +274,7 @@ input:
         `------------------------------------*/
 
 prologue_declarations:
-  /* Nothing */
+  %empty
 | prologue_declarations prologue_declaration
 ;
 
@@ -430,15 +430,15 @@ code_props_type:
 %token PERCENT_UNION "%union";
 
 union_name:
-  /* Nothing. */ {}
-| ID             { muscle_code_grow ("union_name", $1, @1); }
+  %empty {}
+| ID     { muscle_code_grow ("union_name", $1, @1); }
 ;
 
 grammar_declaration:
   "%union" union_name braceless
     {
       union_seen = true;
-      muscle_code_grow ("stype", $3, @3);
+      muscle_code_grow ("union_members", $3, @3);
       code_scanner_last_string_free ();
     }
 ;
@@ -490,8 +490,8 @@ precedence_declarator:
 ;
 
 tag.opt:
-  /* Nothing. */ { current_type = NULL; }
-| TAG            { current_type = $1; tag_seen = true; }
+  %empty { current_type = NULL; }
+| TAG    { current_type = $1; tag_seen = true; }
 ;
 
 /* Just like symbols.1 but accept INT for the sake of POSIX.  */
@@ -605,8 +605,9 @@ rhses.1:
 | rhses.1 ";"
 ;
 
+%token PERCENT_EMPTY "%empty";
 rhs:
-  /* Nothing.  */
+  %empty
     { grammar_current_rule_begin (current_lhs_symbol, current_lhs_location,
                                   current_lhs_named_ref); }
 | rhs symbol named_ref.opt
@@ -615,6 +616,8 @@ rhs:
     { grammar_current_rule_action_append ($2, @2, $3, false); }
 | rhs "%?{...}"
     { grammar_current_rule_action_append ($2, @2, NULL, true); }
+| rhs "%empty"
+    { grammar_current_rule_empty_set (@2); }
 | rhs "%prec" symbol
     { grammar_current_rule_prec_set ($3, @3); }
 | rhs "%dprec" INT
@@ -624,9 +627,8 @@ rhs:
 ;
 
 named_ref.opt:
-  /* Nothing. */ { $$ = 0; }
-|
-  BRACKETED_ID   { $$ = named_ref_new($1, @1); }
+  %empty         { $$ = 0; }
+| BRACKETED_ID   { $$ = named_ref_new($1, @1); }
 ;
 
 /*---------------------------.
@@ -634,7 +636,7 @@ named_ref.opt:
 `---------------------------*/
 
 /* The STRING form of variable is deprecated and is not M4-friendly.
-   For example, M4 fails for `%define "[" "value"'.  */
+   For example, M4 fails for '%define "[" "value"'.  */
 variable:
   ID
 | STRING { $$ = uniqstr_new ($1); }
@@ -642,9 +644,9 @@ variable:
 
 /* Some content or empty by default. */
 content.opt:
-  /* Nothing. */   { $$ = ""; }
-| ID { $$ = $1; }
-| STRING
+  %empty    { $$ = ""; }
+| ID        { $$ = $1; }
+| STRING    { $$ = $1; }
 ;
 
 
@@ -703,7 +705,7 @@ string_as_id:
 ;
 
 epilogue.opt:
-  /* Nothing.  */
+  %empty
 | "%%" EPILOGUE
     {
       code_props plain_code;