* reader.c (packsymbols): Formatting changes.

This commit is contained in:
Akim Demaille
2000-03-17 11:34:53 +00:00
parent 3cef001a70
commit 0a6384c401
2 changed files with 49 additions and 38 deletions

View File

@@ -1,3 +1,7 @@
2000-03-17 Akim Demaille <akim@epita.fr>
* reader.c (packsymbols): Formatting changes.
2000-03-17 Akim Demaille <akim@epita.fr> 2000-03-17 Akim Demaille <akim@epita.fr>
* reader.c (copy_comment): New function, factored out from: * reader.c (copy_comment): New function, factored out from:

View File

@@ -1790,8 +1790,9 @@ get_type (void)
#endif #endif
/* assign symbol numbers, and write definition of token names into fdefines. /* Assign symbol numbers, and write definition of token names into
Set up vectors tags and sprec of names and precedences of symbols. */ fdefines. Set up vectors tags and sprec of names and precedences
of symbols. */
void void
packsymbols (void) packsymbols (void)
@@ -1823,29 +1824,33 @@ packsymbols (void)
else if (bp->alias) else if (bp->alias)
{ {
/* this symbol and its alias are a single token defn. /* this symbol and its alias are a single token defn.
allocate a tokno, and assign to both allocate a tokno, and assign to both check agreement of
check agreement of ->prec and ->assoc fields ->prec and ->assoc fields and make both the same */
and make both the same
*/
if (bp->value == 0) if (bp->value == 0)
bp->value = bp->alias->value = tokno++; bp->value = bp->alias->value = tokno++;
if (bp->prec != bp->alias->prec) { if (bp->prec != bp->alias->prec)
{
if (bp->prec != 0 && bp->alias->prec != 0 if (bp->prec != 0 && bp->alias->prec != 0
&& bp->user_token_number == SALIAS) && bp->user_token_number == SALIAS)
warnss(_("conflicting precedences for %s and %s"), warnss(_("conflicting precedences for %s and %s"),
bp->tag, bp->alias->tag); bp->tag, bp->alias->tag);
if (bp->prec != 0) bp->alias->prec = bp->prec; if (bp->prec != 0)
else bp->prec = bp->alias->prec; bp->alias->prec = bp->prec;
else
bp->prec = bp->alias->prec;
} }
if (bp->assoc != bp->alias->assoc) { if (bp->assoc != bp->alias->assoc)
{
if (bp->assoc != 0 && bp->alias->assoc != 0 if (bp->assoc != 0 && bp->alias->assoc != 0
&& bp->user_token_number == SALIAS) && bp->user_token_number == SALIAS)
warnss(_("conflicting assoc values for %s and %s"), warnss(_("conflicting assoc values for %s and %s"),
bp->tag, bp->alias->tag); bp->tag, bp->alias->tag);
if (bp->assoc != 0) bp->alias->assoc = bp->assoc; if (bp->assoc != 0)
else bp->assoc = bp->alias->assoc; bp->alias->assoc = bp->assoc;
else
bp->assoc = bp->alias->assoc;
} }
if (bp->user_token_number == SALIAS) if (bp->user_token_number == SALIAS)
@@ -1878,16 +1883,18 @@ packsymbols (void)
token_translations = NEW2(max_user_token_number+1, short); token_translations = NEW2(max_user_token_number+1, short);
/* initialize all entries for literal tokens to 2, /* initialize all entries for literal tokens to 2, the internal
the internal token number for $undefined., token number for $undefined., which represents all invalid
which represents all invalid inputs. */ inputs. */
for (i = 0; i <= max_user_token_number; i++) for (i = 0; i <= max_user_token_number; i++)
token_translations[i] = 2; token_translations[i] = 2;
for (bp = firstsymbol; bp; bp = bp->next) for (bp = firstsymbol; bp; bp = bp->next)
{ {
if (bp->value >= ntokens) continue; /* non-terminal */ if (bp->value >= ntokens)
if (bp->user_token_number == SALIAS) continue; continue; /* non-terminal */
if (bp->user_token_number == SALIAS)
continue;
if (token_translations[bp->user_token_number] != 2) if (token_translations[bp->user_token_number] != 2)
warnsss(_("tokens %s and %s both assigned number %s"), warnsss(_("tokens %s and %s both assigned number %s"),
tags[token_translations[bp->user_token_number]], tags[token_translations[bp->user_token_number]],
@@ -1937,9 +1944,9 @@ packsymbols (void)
} }
} }
/* For named tokens, but not literal ones, define the name. /* For named tokens, but not literal ones, define the name. The value
The value is the user token number. is the user token number. */
*/
void void
output_token_defines (FILE *file) output_token_defines (FILE *file)
{ {