# Exercising Bison on conflicts. -*- Autotest -*-
-# Copyright (C) 2002-2005, 2007-2012 Free Software Foundation, Inc.
+# Copyright (C) 2002-2005, 2007-2013 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
AT_BANNER([[Conflicts.]])
+## ------------------------ ##
+## Token declaration order. ##
+## ------------------------ ##
+
+# This test checks that token are declared left to right when in a precedence
+# statement.
+
+AT_SETUP([Token declaration order])
+
+AT_BISON_OPTION_PUSHDEFS
+
+AT_DATA_GRAMMAR([[input.y]],
+[[%code {
+ #include <stdio.h>
+ ]AT_YYERROR_DECLARE[
+ ]AT_YYLEX_DECLARE[
+}
+%token A B C
+%token D
+%right E F G
+%right H I
+%right J
+%left K
+%left L M N
+%nonassoc O P Q
+%precedence R S T U
+%precedence V W
+%%
+exp: A
+%%
+]AT_YYERROR_DEFINE[
+]AT_YYLEX_DEFINE[
+int main (void)
+{
+ assert (A < B);
+ assert (B < C);
+ assert (C < D);
+ assert (D < E);
+ assert (E < F);
+ assert (F < G);
+ assert (G < H);
+ assert (H < I);
+ assert (I < J);
+ assert (J < K);
+ assert (K < L);
+ assert (L < M);
+ assert (M < N);
+ assert (N < O);
+ assert (O < P);
+ assert (P < Q);
+ assert (Q < R);
+ assert (R < S);
+ assert (S < T);
+ assert (T < U);
+ assert (U < V);
+ assert (V < W);
+ return 0;
+}
+]])
+
+AT_FULL_COMPILE([input])
+
+AT_PARSER_CHECK([./input])
+
+AT_BISON_OPTION_POPDEFS
+
+AT_CLEANUP
+
+
## ---------------- ##
## S/R in initial. ##
## ---------------- ##
/*-------.
| main. |
-`-------*/]AT_SKEL_JAVA_IF([[
-
-class input
-{
- public static void main (String args[]) throws IOException
- {
- YYParser p = new YYParser ();
- p.parse ();
- }
-}]], [AT_SKEL_CC_IF([[
-
-int
-main (void)
-{
- yy::parser parser;
- return parser.parse ();
-}]], [[
-
-int
-main (void)
-{
- return yyparse ();
-}]])])[
-]])
+`-------*/
+]AT_MAIN_DEFINE
+])
AT_FULL_COMPILE([[input]])
%%
]AT_YYERROR_DEFINE[
]AT_YYLEX_DEFINE(["aaa"])[
-
-int
-main (void)
-{
- return yyparse ();
-}
-]])
+]AT_MAIN_DEFINE
+])
AT_BISON_OPTION_POPDEFS
# Show canonical LR's failure.