/* Token-reader for Bison's input parser,
- Copyright 1984, 1986, 1989, 1992, 2000, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1986, 1989, 1992, 2000, 2001, 2002
+ Free Software Foundation, Inc.
This file is part of Bison, the GNU Compiler Compiler.
obstack_1grow (&token_obstack, '\0');
token_buffer = obstack_finish (&token_obstack);
symval = getsym (token_buffer);
- if (symval->number == -1)
- {
- symval->number = ntokens++;
- symval->class = token_sym;
- if (symval->user_token_number == SUNDEF)
- symval->user_token_number = code;
- }
+ symbol_class_set (symval, token_sym);
+ symbol_user_token_number_set (symval, code);
return tok_identifier;
}
/* parse the literal string token and treat as an identifier */
{
- int code; /* ignored here */
+ int code;
obstack_1grow (&token_obstack, '\"');
/* Read up to and including ". */
token_buffer = obstack_finish (&token_obstack);
symval = getsym (token_buffer);
- if (symval->number == -1)
- {
- symval->number = ntokens++;
- symval->class = token_sym;
- }
-
+ symbol_class_set (symval, token_sym);
return tok_identifier;
}
token_t
parse_percent_token (void)
{
- const struct option_table_struct *tx = NULL;
+ const struct option_table_s *tx = NULL;
const char *arg = NULL;
/* Where the ARG was found in token_buffer. */
size_t arg_offset = 0;
switch (tx->ret_val)
{
case tok_stropt:
- assert (tx->set_flag);
+ assert (tx->flag);
if (arg)
{
+ char **flag = (char **) tx->flag;
/* Keep only the first assignment: command line options have
already been processed, and we want them to have
precedence. Side effect: if this %-option is used
several times, only the first is honored. Bah. */
- if (!*((char **) (tx->set_flag)))
- *((char **) (tx->set_flag)) = xstrdup (arg);
+ if (!*flag)
+ *flag = xstrdup (arg);
}
else
fatal (_("`%s' requires an argument"), token_buffer);
break;
case tok_intopt:
- assert (tx->set_flag);
- *((int *) (tx->set_flag)) = 1;
+ assert (tx->flag);
+ *((int *) (tx->flag)) = 1;
return tok_noop;
break;