/[bison]/bison/src/reader.c
ViewVC logotype

Diff of /bison/src/reader.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.173 by akim, Thu May 2 16:16:11 2002 UTC revision 1.174 by akim, Sat May 4 08:48:04 2002 UTC
# Line 126  symbol_make_alias (symbol_t *symbol, cha Line 126  symbol_make_alias (symbol_t *symbol, cha
126        symval->class = token_sym;        symval->class = token_sym;
127        symval->type_name = typename;        symval->type_name = typename;
128        symval->user_token_number = symbol->user_token_number;        symval->user_token_number = symbol->user_token_number;
129        symbol->user_token_number = SALIAS;        symbol->user_token_number = USER_NUMBER_ALIAS;
130        symval->alias = symbol;        symval->alias = symbol;
131        symbol->alias = symval;        symbol->alias = symval;
132        /* symbol and symval combined are only one symbol */        /* symbol and symval combined are only one symbol */
# Line 149  static bool Line 149  static bool
149  symbol_check_alias_consistence (symbol_t *this)  symbol_check_alias_consistence (symbol_t *this)
150  {  {
151    /* Check only those who _are_ the aliases. */    /* Check only those who _are_ the aliases. */
152    if (this->alias && this->user_token_number == SALIAS)    if (this->alias && this->user_token_number == USER_NUMBER_ALIAS)
153      {      {
154        if (this->prec != this->alias->prec)        if (this->prec != this->alias->prec)
155          {          {
# Line 204  symbol_pack (symbol_t *this) Line 204  symbol_pack (symbol_t *this)
204                this->number = this->alias->number;                this->number = this->alias->number;
205              }              }
206          }          }
207        /* Do not do processing below for SALIASs.  */        /* Do not do processing below for USER_NUMBER_ALIASs.  */
208        if (this->user_token_number == SALIAS)        if (this->user_token_number == USER_NUMBER_ALIAS)
209          return TRUE;          return TRUE;
210      }      }
211    else /* this->class == token_sym */    else /* this->class == token_sym */
# Line 229  symbol_translation (symbol_t *this) Line 229  symbol_translation (symbol_t *this)
229  {  {
230    /* Non-terminal? */    /* Non-terminal? */
231    if (this->class == token_sym    if (this->class == token_sym
232        && this->user_token_number != SALIAS)        && this->user_token_number != USER_NUMBER_ALIAS)
233      {      {
234        /* A token which translation has already been set? */        /* A token which translation has already been set? */
235        if (token_translations[this->user_token_number] != undeftoken->number)        if (token_translations[this->user_token_number] != undeftoken->number)
# Line 998  parse_expect_decl (void) Line 998  parse_expect_decl (void)
998  |                                                                    |  |                                                                    |
999  | Two symbols are entered in the table, one for the token symbol and |  | Two symbols are entered in the table, one for the token symbol and |
1000  | one for the literal.  Both are given the <type>, if any, from the  |  | one for the literal.  Both are given the <type>, if any, from the  |
1001  | declaration.  The ->user_token_number of the first is SALIAS and   |  | declaration.  The ->user_token_number of the first is              |
1002  | the ->user_token_number of the second is set to the number, if     |  | USER_NUMBER_ALIAS and the ->user_token_number of the second is set |
1003  | any, from the declaration.  The two symbols are linked via         |  | to the number, if any, from the declaration.  The two symbols are  |
1004  | pointers in their ->alias fields.                                  |  | linked via pointers in their ->alias fields.                       |
1005  |                                                                    |  |                                                                    |
1006  | During OUTPUT_DEFINES_TABLE, the symbol is reported thereafter,    |  | During OUTPUT_DEFINES_TABLE, the symbol is reported thereafter,    |
1007  | only the literal string is retained it is the literal string that  |  | only the literal string is retained it is the literal string that  |
# Line 1014  parse_thong_decl (void) Line 1014  parse_thong_decl (void)
1014    token_t token;    token_t token;
1015    symbol_t *symbol;    symbol_t *symbol;
1016    char *typename = 0;    char *typename = 0;
1017    int usrtoknum = SUNDEF;    int usrtoknum = USER_NUMBER_UNDEFINED;
1018    
1019    token = lex ();               /* fetch typename or first token */    token = lex ();               /* fetch typename or first token */
1020    if (token == tok_typename)    if (token == tok_typename)
# Line 1035  parse_thong_decl (void) Line 1035  parse_thong_decl (void)
1035      }      }
1036    symval->class = token_sym;    symval->class = token_sym;
1037    symval->type_name = typename;    symval->type_name = typename;
1038    symval->user_token_number = SALIAS;    symval->user_token_number = USER_NUMBER_ALIAS;
1039    symbol = symval;    symbol = symval;
1040    
1041    token = lex ();               /* get number or literal string */    token = lex ();               /* get number or literal string */
# Line 1666  token_translations_init (void) Line 1666  token_translations_init (void)
1666    for (i = 0; i < ntokens; ++i)    for (i = 0; i < ntokens; ++i)
1667      {      {
1668        symbol_t *this = symbols[i];        symbol_t *this = symbols[i];
1669        if (this->user_token_number != SUNDEF)        if (this->user_token_number != USER_NUMBER_UNDEFINED)
1670          {          {
1671            if (this->user_token_number > max_user_token_number)            if (this->user_token_number > max_user_token_number)
1672              max_user_token_number = this->user_token_number;              max_user_token_number = this->user_token_number;
# Line 1676  token_translations_init (void) Line 1676  token_translations_init (void)
1676      }      }
1677    
1678    /* If 256 is not used, assign it to error, to follow POSIX.  */    /* If 256 is not used, assign it to error, to follow POSIX.  */
1679    if (num_256_available_p && errtoken->user_token_number == SUNDEF)    if (num_256_available_p
1680          && errtoken->user_token_number == USER_NUMBER_UNDEFINED)
1681      errtoken->user_token_number = 256;      errtoken->user_token_number = 256;
1682    
1683    /* Set the missing user numbers. */    /* Set the missing user numbers. */
# Line 1686  token_translations_init (void) Line 1687  token_translations_init (void)
1687    for (i = 0; i < ntokens; ++i)    for (i = 0; i < ntokens; ++i)
1688      {      {
1689        symbol_t *this = symbols[i];        symbol_t *this = symbols[i];
1690        if (this->user_token_number == SUNDEF)        if (this->user_token_number == USER_NUMBER_UNDEFINED)
1691          this->user_token_number = ++max_user_token_number;          this->user_token_number = ++max_user_token_number;
1692        if (this->user_token_number > max_user_token_number)        if (this->user_token_number > max_user_token_number)
1693          max_user_token_number = this->user_token_number;          max_user_token_number = this->user_token_number;

Legend:
Removed from v.1.173  
changed lines
  Added in v.1.174

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26