40 |
|
|
41 |
/* Produce verbose parse errors. */ |
/* Produce verbose parse errors. */ |
42 |
#define YYERROR_VERBOSE 1 |
#define YYERROR_VERBOSE 1 |
43 |
|
#define YYLLOC_DEFAULT(Current, Rhs, N) \ |
44 |
|
do { \ |
45 |
|
if (N) \ |
46 |
|
{ \ |
47 |
|
Current.first_column = Rhs[1].first_column; \ |
48 |
|
Current.first_line = Rhs[1].first_line; \ |
49 |
|
Current.last_column = Rhs[N].last_column; \ |
50 |
|
Current.last_line = Rhs[N].last_line; \ |
51 |
|
} \ |
52 |
|
else \ |
53 |
|
{ \ |
54 |
|
Current = Rhs[0]; \ |
55 |
|
} \ |
56 |
|
} while (0) |
57 |
|
|
58 |
/* Pass the control structure to YYPARSE and YYLEX. */ |
/* Pass the control structure to YYPARSE and YYLEX. */ |
59 |
#define YYPARSE_PARAM gram_control |
#define YYPARSE_PARAM gram_control |
78 |
symbol_class current_class = unknown_sym; |
symbol_class current_class = unknown_sym; |
79 |
char *current_type = 0; |
char *current_type = 0; |
80 |
symbol_t *current_lhs; |
symbol_t *current_lhs; |
81 |
|
location_t current_lhs_location; |
82 |
associativity current_assoc; |
associativity current_assoc; |
83 |
int current_prec = 0; |
int current_prec = 0; |
84 |
%} |
%} |
143 |
|
|
144 |
%% |
%% |
145 |
|
|
146 |
input: { LOCATION_RESET (yylloc); } |
input: |
147 |
declarations "%%" grammar epilogue.opt |
declarations "%%" grammar epilogue.opt |
148 |
{ |
{ |
149 |
yycontrol->errcode = 0; |
yycontrol->errcode = 0; |
150 |
epilogue_set ($5, @5); |
epilogue_set ($4, @4); |
151 |
} |
} |
152 |
; |
; |
153 |
|
|
186 |
| symbol_declaration |
| symbol_declaration |
187 |
| "%start" symbol |
| "%start" symbol |
188 |
{ |
{ |
189 |
grammar_start_symbol_set ($2); |
grammar_start_symbol_set ($2, @2); |
190 |
} |
} |
191 |
| "%union" BRACED_CODE |
| "%union" BRACED_CODE |
192 |
{ |
{ |
313 |
; |
; |
314 |
|
|
315 |
rules: |
rules: |
316 |
ID ":" { current_lhs = $1; } rhses.1 ";" |
ID ":" { current_lhs = $1; current_lhs_location = @1; } rhses.1 ";" |
317 |
{;} |
{;} |
318 |
; |
; |
319 |
|
|
320 |
rhses.1: |
rhses.1: |
321 |
rhs { grammar_rule_end (); } |
rhs { grammar_rule_end (@1); } |
322 |
| rhses.1 "|" rhs { grammar_rule_end (); } |
| rhses.1 "|" rhs { grammar_rule_end (@3); } |
323 |
; |
; |
324 |
|
|
325 |
rhs: |
rhs: |
326 |
/* Nothing. */ |
/* Nothing. */ |
327 |
{ grammar_rule_begin (current_lhs); } |
{ grammar_rule_begin (current_lhs, current_lhs_location); } |
328 |
| rhs symbol |
| rhs symbol |
329 |
{ grammar_current_rule_symbol_append ($2); } |
{ grammar_current_rule_symbol_append ($2, @2); } |
330 |
| rhs action |
| rhs action |
331 |
{ grammar_current_rule_action_append ($2, @2.first_line); } |
{ grammar_current_rule_action_append ($2, @2); } |
332 |
| rhs "%prec" symbol |
| rhs "%prec" symbol |
333 |
{ grammar_current_rule_prec_set ($3); } |
{ grammar_current_rule_prec_set ($3); } |
334 |
; |
; |