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