* src/reader.c: Normalize increments to prefix form.

This commit is contained in:
Akim Demaille
2002-04-07 17:44:05 +00:00
parent bd02036a4e
commit f3849179e5
2 changed files with 25 additions and 20 deletions

View File

@@ -1,3 +1,7 @@
2002-04-07 Akim Demaille <akim@epita.fr>
* src/reader.c: Normalize increments to prefix form.
2002-04-07 Akim Demaille <akim@epita.fr> 2002-04-07 Akim Demaille <akim@epita.fr>
* src/reader.c, symtab.c: Remove debugging code. * src/reader.c, symtab.c: Remove debugging code.

View File

@@ -326,7 +326,7 @@ get_type_name (int n, symbol_list *rule)
complain (_("invalid $ value")); complain (_("invalid $ value"));
return NULL; return NULL;
} }
i++; ++i;
} }
return rp->sym->type_name; return rp->sym->type_name;
@@ -369,7 +369,7 @@ copy_string2 (FILE *fin, struct obstack *oout, int match, int store)
obstack_1grow (oout, c); obstack_1grow (oout, c);
if (c == '\n') if (c == '\n')
lineno++; ++lineno;
} }
c = getc (fin); c = getc (fin);
@@ -452,7 +452,7 @@ copy_comment (FILE *fin, struct obstack *oout)
} }
else if (c == '\n') else if (c == '\n')
{ {
lineno++; ++lineno;
obstack_1grow (oout, c); obstack_1grow (oout, c);
if (cplus_comment) if (cplus_comment)
ended = 1; ended = 1;
@@ -614,7 +614,7 @@ copy_definition (void)
{ {
case '\n': case '\n':
obstack_1grow (&attrs_obstack, c); obstack_1grow (&attrs_obstack, c);
lineno++; ++lineno;
break; break;
case '%': case '%':
@@ -826,7 +826,8 @@ parse_assoc_decl (associativity assoc)
char *name = NULL; char *name = NULL;
int prev = 0; int prev = 0;
lastprec++; /* Assign a new precedence level, never 0. */ /* Assign a new precedence level, never 0. */
++lastprec;
for (;;) for (;;)
{ {
@@ -931,7 +932,7 @@ parse_union_decl (void)
switch (c) switch (c)
{ {
case '\n': case '\n':
lineno++; ++lineno;
break; break;
case '/': case '/':
@@ -939,7 +940,7 @@ parse_union_decl (void)
break; break;
case '{': case '{':
count++; ++count;
break; break;
case '}': case '}':
@@ -1276,12 +1277,12 @@ parse_braces (symbol_list *rule, int stack_offset)
{ {
case '\n': case '\n':
obstack_1grow (&action_obstack, c); obstack_1grow (&action_obstack, c);
lineno++; ++lineno;
break; break;
case '{': case '{':
obstack_1grow (&action_obstack, c); obstack_1grow (&action_obstack, c);
count++; ++count;
break; break;
case '\'': case '\'':
@@ -1431,8 +1432,8 @@ readgram (void)
} }
/* start a new rule and record its lhs. */ /* start a new rule and record its lhs. */
nrules++; ++nrules;
nitems++; ++nitems;
p = symbol_list_new (lhs); p = symbol_list_new (lhs);
@@ -1451,7 +1452,7 @@ readgram (void)
{ {
lhs->class = nterm_sym; lhs->class = nterm_sym;
lhs->number = nvars; lhs->number = nvars;
nvars++; ++nvars;
} }
else if (lhs->class == token_sym) else if (lhs->class == token_sym)
complain (_("rule given for %s, which is a token"), lhs->tag); complain (_("rule given for %s, which is a token"), lhs->tag);
@@ -1509,8 +1510,8 @@ readgram (void)
/* Make a new rule, whose body is empty, before the /* Make a new rule, whose body is empty, before the
current one, so that the action just read can current one, so that the action just read can
belong to it. */ belong to it. */
nrules++; ++nrules;
nitems++; ++nitems;
p = symbol_list_new (sdummy); p = symbol_list_new (sdummy);
/* Attach its lineno to that of the host rule. */ /* Attach its lineno to that of the host rule. */
p->line = crule->line; p->line = crule->line;
@@ -1531,7 +1532,7 @@ readgram (void)
/* Insert the dummy generated by that rule into this /* Insert the dummy generated by that rule into this
rule. */ rule. */
nitems++; ++nitems;
p = symbol_list_new (sdummy); p = symbol_list_new (sdummy);
p1->next = p; p1->next = p;
p1 = p; p1 = p;
@@ -1541,7 +1542,7 @@ readgram (void)
if (t == tok_identifier) if (t == tok_identifier)
{ {
nitems++; ++nitems;
p = symbol_list_new (symval); p = symbol_list_new (symval);
p1->next = p; p1->next = p;
p1 = p; p1 = p;
@@ -1550,9 +1551,9 @@ readgram (void)
{ {
parse_action (crule, rulelength); parse_action (crule, rulelength);
action_flag = 1; action_flag = 1;
xactions++; /* JF */ ++xactions; /* JF */
} }
rulelength++; ++rulelength;
} /* end of read rhs of rule */ } /* end of read rhs of rule */
/* Put an empty link in the list to mark the end of this rule */ /* Put an empty link in the list to mark the end of this rule */
@@ -1584,7 +1585,7 @@ readgram (void)
complain (_("two actions at end of one rule")); complain (_("two actions at end of one rule"));
parse_action (crule, rulelength); parse_action (crule, rulelength);
action_flag = 1; action_flag = 1;
xactions++; /* -wjh */ ++xactions; /* -wjh */
t = lex (); t = lex ();
} }
/* If $$ is being set in default way, report if any type /* If $$ is being set in default way, report if any type
@@ -1785,7 +1786,7 @@ packgram (void)
rules[ruleno].prec = ruleprec; rules[ruleno].prec = ruleprec;
} }
ritem[itemno++] = -ruleno; ritem[itemno++] = -ruleno;
ruleno++; ++ruleno;
if (p) if (p)
p = p->next; p = p->next;