glr.c: example: several improvements
[bison.git] / examples / c / glr / c++-types.test
blob46e10483bdf4c1c37d35a6e3c562dd60e7fb3048
1 #! /bin/sh
3 # Copyright (C) 2020 Free Software Foundation, Inc.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 cat >input <<EOF
19 z + q;
21 T x;
23 T x = y;
25 x = y;
27 T (x) + y;
29 T (x);
31 T (y) = z + q;
33 T (y y) = z + q;
35 z + q;
36 EOF
37 run 0 "\
38 1.0-4: +(z,q)
39 3.0-2: <declare>(T,x)
40 5.0-6: <init-declare>(T,x,y)
41 7.0-4: =(x,y)
42 9.0-8: +(<cast>(x,T),y)
43 11.0-4: <OR>(<declare>(T,x),<cast>(x,T))
44 13.0-12: <OR>(<init-declare>(T,y,+(z,q)),=(<cast>(y,T),+(z,q)))
45 15.0-14: <error>
46 17.0-4: +(z,q)
47 err: 15.5: syntax error, unexpected identifier, expecting '=' or '+' or ')'"