X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/17bd8a736a491f4867176b3885e39e74dc07f854..c3d503425f8014b432601a33b3398446d63b5963:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 1239df00..fd389a58 100644 --- a/tests/input.at +++ b/tests/input.at @@ -25,7 +25,7 @@ AT_BANNER([[Input Processing.]]) ## Invalid $n. ## ## ------------ ## -AT_SETUP([Invalid \$n and @n]) +AT_SETUP([Invalid $n and @n]) AT_DATA([input.y], [[%% @@ -188,11 +188,11 @@ AT_DATA([[input.y]], %destructor { destroy ($$); } <*> %printer { destroy ($$); } <*> -%destructor { destroy ($$); } -%printer { destroy ($$); } +%destructor { destroy ($$); } <> <> +%printer { destroy ($$); } <> <> -%destructor { destroy ($$); } -%printer { destroy ($$); } +%destructor { destroy ($$); } <> +%printer { destroy ($$); } <> %% @@ -201,8 +201,8 @@ start: ; %destructor { destroy ($$); } <*>; %printer { destroy ($$); } <*>; -%destructor { destroy ($$); } ; -%printer { destroy ($$); } ; +%destructor { destroy ($$); } <>; +%printer { destroy ($$); } <>; ]]) AT_CHECK([bison input.y], [1], [], @@ -285,7 +285,7 @@ AT_CLEANUP AT_SETUP([Unused values with default %destructor]) AT_DATA([[input.y]], -[[%destructor { destroy ($$); } +[[%destructor { destroy ($$); } <> %type tagged %% @@ -470,7 +470,7 @@ char quote[] = "@:>@@:>@,"; %{ static void yyerror (const char *s); -static int yylex (void); +int yylex (void); %} %type '@<:@' @@ -503,7 +503,7 @@ value_as_yystype (value val) return res; } -static int +int yylex (void) { static char const input[] = "@<:@\1\2$@{@oline@__@&t@oline__\ @@ -529,7 +529,11 @@ AT_DATA([main.c], [[typedef int value; #include "input.h" +#ifndef YYPUSH_DECLS int yyparse (void); +#else +int yylex (void); +#endif int main (void) @@ -680,3 +684,24 @@ start: false_start ; AT_CHECK([bison -o input.c input.y]) AT_CLEANUP + + +## --------------------- ## +## %prec takes a token. ## +## --------------------- ## + +AT_SETUP([%prec takes a token]) + +# Bison once allowed %prec sym where sym was a nonterminal. + +AT_DATA([input.y], +[[%% +start: PREC %prec PREC ; +PREC: ; +]]) + +AT_CHECK([bison input.y], [1], [], +[[input.y:3.1-4: rule given for PREC, which is a token +]]) + +AT_CLEANUP