Redo some of the previous commit: add back the ability to use

non-aliased/undeclared string literals since it might be useful to
those declaring %token-table.
* src/reader.c (check_and_convert_grammar): Undo changes in previous
commit: don't worry about complaints from symbols_pack.
* src/symtab.c (symbol_new, symbol_class_set,
symbol_check_alias_consistency): Undo changes in previous commit: count         each string literal as a new symbol and token, assign it a symbol
number, and don't complain about non-aliased string literals.
(symbols_pack): Since symbol_make_alias still does not decrement symbol
and token counts but does still set aliased tokens to the same number,
symbol_pack_processor now leaves empty slots in the symbols array.
Remove those slots.
* tests/regression.at (Undeclared string literal): Remove test case
added in previous commit since non-aliased string literals are allowed
again.
(Characters Escapes, Web2c Actions): Undo changes in previous commit:
remove unnecessary string literal declarations.
* tests/sets.at (Firsts): Likewise.
This commit is contained in:
Joel E. Denny
2006-08-18 21:43:18 +00:00
parent 965537bc54
commit 6d0ef4ec20
5 changed files with 54 additions and 45 deletions

View File

@@ -489,9 +489,7 @@ AT_DATA_GRAMMAR([input.y],
void yyerror (const char *s);
int yylex (void);
%}
[%token QUOTES "\""
%token TICK "'"
%%
[%%
exp:
'\'' "\'"
| '\"' "\""
@@ -702,10 +700,6 @@ statement: struct_stat;
struct_stat: /* empty. */ | if else;
if: "if" "const" "then" statement;
else: "else" statement;
%token IF "if";
%token CONST "const";
%token THEN "then";
%token ELSE "else";
%%
]])
@@ -1126,7 +1120,7 @@ AT_SETUP([String alias declared after use])
# Bison once incorrectly asserted that the symbol number for either a token or
# its alias was the highest symbol number so far at the point of the alias
# declaration. That was true unless the declaration appeared after their first
# uses.
# uses and other tokens appeared in between.
AT_DATA([input.y],
[[%%
@@ -1137,25 +1131,3 @@ start: 'a' "A" 'b';
AT_CHECK([bison -t -o input.c input.y])
AT_CLEANUP
## --------------------------- ##
## Undeclared string literal. ##
## --------------------------- ##
AT_SETUP([Undeclared string literal])
# Bison once allowed a string literal to be used in the grammar without any
# declaration assigning it as an alias of another token.
AT_DATA([input.y],
[[%%
start: "abc";
]])
AT_CHECK([bison -t -o input.c input.y], [1], [],
[[input.y:2.8-12: "abc" undeclared
]])
AT_CLEANUP

View File

@@ -196,7 +196,6 @@ AT_DATA([input.y],
[[%nonassoc '<' '>'
%left '+' '-'
%right '^' '='
%token EXP "exp"
%%
exp:
exp '<' exp