Debian Codegraph @

examples/c++/glr/c++-types.test

raw
1 #! /bin/sh
2
3 # Copyright (C) 2020-2021 Free Software Foundation, Inc.
4 #
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.
9 #
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.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
18 cat >input <<EOF
19 z + q;
20
21 T x;
22
23 T x = y;
24
25 x = y;
26 EOF
27 run 0 "\
28 1.0-5: +(z, q)
29 3.0-3: <declare>(T, x)
30 5.0-7: <init-declare>(T, x, y)
31 7.0-5: =(x, y)"
32
33 cat >input <<EOF
34 T (x) + y;
35
36 T (x);
37
38 T (y) = z + q;
39
40 T (y y) = z + q;
41
42 z + q;
43 EOF
44 run 0 "\
45 1.0-9: +(<cast>(x, T), y)
46 3.0-5: <OR>(<declare>(T, x), <cast>(x, T))
47 5.0-13: <OR>(<init-declare>(T, y, +(z, q)), =(<cast>(y, T), +(z, q)))
48 7.0-15: <error>
49 9.0-5: +(z, q)
50 err: 7.5: syntax error on token identifier (expected = or + or ))"