mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
GCJ's parser requires the tokens to be defined before the prologue.
* data/bison.simple: Output the token definition before the user's prologue. * tests/regression.at (Braces parsing, Duplicate string) (Mixing %token styles): Check the output from bison. (Early token definitions): New.
This commit is contained in:
10
ChangeLog
10
ChangeLog
@@ -1,3 +1,13 @@
|
|||||||
|
2002-06-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
|
GCJ's parser requires the tokens to be defined before the prologue.
|
||||||
|
|
||||||
|
* data/bison.simple: Output the token definition before the user's
|
||||||
|
prologue.
|
||||||
|
* tests/regression.at (Braces parsing, Duplicate string)
|
||||||
|
(Mixing %token styles): Check the output from bison.
|
||||||
|
(Early token definitions): New.
|
||||||
|
|
||||||
2002-06-10 Akim Demaille <akim@epita.fr>
|
2002-06-10 Akim Demaille <akim@epita.fr>
|
||||||
|
|
||||||
* src/symtab.c (symbol_user_token_number_set): Don't complain when
|
* src/symtab.c (symbol_user_token_number_set): Don't complain when
|
||||||
|
|||||||
@@ -175,6 +175,8 @@ m4_if(b4_prefix[], [yy], [],
|
|||||||
/* Copy the first part of user declarations. */
|
/* Copy the first part of user declarations. */
|
||||||
b4_pre_prologue
|
b4_pre_prologue
|
||||||
|
|
||||||
|
b4_token_defines(b4_tokens)
|
||||||
|
|
||||||
/* Enabling traces. */
|
/* Enabling traces. */
|
||||||
#ifndef YYDEBUG
|
#ifndef YYDEBUG
|
||||||
# define YYDEBUG b4_debug
|
# define YYDEBUG b4_debug
|
||||||
@@ -312,8 +314,6 @@ union yyalloc
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
b4_token_defines(b4_tokens)
|
|
||||||
|
|
||||||
/* YYFINAL -- State number of the termination state. */
|
/* YYFINAL -- State number of the termination state. */
|
||||||
#define YYFINAL b4_final
|
#define YYFINAL b4_final
|
||||||
#define YYFLAG b4_flag
|
#define YYFLAG b4_flag
|
||||||
|
|||||||
@@ -19,12 +19,50 @@
|
|||||||
AT_BANNER([[Regression tests.]])
|
AT_BANNER([[Regression tests.]])
|
||||||
|
|
||||||
|
|
||||||
|
## ------------------------- ##
|
||||||
|
## Early token definitions. ##
|
||||||
|
## ------------------------- ##
|
||||||
|
|
||||||
|
|
||||||
|
AT_SETUP([Early token definitions])
|
||||||
|
|
||||||
|
# Found in GCJ: they expect the tokens to be defined before the user
|
||||||
|
# prologue, so that they can use the token definitions in it.
|
||||||
|
|
||||||
|
AT_DATA([input.y],
|
||||||
|
[[%{
|
||||||
|
void yyerror (const char *s);
|
||||||
|
int yylex (void);
|
||||||
|
%}
|
||||||
|
|
||||||
|
%union
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
%{
|
||||||
|
#ifndef MY_TOKEN
|
||||||
|
# error "MY_TOKEN not defined."
|
||||||
|
#endif
|
||||||
|
%}
|
||||||
|
%token MY_TOKEN
|
||||||
|
%%
|
||||||
|
exp: MY_TOKEN;
|
||||||
|
%%
|
||||||
|
]])
|
||||||
|
|
||||||
|
AT_CHECK([bison input.y -o input.c])
|
||||||
|
AT_CHECK([$CC $CFLAGS $CPPFLAGS input.c -c])
|
||||||
|
|
||||||
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
## Braces parsing. ##
|
## Braces parsing. ##
|
||||||
## ---------------- ##
|
## ---------------- ##
|
||||||
|
|
||||||
|
|
||||||
AT_SETUP([braces parsing])
|
AT_SETUP([Braces parsing])
|
||||||
|
|
||||||
AT_DATA([input.y],
|
AT_DATA([input.y],
|
||||||
[[/* Bison used to swallow the character after `}'. */
|
[[/* Bison used to swallow the character after `}'. */
|
||||||
@@ -34,7 +72,7 @@ exp: { tests = {{{{{{{{{{}}}}}}}}}}; };
|
|||||||
%%
|
%%
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison -v input.y -o input.c], 0, ignore, ignore)
|
AT_CHECK([bison -v input.y -o input.c])
|
||||||
|
|
||||||
AT_CHECK([fgrep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c], 0, [ignore])
|
AT_CHECK([fgrep 'tests = {{{{{{{{{{}}}}}}}}}};' input.c], 0, [ignore])
|
||||||
|
|
||||||
@@ -61,7 +99,9 @@ exp: '(' exp ')' | NUM ;
|
|||||||
%%
|
%%
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison -v input.y -o input.c], 0, ignore, ignore)
|
AT_CHECK([bison -v input.y -o input.c], 0, [],
|
||||||
|
[[input.y:6: warning: symbol `"<="' used more than once as a literal string
|
||||||
|
]])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -102,7 +142,7 @@ expr:
|
|||||||
};
|
};
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison input.y -o input.c -v], 0, [], [])
|
AT_CHECK([bison input.y -o input.c -v])
|
||||||
|
|
||||||
# Check the contents of the report.
|
# Check the contents of the report.
|
||||||
AT_CHECK([cat input.output], [],
|
AT_CHECK([cat input.output], [],
|
||||||
@@ -230,7 +270,7 @@ exp: ;
|
|||||||
%%
|
%%
|
||||||
]])
|
]])
|
||||||
|
|
||||||
AT_CHECK([bison -v input.y -o input.c], 0, ignore, ignore)
|
AT_CHECK([bison -v input.y -o input.c])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user