]> git.saurik.com Git - bison.git/blobdiff - tests/regression.at
GCJ's parser requires the tokens to be defined before the prologue.
[bison.git] / tests / regression.at
index d1d819e692f7ddeaeb1176c94b2f34bf84e5b1c8..1adce97380280a5f496dc6cdea0539b15e1ca660 100644 (file)
 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.  ##
 ## ---------------- ##
 
 
-AT_SETUP([braces parsing])
+AT_SETUP([Braces parsing])
 
 AT_DATA([input.y],
 [[/* 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])
 
@@ -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
 
@@ -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.
 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