}
\f
-static void
-record_rule_line (void)
-{
- /* Record each rule's source line number in rline table. */
-
- if (nrules >= rline_allocated)
- {
- rline_allocated = nrules * 2;
- rline = XREALLOC (rline, short, rline_allocated);
- }
- rline[nrules] = lineno;
-}
-
-
/*-------------------------------------------------------------------.
| Generate a dummy symbol, a nonterminal, whose name cannot conflict |
| with the user's names. |
nrules++;
nitems++;
- record_rule_line ();
-
p = XCALLOC (symbol_list, 1);
p->sym = lhs;
just read can belong to it. */
nrules++;
nitems++;
- record_rule_line ();
p = XCALLOC (symbol_list, 1);
if (crule1)
crule1->next = p;
grammar = p;
p->sym = sdummy;
crule1 = XCALLOC (symbol_list, 1);
- p->next = crule1;
crule1->next = crule;
+ p->next = crule1;
+
/* Insert the dummy generated by that rule into this
rule. */
nitems++;
ritem = XCALLOC (short, nitems + 1);
rule_table = XCALLOC (rule_t, nrules) - 1;
- rprec = XCALLOC (short, nrules) - 1;
- rprecsym = XCALLOC (short, nrules) - 1;
- rassoc = XCALLOC (short, nrules) - 1;
itemno = 0;
ruleno = 1;
{
rule_table[ruleno].lhs = p->sym->value;
rule_table[ruleno].rhs = itemno;
+ rule_table[ruleno].line = p->sym->line;
ruleprec = p->ruleprec;
p = p->next;
of the last token in it. */
if (p->sym->class == token_sym)
{
- rprec[ruleno] = p->sym->prec;
- rassoc[ruleno] = p->sym->assoc;
+ rule_table[ruleno].prec = p->sym->prec;
+ rule_table[ruleno].assoc = p->sym->assoc;
}
if (p)
p = p->next;
the specified symbol's precedence replaces the default. */
if (ruleprec)
{
- rprec[ruleno] = ruleprec->prec;
- rassoc[ruleno] = ruleprec->assoc;
- rprecsym[ruleno] = ruleprec->value;
+ rule_table[ruleno].prec = ruleprec->prec;
+ rule_table[ruleno].assoc = ruleprec->assoc;
+ rule_table[ruleno].precsym = ruleprec->value;
}
ritem[itemno++] = -ruleno;
nvars = 0;
nrules = 0;
nitems = 0;
- rline_allocated = 10;
- rline = XCALLOC (short, rline_allocated);
typed = 0;
lastprec = 0;