X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/3dc4c5faa972ccf08d3988af986e591cf9822b43..e59adf8f042c54514f77baf82bac61fcfa414ee8:/tests/input.at diff --git a/tests/input.at b/tests/input.at index 4b3e4e21..886c14ad 100644 --- a/tests/input.at +++ b/tests/input.at @@ -1,5 +1,5 @@ # Checking the Bison scanner. -*- Autotest -*- -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2004, 2005 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 @@ -25,7 +25,7 @@ AT_BANNER([[Input Processing.]]) ## Invalid $n. ## ## ------------ ## -AT_SETUP([Invalid $n]) +AT_SETUP([Invalid dollar-n]) AT_DATA([input.y], [[%% @@ -82,6 +82,43 @@ input.y:6.5: warning: empty rule for typed nonterminal, and no action AT_CLEANUP +## ---------------------- ## +## Incompatible Aliases. ## +## ---------------------- ## + +AT_SETUP([Incompatible Aliases]) + +AT_DATA([input.y], +[[%token foo "foo" + +%type foo +%printer {bar} foo +%destructor {bar} foo +%left foo + +%type "foo" +%printer {baz} "foo" +%destructor {baz} "foo" +%left "foo" + +%% +exp: foo; +]]) + +AT_CHECK([bison input.y], [1], [], +[[input.y:8.7-11: %type redeclaration for foo +input.y:3.7-11: first declaration +input.y:10.13-17: %destructor redeclaration for foo +input.y:5.13-17: first declaration +input.y:9.19-23: %printer redeclaration for foo +input.y:10.13-17: first declaration +input.y:11.1-5: %left redeclaration for foo +input.y:6.1-5: first declaration +]]) + +AT_CLEANUP + + ## ----------------------- ## ## Torturing the Scanner. ## @@ -235,3 +272,28 @@ AT_PARSER_CHECK([./input], 0, ]]) AT_CLEANUP + + +## ---------------------- ## +## Typed symbol aliases. ## +## ---------------------- ## + +AT_SETUP([Typed symbol aliases]) + +# Bison 2.0 broke typed symbol aliases - ensure they work. + +AT_DATA_GRAMMAR([input.y], +[[%union +{ + int val; +}; +%token MY_TOKEN "MY TOKEN" +%type exp +%% +exp: "MY TOKEN"; +%% +]]) + +AT_CHECK([bison -o input.c input.y]) + +AT_CLEANUP