/[bison]/bison/src/parse-gram.y
ViewVC logotype

Diff of /bison/src/parse-gram.y

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by akim, Fri Jun 14 17:36:44 2002 UTC revision 1.5 by akim, Fri Jun 14 17:38:14 2002 UTC
# Line 89  int current_prec = 0; Line 89  int current_prec = 0;
89  %token PERCENT_UNION "%union"  %token PERCENT_UNION "%union"
90  %token PERCENT_EXPECT "%expect"  %token PERCENT_EXPECT "%expect"
91  %token PERCENT_START "%start"  %token PERCENT_START "%start"
 %token PERCENT_LEFT  "%left"  
 %token PERCENT_RIGHT "%right"  
 %token PERCENT_NONASSOC "%nonassoc"  
92  %token PERCENT_PREC     "%prec"  %token PERCENT_PREC     "%prec"
93  %token PERCENT_VERBOSE  "%verbose"  %token PERCENT_VERBOSE  "%verbose"
94  %token PERCENT_ERROR_VERBOSE "%error-verbose"  %token PERCENT_ERROR_VERBOSE "%error-verbose"
# Line 146  input: { LOCATION_RESET (yylloc); } Line 143  input: { LOCATION_RESET (yylloc); }
143    
144  declarations:  declarations:
145    /* Nothing */    /* Nothing */
146  | declarations declaration  | declarations declaration semi_colon.opt
147  ;  ;
148    
149  declaration:  declaration:
# Line 176  grammar_declaration: Line 173  grammar_declaration:
173      {      {
174        grammar_start_symbol_set ($2);        grammar_start_symbol_set ($2);
175      }      }
176  | "%union" BRACED_CODE semi_colon_opt  | "%union" BRACED_CODE
177      {      {
178        typed = 1;        typed = 1;
179        MUSCLE_INSERT_INT ("stype_line", @2.first_line);        MUSCLE_INSERT_INT ("stype_line", @2.first_line);
# Line 208  precedence_declaration: Line 205  precedence_declaration:
205      { current_assoc = non_assoc; current_type = NULL; }      { current_assoc = non_assoc; current_type = NULL; }
206  ;  ;
207    
208    %token PERCENT_LEFT     "%left";
209    %token PERCENT_RIGHT    "%right";
210    %token PERCENT_NONASSOC "%nonassoc";
211  precedence_declarator:  precedence_declarator:
212    "%left"     { $$ = left_assoc; }    "%left"     { $$ = left_assoc; }
213  | "%right"    { $$ = right_assoc; }  | "%right"    { $$ = right_assoc; }
# Line 285  symbol_defs.1: Line 285  symbol_defs.1:
285          `------------------------------------------*/          `------------------------------------------*/
286    
287  grammar:  grammar:
288      rules_or_grammar_declaration
289    | grammar rules_or_grammar_declaration
290    ;
291    
292    /* As a Bison extension, one can use the grammar declarations in the
293       body of the grammar.  But to remain LALR(1), they must be ended
294       with a semi-colon.  */
295    rules_or_grammar_declaration:
296    rules    rules
297  | grammar rules  | grammar_declaration ";"
298  ;  ;
299    
300  rules:  rules:
# Line 350  epilogue.opt: Line 358  epilogue.opt:
358      }      }
359  ;  ;
360    
361  semi_colon_opt:  semi_colon.opt:
362    /* Nothing.  */    /* Nothing.  */
363  | ";"  | ";"
364  ;  ;

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26