]> git.saurik.com Git - bison.git/blame - tests/c++.at
Fix impure push parser compile error reported by Bob Rossi at
[bison.git] / tests / c++.at
CommitLineData
e019c247 1# Checking the output filenames. -*- Autotest -*-
793fbca5 2# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
e019c247 3
f16b0819 4# This program is free software: you can redistribute it and/or modify
e019c247 5# it under the terms of the GNU General Public License as published by
f16b0819
PE
6# the Free Software Foundation, either version 3 of the License, or
7# (at your option) any later version.
8#
e019c247
AD
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.
f16b0819 13#
e019c247 14# You should have received a copy of the GNU General Public License
f16b0819 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
e019c247
AD
16
17AT_BANNER([[C++ Features.]])
18
19
20## ----------------------- ##
21## Doxygen Documentation. ##
22## ----------------------- ##
23
24m4_define([AT_CHECK_DOXYGEN],
25[m4_case([$1],
26 [Public], [m4_pushdef([AT_DOXYGEN_PRIVATE], [NO])],
27 [Private], [m4_pushdef([AT_DOXYGEN_PRIVATE], [YES])],
28 [m4_fatal([invalid argument: $1])])
29AT_SETUP([Doxygen $1 Documentation])
30
31AT_DATA([input.yy],
32[[%skeleton "lalr1.cc"
33%locations
34%debug
35%defines
36%%
37exp:;
38%%
39yy::parser::error (const location& l, const std::string& m)
40{
41 std::cerr << l << s << std::endl;
42}
43]])
44
da730230 45AT_BISON_CHECK([-o input.cc input.yy], 0)
e019c247
AD
46
47AT_DATA([Doxyfile],
48[# The PROJECT_NAME tag is a single word (or a sequence of words
49# surrounded by quotes) that should identify the project.
50PROJECT_NAME = "Bison C++ Parser"
51
52# The QUIET tag can be used to turn on/off the messages that are
53# generated by doxygen. Possible values are YES and NO. If left blank
54# NO is used.
55QUIET = YES
56
57# The WARNINGS tag can be used to turn on/off the warning messages
58# that are generated by doxygen. Possible values are YES and NO. If
59# left blank NO is used.
60WARNINGS = YES
61# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate
62# warnings for undocumented members. If EXTRACT_ALL is set to YES then
63# this flag will automatically be disabled.
64WARN_IF_UNDOCUMENTED = YES
65# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings
66# for potential errors in the documentation, such as not documenting
67# some parameters in a documented function, or documenting parameters
68# that don't exist or using markup commands wrongly.
69WARN_IF_DOC_ERROR = YES
70# The WARN_FORMAT tag determines the format of the warning messages
71# that doxygen can produce. The string should contain the $file,
72# $line, and $text tags, which will be replaced by the file and line
73# number from which the warning originated and the warning text.
74WARN_FORMAT = "$file:$line: $text"
75
76# If the EXTRACT_ALL tag is set to YES doxygen will assume all
77# entities in documentation are documented, even if no documentation
78# was available. Private class members and static file members will
79# be hidden unless the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set
80# to YES
81EXTRACT_ALL = YES
82
83# If the EXTRACT_PRIVATE tag is set to YES all private members of a
84# class will be included in the documentation.
85EXTRACT_PRIVATE = AT_DOXYGEN_PRIVATE
86
87# If the EXTRACT_STATIC tag is set to YES all static members of a file
88# will be included in the documentation.
89EXTRACT_STATIC = AT_DOXYGEN_PRIVATE
90])
91
92AT_CHECK([doxygen --version || exit 77], 0, ignore)
93AT_CHECK([doxygen], 0, [], [ignore])
94
95AT_CLEANUP
96
97m4_popdef([AT_DOXYGEN_PRIVATE])
98])# AT_CHECK_DOXYGEN
99
100AT_CHECK_DOXYGEN([Public])
101AT_CHECK_DOXYGEN([Private])
793fbca5
JD
102
103## ------------ ##
104## Namespaces. ##
105## ------------ ##
106
107# AT_CHECK_NAMESPACE(NAMESPACE-DECL, [COMPILE-ERROR])
108# ---------------------------------------------------
109# See if Bison can handle %define namespace "NAMESPACE-DECL". If COMPILE-ERROR
110# is specified, then Bison should accept the input, but compilation will fail,
111# so don't check compilation.
112m4_define([AT_CHECK_NAMESPACE],
113[
114
115AT_DATA_GRAMMAR([[input.y]],
116[[%language "C++"
117%defines
118%define namespace "]$1["
119%union { int i; }
120%define global_tokens_and_yystype
121
122%code {
123 // YYSTYPE contains a namespace reference.
124 int yylex (YYSTYPE *lval) {
125 lval->i = 3;
126 return 0;
127 }
128}
129
130%%
131
132start: ;
133
134%%
135
136void
137]$1[::parser::error (const ]$1[::parser::location_type &loc,
138 const std::string &msg)
139{
140 std::cerr << "At " << loc << ": " << msg << std::endl;
141}
142
143int
144main (void)
145{
146 ]$1[::parser p;
147 return p.parse ();
148}
149]])
150
da730230 151AT_BISON_CHECK([[-o input.cc input.y]])
793fbca5
JD
152
153m4_if([$#], [1],
154[AT_COMPILE_CXX([[input]], [[input.cc]])
155AT_PARSER_CHECK([[./input]])])
156
157])
158
159AT_SETUP([[Relative namespace references]])
160AT_CHECK_NAMESPACE([[foo]])
161AT_CHECK_NAMESPACE([[foo::bar]])
162AT_CHECK_NAMESPACE([[foo::bar::baz]])
163AT_CLEANUP
164
165AT_SETUP([[Absolute namespace references]])
166AT_CHECK_NAMESPACE([[::foo]])
167AT_CHECK_NAMESPACE([[::foo::bar]])
168AT_CHECK_NAMESPACE([[::foo::bar::baz]])
169AT_CHECK_NAMESPACE([[ ::foo]])
170AT_CHECK_NAMESPACE([[ ::foo::bar]])
171AT_CHECK_NAMESPACE([[ ::foo::bar::baz]])
172AT_CLEANUP
173
174AT_SETUP([[Syntactically invalid namespace references]])
175AT_CHECK_NAMESPACE([[:foo:bar]], [[-]])
176AT_CHECK_NAMESPACE([[foo: :bar]], [[-]])
177# This one is interesting because `[3]' is encoded as `@<:@3@:>@', which
178# contains single occurrences of `:'.
179AT_CHECK_NAMESPACE([[foo[3]::bar::baz]], [[-]])
180AT_CHECK_NAMESPACE([[foo::bar,baz]], [[-]])
181AT_CHECK_NAMESPACE([[foo::bar::(baz]], [[-]])
182AT_CLEANUP