# Checking the output filenames. -*- Autotest -*-
-# Copyright 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002 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
# Mostly test that we are robust to mistakes.
+
+## ----------------------- ##
+## Torturing the Scanner. ##
+## ----------------------- ##
+
+AT_SETUP([Torturing the Scanner])
+
+AT_DATA([input.y],
+[[%{
+/* This is seen in GCC: a %{ and %} in middle of a comment. */
+const char *foo = "So %{ and %} can be here.";
+%}
+/* %{ and %} can be here too. */
+
+%%
+exp: 'a';
+]])
+
+AT_CHECK([bison input.y])
+
+AT_CLEANUP
+
+
+
+
## ------------ ##
## Invalid $n. ##
## ------------ ##
-
AT_SETUP([Invalid $n])
AT_DATA([input.y],
[[%%
-exp: { $$ = $1 ; }
+exp: { $$ = $1 ; };
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid $ value
+[[input.y:2: invalid value: $1
]])
AT_CLEANUP
## Invalid @n. ##
## ------------ ##
-
AT_SETUP([Invalid @n])
AT_DATA([input.y],
[[%%
-exp: { @$ = @1 ; }
+exp: { @$ = @1 ; };
+]])
+
+AT_CHECK([bison input.y], [1], [],
+[[input.y:2: invalid value: @1
+]])
+
+AT_CLEANUP
+
+
+## -------------- ##
+## Type clashes. ##
+## -------------- ##
+
+AT_SETUP([Type clashes])
+
+AT_DATA([input.y],
+[[%token foo
+%type <bar> exp
+%%
+exp: foo {} foo
+ | foo
+ | /* Empty. */
+ ;
]])
AT_CHECK([bison input.y], [1], [],
-[[input.y:2: invalid @ value
+[[input.y:5: type clash (`bar' `') on default action
+input.y:6: type clash (`bar' `') on default action
+input.y:7: empty rule for typed nonterminal, and no action
]])
AT_CLEANUP