From: Valentin Tolmer Date: Fri, 25 Jan 2013 10:12:49 +0000 (+0100) Subject: tests: add token declaration order test X-Git-Tag: v2.7.90~154 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/9e62f1a6572dd1d450d6127c553f8eb8cd0be73c?ds=inline tests: add token declaration order test * tests/conflicts.at: New test. --- diff --git a/tests/conflicts.at b/tests/conflicts.at index 81765aac..5325b69e 100644 --- a/tests/conflicts.at +++ b/tests/conflicts.at @@ -18,6 +18,74 @@ 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 + ]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); +} +]]) + +AT_FULL_COMPILE([input]) + +AT_CHECK([./input]) + +AT_BISON_OPTION_POPDEFS + +AT_CLEANUP + + ## ---------------- ## ## S/R in initial. ## ## ---------------- ##