[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [SPAM] Re: [updated PATCH] %language declaration
From: |
Paolo Bonzini |
Subject: |
Re: [SPAM] Re: [updated PATCH] %language declaration |
Date: |
Wed, 13 Dec 2006 10:13:00 +0100 |
User-agent: |
Thunderbird 1.5.0.8 (Macintosh/20061025) |
I'd still like to drop the ".tab". As long as we say %language is
experimental, we can change our minds later if it causes trouble.
I think this would complicate a bit the patch, because I wouldn't be
able to use valid_languages[0] as the default. I'd rather leave this
for later, possibly for when we implement the language.m4 idea --
invoking the experimental-ness of %language helps me too...
What if we merge the valid_languages table (appearing in src/getargs.c)
with data/c++-skel.m4 and data/c-skel.m4 to produce a single
data/language.m4? This kind of single config script for %language would
make it easier for users and developers to add support for new languages
and skeletons without rebuilding Bison. I think it would also simplify
your patch and reduce %language's footprint in the Bison front-end source.
This I'm not sure, but the idea is worth giving a whirl...
What do you think?
... however, I'd rather do this later, because I see this as a cleanup.
I also need some time to digest your latest @output patch (which would
ease the implementation too) and to see how this idea would interact
with %skeleton, then I'll come back.
Paolo
2006-10-09 Paolo Bonzini <address@hidden>
* NEWS: Document %language.
* data/c-skel.m4, data/c++-skel.m4: New.
* data/glr.c: Complain on push parsers.
* doc/bison.texinfo (C++ Parser Interface): Prefer %language
over %skeleton.
(Directives): Document %language and %skeleton.
(Command line): Document -L.
* doc/Makefile.am (maintainer-check): New.
* Makefile.am (maintainer-check): Recurse into doc.
* src/files.c (compute_exts_from_gc): Look in language structure
for .y extension.
(compute_file_name_parts): Check whether .tab should be added.
* src/getargs.c (valid_languages, skeleton_prio, language_prio,
language, skeleton_arg, language_argmatch): New.
(long_options): Add --language.
(getargs): Use skeleton_arg, add -L/--language.
* src/getargs.h: Include location.h.
(struct bison_language, language, skeleton_arg, language_argmatch): New.
* src/output.c (prepare): Pick default skeleton from struct language.
Don't dispatch C skeletons here.
* src/parse-gram.y (PERCENT_LANGUAGE): New.
(prologue_declaration): Add "%language" rule, use skeleton_arg.
* src/scan-gram.l ("%language"): New rule.
* tests/calc.at: Test %skeleton and %language.
* tests/local.at (AT_SKEL_CC_IF): Look for %language.
(AT_GLR_IF): Look for %skeleton "glr.cc".
(AT_LALR1_CC_IF, AT_GLR_CC_IF): Rewrite.
(AT_YACC_IF): Reject %language.
Index: Makefile.am
===================================================================
RCS file: /sources/bison/bison/Makefile.am,v
retrieving revision 1.44
diff -u -r1.44 Makefile.am
--- Makefile.am 21 Dec 2005 00:11:44 -0000 1.44
+++ Makefile.am 13 Dec 2006 09:01:16 -0000
@@ -34,4 +34,5 @@
.PHONY: maintainer-check
maintainer-check:
+ cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
cd tests && $(MAKE) $(AM_MAKEFLAGS) $@
Index: NEWS
===================================================================
RCS file: /sources/bison/bison/NEWS,v
retrieving revision 1.168
diff -u -r1.168 NEWS
--- NEWS 5 Dec 2006 23:13:41 -0000 1.168
+++ NEWS 13 Dec 2006 09:01:23 -0000
@@ -18,6 +18,11 @@
%name-prefix "c_"
%output "parser.c"
+* A new experimental directive %language allows to specify the language
+ of the generated parser. Supported languages are C (the default) and
+ C++. Besides the skeleton that is used, the directive affects
+ the names of the generated files if the grammar has extension ".y".
+
* Revised warning: unset or unused mid-rule values
Since Bison 2.2, Bison has warned about mid-rule values that are set but not
Index: data/Makefile.am
===================================================================
RCS file: /sources/bison/bison/data/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- data/Makefile.am 12 Oct 2006 22:40:52 -0000 1.15
+++ data/Makefile.am 13 Dec 2006 09:01:24 -0000
@@ -16,8 +16,8 @@
## 02110-1301 USA
dist_pkgdata_DATA = README bison.m4 \
- c.m4 yacc.c glr.c push.c \
- c++.m4 location.cc lalr1.cc glr.cc
+ c-skel.m4 c.m4 yacc.c glr.c push.c \
+ c++-skel.m4 c++.m4 location.cc lalr1.cc glr.cc
m4sugardir = $(pkgdatadir)/m4sugar
dist_m4sugar_DATA = m4sugar/m4sugar.m4
Index: data/c++-skel.m4
===================================================================
RCS file: data/c++-skel.m4
diff -N data/c++-skel.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ data/c++-skel.m4 13 Dec 2006 09:08:59 -0000
@@ -0,0 +1,29 @@
+m4_divert(-1) -*- Autoconf -*-
+
+# C++ skeleton dispatching for Bison.
+# Copyright (C) 2006 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+b4_glr_if( [m4_define([b4_used_skeleton],
[b4_pkgdatadir/[glr.cc]])])
+b4_nondeterministic_if([m4_define([b4_used_skeleton],
[b4_pkgdatadir/[glr.cc]])])
+
+b4_push_if([m4_fatal([%push-parser is not supported by C++])])
+
+m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[lalr1.cc]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)
Index: data/c-skel.m4
===================================================================
RCS file: data/c-skel.m4
diff -N data/c-skel.m4
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ data/c-skel.m4 13 Dec 2006 09:08:59 -0000
@@ -0,0 +1,28 @@
+m4_divert(-1) -*- Autoconf -*-
+
+# C skeleton dispatching for Bison.
+# Copyright (C) 2006 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 USA
+
+b4_push_if( [m4_define([b4_used_skeleton],
[b4_pkgdatadir/[push.c]])])
+b4_glr_if( [m4_define([b4_used_skeleton],
[b4_pkgdatadir/[glr.c]])])
+b4_nondeterministic_if([m4_define([b4_used_skeleton],
[b4_pkgdatadir/[glr.c]])])
+
+m4_define_default([b4_used_skeleton], [b4_pkgdatadir/[yacc.c]])
+m4_define_default([b4_skeleton], ["b4_basename(b4_used_skeleton)"])
+
+m4_include(b4_used_skeleton)
Index: data/glr.c
===================================================================
RCS file: /sources/bison/bison/data/glr.c,v
retrieving revision 1.193
diff -u -r1.193 glr.c
--- data/glr.c 12 Dec 2006 06:47:39 -0000 1.193
+++ data/glr.c 13 Dec 2006 09:01:41 -0000
@@ -21,6 +21,9 @@
m4_include(b4_pkgdatadir/[c.m4])
+b4_push_if([
+m4_fatal([Non-deterministic push parsers are not yet supported])])
+
## ---------------- ##
## Default values. ##
## ---------------- ##
Index: doc/Makefile.am
===================================================================
RCS file: /sources/bison/bison/doc/Makefile.am,v
retrieving revision 1.13
diff -u -r1.13 Makefile.am
--- doc/Makefile.am 27 Jun 2006 14:09:53 -0000 1.13
+++ doc/Makefile.am 13 Dec 2006 09:01:50 -0000
@@ -65,3 +65,13 @@
$(edit) $(srcdir)/Doxyfile.in >Doxyfile
CLEANDIRS += html latex
+
+.PHONY: maintainer-check
+maintainer-check:
+ @case '@VERSION@' in *+) exit 0 ;; esac; \
+ grep '%require[ ][ ]*".*+"' \
+ $(srcdir)/bison.texinfo > /dev/null || exit 0; \
+ echo ; \
+ echo 'ERROR: a %require in $(top_srcdir)/doc/bison.texinfo specifies a
development version.'; \
+ echo ; \
+ exit 1
Index: doc/bison.texinfo
===================================================================
RCS file: /sources/bison/bison/doc/bison.texinfo,v
retrieving revision 1.215
diff -u -r1.215 bison.texinfo
--- doc/bison.texinfo 9 Dec 2006 18:52:01 -0000 1.215
+++ doc/bison.texinfo 13 Dec 2006 09:02:59 -0000
@@ -4619,6 +4619,12 @@
chosen as if the input file were named @address@hidden
@end deffn
address@hidden {Directive} %language="@var{language}"
+Specify the programming language for the generated parser. Currently
+supported languages include C and C+. This directive is experimental
+and may be subject to backwards-incompatible changes in future releases.
address@hidden deffn
+
@deffn {Directive} %locations
Generate the code processing the locations (@pxref{Action Features,
,Special Features for Use in Actions}). This mode is enabled as soon as
@@ -4681,6 +4687,11 @@
Require a Version of Bison}.
@end deffn
address@hidden {Directive} %skeleton "@var{file}"
+Specify the skeleton to use. You probably don't need this option unless
+you are developing Bison.
address@hidden deffn
+
@deffn {Directive} %token-table
Generate an array of token names in the parser file. The name of the
array is @code{yytname}; @address@hidden is the name of the
@@ -7262,8 +7273,9 @@
@table @option
@item -S @var{file}
@itemx address@hidden
-Specify the skeleton to use. You probably don't need this option unless
-you are developing Bison.
+Specify the skeleton to use, as if @code{%skeleton} was specified
+(@pxref{Decl Summary, , Bison Declaration Summary}). You probably
+don't need this option unless you are developing Bison.
@item -t
@itemx --debug
@@ -7271,6 +7283,12 @@
already defined, so that the debugging facilities are compiled.
@xref{Tracing, ,Tracing Your Parser}.
address@hidden -L @var{language}
address@hidden address@hidden
+Specify the programming language for the generated parser, as if
address@hidden was specified (@pxref{Decl Summary, , Bison Declaration
+Summary}). Currently supported languages include C and C++.
+
@item --locations
Pretend that @code{%locations} was specified. @xref{Decl Summary}.
@@ -7433,14 +7451,24 @@
@node C++ Bison Interface
@subsection C++ Bison Interface
address@hidden - %skeleton "lalr1.cc"
address@hidden - %language "C++"
@c - Always pure
@c - initial action
-The C++ parser @acronym{LALR}(1) skeleton is named @file{lalr1.cc}. To
-select it, you may either pass the option @option{--skeleton=lalr1.cc}
-to Bison, or include the directive @samp{%skeleton "lalr1.cc"} in the
-grammar preamble. When run, @command{bison} will create several
+The C++ parser @acronym{LALR}(1) skeleton is selected using a
+language directive, @samp{%language "C++"}, or the synonymous
+command-line option @address@hidden both
+ the grammar directive and the command-line option, the
+ language name is case-insensitive}. These were introduced
+in Bison 2.3b; for compatibility with earlier versions, you
+may also pass the option @option{--skeleton=lalr1.cc} to Bison
+or include the directive @samp{%skeleton "lalr1.cc"} in the
+grammar preamble. Specifying the language is however preferred,
+because it is clearer and because it will automatically choose the
+correct skeleton for GLR parsers (the C++ GLR skeleton is still
+under development).
+
+When run, @command{bison} will create several
entities in the @samp{yy} namespace. Use the @samp{%name-prefix}
directive to change the namespace name, see @ref{Decl Summary}. The
various classes are generated in the following files:
@@ -7828,8 +7856,8 @@
@comment file: calc++-parser.yy
@example
-%skeleton "lalr1.cc" /* -*- C++ -*- */
-%require "2.1a"
+%language "C++" /* -*- C++ -*- */
+%require "2.3a+"
%defines
%define "parser_class_name" "calcxx_parser"
@end example
Index: src/files.c
===================================================================
RCS file: /sources/bison/bison/src/files.c,v
retrieving revision 1.101
diff -u -r1.101 files.c
--- src/files.c 12 Dec 2006 06:47:39 -0000 1.101
+++ src/files.c 13 Dec 2006 09:03:07 -0000
@@ -153,12 +153,20 @@
static void
compute_exts_from_gf (const char *ext)
{
- src_extension = xstrdup (ext);
- header_extension = xstrdup (ext);
- tr (src_extension, 'y', 'c');
- tr (src_extension, 'Y', 'C');
- tr (header_extension, 'y', 'h');
- tr (header_extension, 'Y', 'H');
+ if (!strcmp (ext, ".y"))
+ {
+ src_extension = xstrdup (language->src_extension);
+ header_extension = xstrdup (language->header_extension);
+ }
+ else
+ {
+ src_extension = xstrdup (ext);
+ header_extension = xstrdup (ext);
+ tr (src_extension, 'y', 'c');
+ tr (src_extension, 'Y', 'C');
+ tr (header_extension, 'y', 'h');
+ tr (header_extension, 'Y', 'H');
+ }
}
/* Compute extensions from the given c source file extension. */
@@ -281,7 +289,10 @@
xstrndup (base, (strlen (base) - (ext ? strlen (ext) : 0)));
}
- all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+ if (language->add_tab)
+ all_but_ext = concat2 (all_but_tab_ext, TAB_EXT);
+ else
+ all_but_ext = xstrdup (all_but_tab_ext);
/* Compute the extensions from the grammar file name. */
if (ext && !yacc_flag)
Index: src/getargs.c
===================================================================
RCS file: /sources/bison/bison/src/getargs.c,v
retrieving revision 1.86
diff -u -r1.86 getargs.c
--- src/getargs.c 10 Nov 2006 06:11:21 -0000 1.86
+++ src/getargs.c 13 Dec 2006 09:03:07 -0000
@@ -66,11 +66,18 @@
int trace_flag = trace_none;
int warnings_flag = warnings_none;
+static const struct bison_language valid_languages[] = {
+ { "c", "c-skel.m4", ".c", ".h", true },
+ { "c++", "c++-skel.m4", ".cc", ".hh", true },
+ { NULL, NULL, NULL, NULL, false }
+};
+
+static int skeleton_prio = 2;
const char *skeleton = NULL;
+static int language_prio = 2;
+const struct bison_language *language = &valid_languages[0];
const char *include = NULL;
-extern char *program_name;
-
/** Decode an option's set of keys.
*
@@ -323,12 +330,87 @@
}
+/*-------------------------------------.
+| --skeleton and --language handling. |
+`--------------------------------------*/
+
+void
+skeleton_arg (const char *arg, int prio, location *loc)
+{
+ if (skeleton_prio < prio)
+ return;
+ if (skeleton_prio == prio)
+ {
+ const char *msg =
+ _("multiple skeleton declarations are invalid");
+ if (loc)
+ {
+ complain_at (*loc, msg);
+ return;
+ }
+ else
+ {
+ error (0, 0, msg);
+ usage (EXIT_FAILURE);
+ }
+ }
+
+ skeleton_prio = prio;
+ skeleton = arg;
+}
+
+void
+language_argmatch (const char *arg, int prio, location *loc)
+{
+ int i;
+ if (language_prio < prio)
+ return;
+ if (language_prio == prio)
+ {
+ const char *msg =
+ _("multiple language declarations are invalid");
+ if (loc)
+ {
+ complain_at (*loc, msg);
+ return;
+ }
+ else
+ {
+ error (0, 0, msg);
+ usage (EXIT_FAILURE);
+ }
+ }
+
+ for (i = 0; valid_languages[i].language; i++)
+ if (!strcasecmp (arg, valid_languages[i].language))
+ {
+ language_prio = prio;
+ language = &valid_languages[i];
+ break;
+ }
+
+ if (!valid_languages[i].language)
+ {
+ const char *msg = _("invalid language `%s'");
+ if (loc)
+ {
+ complain_at (*loc, msg, arg);
+ return;
+ }
+ else
+ {
+ error (0, 0, msg, arg);
+ usage (EXIT_FAILURE);
+ }
+ }
+}
+
/*----------------------.
| Process the options. |
`----------------------*/
/* Shorts options. */
-static char const short_options[] = "yvegdhr:ltknVo:b:p:S:T::W";
+static char const short_options[] = "yvegdhr:L:ltknVo:b:p:S:T::W";
/* Values for long options that do not have single-letter equivalents. */
enum
@@ -374,6 +456,7 @@
{ "no-parser", no_argument, 0, 'n' },
{ "raw", no_argument, 0, 0 },
{ "skeleton", required_argument, 0, 'S' },
+ { "language", required_argument, 0, 'L' },
{ "token-table", no_argument, 0, 'k' },
{0, 0, 0, 0}
@@ -414,8 +497,12 @@
case 'h':
usage (EXIT_SUCCESS);
+ case 'L':
+ language_argmatch (optarg, 0, NULL);
+ break;
+
case 'S':
- skeleton = AS_FILE_NAME (optarg);
+ skeleton_arg (AS_FILE_NAME (optarg), 0, NULL);
break;
case 'I':
Index: src/getargs.h
===================================================================
RCS file: /sources/bison/bison/src/getargs.h,v
retrieving revision 1.36
diff -u -r1.36 getargs.h
--- src/getargs.h 1 Nov 2006 06:09:40 -0000 1.36
+++ src/getargs.h 13 Dec 2006 09:03:07 -0000
@@ -22,6 +22,10 @@
#ifndef GETARGS_H_
# define GETARGS_H_
+#include "location.h"
+
+extern char *program_name;
+
/* flags set by % directives */
/* for -S */
@@ -65,6 +69,18 @@
extern bool nondeterministic_parser;
+/* --language. */
+struct bison_language
+{
+ const char *language;
+ const char *skeleton;
+ const char *src_extension;
+ const char *header_extension;
+ bool add_tab;
+};
+
+extern const struct bison_language *language;
+
/*-----------.
| --report. |
`-----------*/
@@ -126,4 +142,8 @@
*/
void getargs (int argc, char *argv[]);
+/* Used by parse-gram.y. */
+void language_argmatch (const char *arg, int prio, location *loc);
+void skeleton_arg (const char *arg, int prio, location *loc);
+
#endif /* !GETARGS_H_ */
Index: src/output.c
===================================================================
RCS file: /sources/bison/bison/src/output.c,v
retrieving revision 1.260
diff -u -r1.260 output.c
--- src/output.c 12 Dec 2006 06:47:39 -0000 1.260
+++ src/output.c 13 Dec 2006 09:03:11 -0000
@@ -622,16 +622,13 @@
muscle_insert ("pre_prologue", obstack_finish (&pre_prologue_obstack));
muscle_insert ("post_prologue", obstack_finish (&post_prologue_obstack));
- /* Find the right skeleton file. */
- if (!skeleton)
- {
- if (glr_parser || nondeterministic_parser)
- skeleton = "glr.c";
- else
- skeleton = "yacc.c";
- }
+ /* Find the right skeleton file, and add muscles about the skeletons */
+ if (skeleton)
+ MUSCLE_INSERT_C_STRING ("skeleton", skeleton);
+ else
+ skeleton = language->skeleton;
- /* About the skeletons. */
+ /* About the skeletons. */
{
char const *pkgdatadir = getenv ("BISON_PKGDATADIR");
/* b4_pkgdatadir is used inside m4_include in the skeletons, so digraphs
@@ -639,7 +636,6 @@
his Bison installation path. */
MUSCLE_INSERT_STRING_RAW ("pkgdatadir",
pkgdatadir ? pkgdatadir : PKGDATADIR);
- MUSCLE_INSERT_C_STRING ("skeleton", skeleton);
}
}
Index: src/parse-gram.y
===================================================================
RCS file: /sources/bison/bison/src/parse-gram.y,v
retrieving revision 1.100
diff -u -r1.100 parse-gram.y
--- src/parse-gram.y 2 Dec 2006 01:52:16 -0000 1.100
+++ src/parse-gram.y 13 Dec 2006 09:03:32 -0000
@@ -143,6 +143,7 @@
PERCENT_FILE_PREFIX "%file-prefix"
PERCENT_GLR_PARSER "%glr-parser"
PERCENT_INITIAL_ACTION "%initial-action"
+ PERCENT_LANGUAGE "%language"
PERCENT_LEX_PARAM "%lex-param"
PERCENT_LOCATIONS "%locations"
PERCENT_NAME_PREFIX "%name-prefix"
@@ -245,6 +246,7 @@
{
muscle_code_grow ("initial_action", translate_symbol_action ($2, @2),
@2);
}
+| "%language" STRING { language_argmatch ($2, 1, &@1); }
| "%lex-param" "{...}" { add_param ("lex_param", $2, @2); }
| "%locations" { locations_flag = true; }
| "%name-prefix" STRING { spec_name_prefix = $2; }
@@ -257,7 +259,7 @@
| "%pure-parser" { pure_parser = true; }
| "%push-parser" { push_parser = true; }
| "%require" STRING { version_check (&@2, $2); }
-| "%skeleton" STRING { skeleton = $2; }
+| "%skeleton" STRING { skeleton_arg ($2, 1, &@1); }
| "%token-table" { token_table_flag = true; }
| "%verbose" { report_flag = report_states; }
| "%yacc" { yacc_flag = true; }
Index: src/scan-gram.l
===================================================================
RCS file: /sources/bison/bison/src/scan-gram.l,v
retrieving revision 1.111
diff -u -r1.111 scan-gram.l
--- src/scan-gram.l 21 Nov 2006 00:43:26 -0000 1.111
+++ src/scan-gram.l 13 Dec 2006 09:03:36 -0000
@@ -172,6 +172,7 @@
"%fixed"[-_]"output"[-_]"files" return PERCENT_YACC;
"%initial-action" return PERCENT_INITIAL_ACTION;
"%glr-parser" return PERCENT_GLR_PARSER;
+ "%language" return PERCENT_LANGUAGE;
"%left" return PERCENT_LEFT;
"%lex-param" return PERCENT_LEX_PARAM;
"%locations" return PERCENT_LOCATIONS;
Index: tests/calc.at
===================================================================
RCS file: /sources/bison/bison/tests/calc.at,v
retrieving revision 1.96
diff -u -r1.96 calc.at
--- tests/calc.at 8 Dec 2006 22:36:33 -0000 1.96
+++ tests/calc.at 13 Dec 2006 09:03:42 -0000
@@ -628,12 +628,15 @@
AT_BANNER([[Simple LALR(1) C++ Calculator.]])
+# First let's try using %skeleton
+AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations])
+
# AT_CHECK_CALC_LALR1_CC([BISON-OPTIONS])
# ---------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_LALR1_CC],
-[AT_CHECK_CALC([%skeleton "lalr1.cc" %defines %locations] $@)])
+[AT_CHECK_CALC([%language "C++" %defines %locations] $@)])
AT_CHECK_CALC_LALR1_CC([])
AT_CHECK_CALC_LALR1_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
@@ -652,12 +655,15 @@
AT_BANNER([[Simple GLR C++ Calculator.]])
+# Again, we try also using %skeleton.
+AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations])
+
# AT_CHECK_CALC_GLR_CC([BISON-OPTIONS])
# -------------------------------------
# Start a testing chunk which compiles `calc' grammar with
# the GLR C++ skeleton, and performs several tests over the parser.
m4_define([AT_CHECK_CALC_GLR_CC],
-[AT_CHECK_CALC([%skeleton "glr.cc" %defines %locations] $@)])
+[AT_CHECK_CALC([%language "C++" %glr-parser %defines %locations] $@)])
AT_CHECK_CALC_GLR_CC([])
AT_CHECK_CALC_GLR_CC([%error-verbose %name-prefix "calc" %verbose %yacc])
Index: tests/local.at
===================================================================
RCS file: /sources/bison/bison/tests/local.at,v
retrieving revision 1.19
diff -u -r1.19 local.at
--- tests/local.at 7 Dec 2006 02:21:13 -0000 1.19
+++ tests/local.at 13 Dec 2006 09:03:42 -0000
@@ -41,17 +41,17 @@
m4_define([_AT_BISON_OPTION_PUSHDEFS],
[m4_if([$1$2], $[1]$[2], [],
[m4_fatal([$0: Invalid arguments: address@hidden)])dnl
-m4_pushdef([AT_LALR1_CC_IF],
-[m4_bmatch([$3], ["lalr1.cc"], [$1], [$2])])
-m4_pushdef([AT_GLR_CC_IF],
-[m4_bmatch([$3], ["glr.cc"], [$1], [$2])])
m4_pushdef([AT_SKEL_CC_IF],
-[m4_bmatch([$3], ["\(glr\|lalr1\).cc"], [$1], [$2])])
+[m4_bmatch([$3], [%language "[Cc]\+\+"\|%skeleton "[a-z0-9]+\.cc"], [$1],
[$2])])
m4_pushdef([AT_GLR_IF],
-[m4_bmatch([$3], [%glr-parser], [$1], [$2])])
+[m4_bmatch([$3], [%glr-parser\|%skeleton "glr\.], [$1], [$2])])
+m4_pushdef([AT_LALR1_CC_IF],
+[AT_SKEL_CC_IF([AT_GLR_IF([$2], [$1])], [$2])])
+m4_pushdef([AT_GLR_CC_IF],
+[AT_SKEL_CC_IF([AT_GLR_IF([$1], [$2])], [$2])])
# Using yacc.c?
m4_pushdef([AT_YACC_IF],
-[m4_bmatch([$3], [%glr-parser\|%skeleton], [$2], [$1])])
+[m4_bmatch([$3], [%language\|%glr-parser\|%skeleton], [$2], [$1])])
m4_pushdef([AT_PARAM_IF],
[m4_bmatch([$3], [%parse-param], [$1], [$2])])
m4_pushdef([AT_LOCATION_IF],
- Re: [updated PATCH] %language declaration, (continued)
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/08
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/08
- Re: [updated PATCH] %language declaration, Paolo Bonzini, 2006/12/11
- Re: [SPAM] Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/12
- Re: [SPAM] Re: [updated PATCH] %language declaration, Paul Eggert, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration, Paolo Bonzini, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration, Paul Eggert, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration, Paolo Bonzini, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/13
- Re: [SPAM] Re: [updated PATCH] %language declaration,
Paolo Bonzini <=
- Re: [SPAM] Re: [SPAM] Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/13
- Re: [updated PATCH] %language declaration, Paolo Bonzini, 2006/12/14
- Re: [updated PATCH] %language declaration, Paul Eggert, 2006/12/14
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/14
- Re: [updated PATCH] %language declaration, Paul Eggert, 2006/12/14
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/14
- Re: [updated PATCH] %language declaration, Paul Eggert, 2006/12/15
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/15
- Re: [updated PATCH] %language declaration, Paolo Bonzini, 2006/12/15
- Re: [updated PATCH] %language declaration, Joel E. Denny, 2006/12/15