69 |
#define yyerror(Msg) \ |
#define yyerror(Msg) \ |
70 |
gram_error (yycontrol, &yylloc, Msg) |
gram_error (yycontrol, &yylloc, Msg) |
71 |
|
|
|
/* When debugging our pure parser, we want to see values and locations |
|
|
of the tokens. */ |
|
72 |
#define YYPRINT(File, Type, Value) \ |
#define YYPRINT(File, Type, Value) \ |
73 |
yyprint (File, &yylloc, Type, &Value) |
yyprint (File, Type, &Value) |
74 |
static void yyprint (FILE *file, const location_t *loc, |
static void yyprint (FILE *file, int type, const yystype *value); |
|
int type, const yystype *value); |
|
75 |
|
|
76 |
symbol_class current_class = unknown_sym; |
symbol_class current_class = unknown_sym; |
77 |
char *current_type = 0; |
char *current_type = 0; |
286 |
} |
} |
287 |
| ID |
| ID |
288 |
{ |
{ |
289 |
symbol_class_set ($1, current_class); |
symbol_class_set ($1, current_class, @1); |
290 |
symbol_type_set ($1, @1, current_type); |
symbol_type_set ($1, @1, current_type); |
291 |
} |
} |
292 |
| ID INT |
| ID INT |
293 |
{ |
{ |
294 |
symbol_class_set ($1, current_class); |
symbol_class_set ($1, current_class, @1); |
295 |
symbol_type_set ($1, @1, current_type); |
symbol_type_set ($1, @1, current_type); |
296 |
symbol_user_token_number_set ($1, $2); |
symbol_user_token_number_set ($1, $2, @2); |
297 |
} |
} |
298 |
| ID string_as_id |
| ID string_as_id |
299 |
{ |
{ |
300 |
symbol_class_set ($1, current_class); |
symbol_class_set ($1, current_class, @1); |
301 |
symbol_type_set ($1, @1, current_type); |
symbol_type_set ($1, @1, current_type); |
302 |
symbol_make_alias ($1, $2); |
symbol_make_alias ($1, $2); |
303 |
} |
} |
304 |
| ID INT string_as_id |
| ID INT string_as_id |
305 |
{ |
{ |
306 |
symbol_class_set ($1, current_class); |
symbol_class_set ($1, current_class, @1); |
307 |
symbol_type_set ($1, @1, current_type); |
symbol_type_set ($1, @1, current_type); |
308 |
symbol_user_token_number_set ($1, $2); |
symbol_user_token_number_set ($1, $2, @2); |
309 |
symbol_make_alias ($1, $3); |
symbol_make_alias ($1, $3); |
310 |
} |
} |
311 |
; |
; |
354 |
| rhs action |
| rhs action |
355 |
{ grammar_current_rule_action_append ($2, @2); } |
{ grammar_current_rule_action_append ($2, @2); } |
356 |
| rhs "%prec" symbol |
| rhs "%prec" symbol |
357 |
{ grammar_current_rule_prec_set ($3); } |
{ grammar_current_rule_prec_set ($3, @3); } |
358 |
; |
; |
359 |
|
|
360 |
symbol: |
symbol: |
373 |
STRING |
STRING |
374 |
{ |
{ |
375 |
$$ = getsym ($1, @1); |
$$ = getsym ($1, @1); |
376 |
symbol_class_set ($$, token_sym); |
symbol_class_set ($$, token_sym, @1); |
377 |
} |
} |
378 |
; |
; |
379 |
|
|
408 |
|
|
409 |
static void |
static void |
410 |
yyprint (FILE *file, |
yyprint (FILE *file, |
411 |
const location_t *loc, int type, const yystype *value) |
int type, const yystype *value) |
412 |
{ |
{ |
413 |
fputs (" (", file); |
fputc (' ', file); |
|
LOCATION_PRINT (file, *loc); |
|
|
fputs (")", file); |
|
414 |
switch (type) |
switch (type) |
415 |
{ |
{ |
416 |
case CHARACTER: |
case CHARACTER: |