1 # Checking the output filenames. -*- Autotest -*-
2 # Copyright (C) 2002 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 AT_BANNER([[Input Processing.]])
21 # Mostly test that we are robust to mistakes.
28 AT_SETUP([Invalid $n])
35 AT_CHECK([bison input.y], [1], [],
36 [[input.y:2.6-14: integer out of range: `$1'
46 AT_SETUP([Invalid @n])
53 AT_CHECK([bison input.y], [1], [],
54 [[input.y:2.6-14: integer out of range: `@1'
64 AT_SETUP([Type Clashes])
76 AT_CHECK([bison input.y], [1], [],
77 [[input.y:4.4-15: type clash on default action: <bar> != <>
78 input.y:5.4-8: type clash on default action: <bar> != <>
79 input.y:6.4: empty rule for typed nonterminal, and no action
86 ## ----------------------- ##
87 ## Torturing the Scanner. ##
88 ## ----------------------- ##
90 # Be sure to compile and run, so that the C compiler checks what
93 AT_SETUP([Torturing the Scanner])
97 /* This is seen in GCC: a %{ and %} in middle of a comment. */
98 const char *foo = "So %{ and %} can be here too.";
102 * A comment with backslash-newlines in it. %{ %} *\
106 " A string with backslash-newlines in it %{ %} \\
109 char apostrophe = '\\
116 /* %{ and %} can be here too. */
119 /* Exercise pre-prologue dependency to %union. */
123 /* Exercise M4 quoting: '@:>@@:>@', 0. */
125 /* Also exercise %union. */
128 value_t ival; /* A comment to exercise an old bug. */
132 /* Exercise post-prologue dependency to %union. */
134 static YYSTYPE value_t_as_yystype (value_t val);
136 /* Exercise quotes in declarations. */
137 char quote[] = "@:>@@:>@,";
141 static void yyerror (const char *s);
142 static int yylex (void);
147 /* Exercise quotes in strings. */
148 %token FAKE "fake @<:@@:>@ \a\b\f\n\r\t\v\"\'\?\\\u005B\U0000005c ??!??'??(??)??-??/??<??=??> \x0\0"
151 /* Exercise M4 quoting: '@:>@@:>@', @<:@, 1. */
152 exp: '@<:@' '\1' two '$' '@' '{' oline output
154 /* Exercise quotes in braces. */
155 char tmp[] = "@<:@%c@:>@,\n";
160 two: '\x000000000000000000000000000000000000000000000000000000000000000000002';
161 oline: '@' 'o' 'l' 'i' 'n' 'e' '@' '_' '_' 'o' 'l' 'i' 'n' 'e' '_' '_';
162 output: '#' 'o' 'u' 't' 'p' 'u' 't' ' ';
164 /* Exercise M4 quoting: '@:>@@:>@', @<:@, 2. */
167 value_t_as_yystype (value_t val)
177 static const char *input = "@<:@\1\2$@{@oline@__@&t@oline__\
180 yylval = value_t_as_yystype (*input);
185 yyerror (const char *msg)
187 fprintf (stderr, "%s\n", msg);
192 [[typedef int value_t;
204 AT_CHECK([bison -d -v -o input.c input.y])
205 AT_COMPILE([input.o], [-c input.c])
206 AT_COMPILE([main.o], [-c main.c])
207 AT_COMPILE([input], [input.o main.o])
208 AT_PARSER_CHECK([./input], 0,