40 |
struct symbol_list *next; |
struct symbol_list *next; |
41 |
bucket *sym; |
bucket *sym; |
42 |
int line; |
int line; |
43 |
|
|
44 |
/* The action is attached to the LHS of a rule. */ |
/* The action is attached to the LHS of a rule. */ |
45 |
const char *action; |
const char *action; |
46 |
int action_line; |
int action_line; |
47 |
|
|
48 |
|
/* The guard is attached to the LHS of a rule. */ |
49 |
|
const char *guard; |
50 |
|
int guard_line; |
51 |
bucket *ruleprec; |
bucket *ruleprec; |
52 |
} symbol_list; |
} symbol_list; |
53 |
|
|
81 |
res->line = lineno; |
res->line = lineno; |
82 |
res->action = NULL; |
res->action = NULL; |
83 |
res->action_line = 0; |
res->action_line = 0; |
84 |
|
res->guard = NULL; |
85 |
|
res->guard_line = 0; |
86 |
res->ruleprec = NULL; |
res->ruleprec = NULL; |
87 |
return res; |
return res; |
88 |
} |
} |
1095 |
count = 1; |
count = 1; |
1096 |
c = getc (finput); |
c = getc (finput); |
1097 |
|
|
1098 |
|
rule->action_line = lineno; |
1099 |
|
|
1100 |
while (count > 0) |
while (count > 0) |
1101 |
{ |
{ |
1102 |
while (c != '}') |
while (c != '}') |
1153 |
|
|
1154 |
obstack_1grow (&action_obstack, '\0'); |
obstack_1grow (&action_obstack, '\0'); |
1155 |
rule->action = obstack_finish (&action_obstack); |
rule->action = obstack_finish (&action_obstack); |
|
rule->action_line = lineno; |
|
1156 |
} |
} |
1157 |
|
|
1158 |
/*-------------------------------------------------------------------. |
/*-------------------------------------------------------------------. |
1175 |
if (semantic_parser) |
if (semantic_parser) |
1176 |
stack_offset = 0; |
stack_offset = 0; |
1177 |
|
|
1178 |
obstack_fgrow1 (&guard_obstack, "\ncase %d:\n", nrules); |
rule->guard_line = lineno; |
|
if (!no_lines_flag) |
|
|
obstack_fgrow2 (&guard_obstack, muscle_find ("linef"), |
|
|
lineno, quotearg_style (c_quoting_style, |
|
|
muscle_find ("filename"))); |
|
|
obstack_1grow (&guard_obstack, '{'); |
|
1179 |
|
|
1180 |
count = 0; |
count = 0; |
1181 |
c = getc (finput); |
c = getc (finput); |
1234 |
c = getc (finput); |
c = getc (finput); |
1235 |
} |
} |
1236 |
|
|
1237 |
c = skip_white_space (); |
obstack_1grow (&guard_obstack, '\0'); |
1238 |
|
rule->guard = obstack_finish (&guard_obstack); |
|
obstack_sgrow (&guard_obstack, ";\n break;}"); |
|
|
if (c == '{') |
|
|
copy_action (rule, stack_offset); |
|
|
else if (c == '=') |
|
|
{ |
|
|
c = getc (finput); /* why not skip_white_space -wjh */ |
|
|
if (c == '{') |
|
|
copy_action (rule, stack_offset); |
|
|
} |
|
|
else |
|
|
ungetc (c, finput); |
|
1239 |
} |
} |
1240 |
|
|
1241 |
|
|
1458 |
crule->ruleprec = symval; |
crule->ruleprec = symval; |
1459 |
t = lex (); |
t = lex (); |
1460 |
} |
} |
1461 |
|
|
1462 |
if (t == tok_guard) |
if (t == tok_guard) |
1463 |
{ |
{ |
1464 |
if (!semantic_parser) |
if (!semantic_parser) |
1467 |
copy_guard (crule, rulelength); |
copy_guard (crule, rulelength); |
1468 |
t = lex (); |
t = lex (); |
1469 |
} |
} |
1470 |
else if (t == tok_left_curly) |
|
1471 |
|
if (t == tok_left_curly) |
1472 |
{ |
{ |
1473 |
/* This case never occurs -wjh */ |
/* This case never occurs -wjh */ |
1474 |
if (action_flag) |
if (action_flag) |
1775 |
rule_table[ruleno].useful = TRUE; |
rule_table[ruleno].useful = TRUE; |
1776 |
rule_table[ruleno].action = p->action; |
rule_table[ruleno].action = p->action; |
1777 |
rule_table[ruleno].action_line = p->action_line; |
rule_table[ruleno].action_line = p->action_line; |
1778 |
|
rule_table[ruleno].guard = p->guard; |
1779 |
|
rule_table[ruleno].guard_line = p->guard_line; |
1780 |
|
|
1781 |
p = p->next; |
p = p->next; |
1782 |
while (p && p->sym) |
while (p && p->sym) |