]> git.saurik.com Git - bison.git/commitdiff
muscle: check more cases of %define variables with code values
authorAkim Demaille <akim@lrde.epita.fr>
Thu, 18 Apr 2013 14:52:55 +0000 (16:52 +0200)
committerAkim Demaille <akim@lrde.epita.fr>
Thu, 18 Apr 2013 15:19:30 +0000 (17:19 +0200)
* data/bison.m4 (b4_percent_define_check_kind): Fix overquotation.
(api.location.type, api.position.type): Check they have code values here.
* data/c++.m4 (api.location.type): No longer checked here.
(parser_class_name): Check it here.
* data/java.m4 (api.value.type, init_throws, lex_throws, parser_class_name)
(throws, annotations, extends, implements): Check they have code values.
* doc/bison.texi: Fix every incorrect occurrence of %define.
Document the additional syntax for %define: code values.
Document the additional syntax for -D/-F: string and code values.
* tests/calc.at, tests/headers.at, tests/input.at, tests/java.at,
* tests/local.at: Fix dependencies.

data/bison.m4
data/c++.m4
data/java.m4
doc/bison.texi
tests/calc.at
tests/headers.at
tests/input.at
tests/java.at
tests/local.at

index 64f1bacc51363b8122601da5258a90b6730ceca8..ca27159c878f4b151840043620a8d42a027973be 100644 (file)
@@ -853,7 +853,7 @@ b4_percent_define_if_define_([$1], [$2], $[1], $[2])])
 # ---------------------------------------------------------------------
 m4_define([b4_percent_define_check_kind],
 [b4_percent_define_ifdef_([$1],
-  [m4_if(b4_percent_define_get_kind([[$1]]), [$2], [],
+  [m4_if(b4_percent_define_get_kind([$1]), [$2], [],
     [b4_error([m4_default([$3], [complain])],
               b4_percent_define_get_loc([$1]),
               [m4_case([$2],
@@ -1026,6 +1026,12 @@ m4_define_default([b4_location_initial_line],   [1])
 ## Sanity checks.  ##
 ## --------------- ##
 
+# api.location.prefix={...} (Java and C++).
+b4_percent_define_check_kind([api.location.type], [code], [deprecated])
+
+# api.position.prefix={...} (Java).
+b4_percent_define_check_kind([api.position.type], [code], [deprecated])
+
 # api.prefix >< %name-prefix.
 b4_percent_define_check_kind([api.prefix], [code], [deprecated])
 b4_percent_define_ifdef([api.prefix],
index 7a743806717eadb634042a987da75389d1360137..be12c0a2feb75814f2917c87f1012f0724349d42 100644 (file)
@@ -29,8 +29,8 @@ m4_define([b4_comment],
 ## Checks.  ##
 ## -------- ##
 
-b4_percent_define_check_kind([api.location.type], [code], [deprecated])
 b4_percent_define_check_kind([api.namespace], [code], [deprecated])
+b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
 
 ## ---------------- ##
 ## Default values.  ##
index cff774d886f9777fba72c8213e2f429ecbc7673e..f985f977f191051f8ca8211569feacdddd72b85e 100644 (file)
@@ -169,6 +169,22 @@ m4_define([b4_predicate_case], [  case $1:
     ])
 
 
+## -------- ##
+## Checks.  ##
+## -------- ##
+
+b4_percent_define_check_kind([[api.value.type]],    [code], [deprecated])
+
+b4_percent_define_check_kind([[annotations]],       [code], [deprecated])
+b4_percent_define_check_kind([[extends]],           [code], [deprecated])
+b4_percent_define_check_kind([[implements]],        [code], [deprecated])
+b4_percent_define_check_kind([[init_throws]],       [code], [deprecated])
+b4_percent_define_check_kind([[lex_throws]],        [code], [deprecated])
+b4_percent_define_check_kind([[parser_class_name]], [code], [deprecated])
+b4_percent_define_check_kind([[throws]],            [code], [deprecated])
+
+
+
 ## ---------------- ##
 ## Default values.  ##
 ## ---------------- ##
index bd03ee1cf791b0736e2e234ddaf9666484ac8c71..4a4bd600db94641b75d85ac3ef30cdf1d520807a 100644 (file)
@@ -5930,7 +5930,8 @@ introduced in Bison 3.0
 
 
 @c ================================================== api.value.type
-@deffn Directive {%define api.value.type} @var{type}
+@deffn Directive {%define api.value.type} @var{support}
+@deffnx Directive {%define api.value.type} @{@var{type}@}
 @itemize @bullet
 @item Language(s):
 all
@@ -5940,16 +5941,16 @@ The type for semantic values.
 
 @item Accepted Values:
 @table @asis
-@item @code{""}
+@item @samp{@{@}}
 This grammar has no semantic value at all.  This is not properly supported
 yet.
-@item @code{%union} (C, C++)
+@item @samp{union-directive} (C, C++)
 The type is defined thanks to the @code{%union} directive.  You don't have
 to define @code{api.value.type} in that case, using @code{%union} suffices.
 @xref{Union Decl, ,The Union Declaration}.
 For instance:
 @example
-%define api.value.type "%union"
+%define api.value.type union-directive
 %union
 @{
   int ival;
@@ -5959,30 +5960,30 @@ For instance:
 %token <sval> STR "string"
 @end example
 
-@item @code{union} (C, C++)
+@item @samp{union} (C, C++)
 The symbols are defined with type names, from which Bison will generate a
 @code{union}.  For instance:
 @example
-%define api.value.type "union"
+%define api.value.type union
 %token <int> INT "integer"
 %token <char *> STR "string"
 @end example
 This feature needs user feedback to stabilize.  Note that most C++ objects
 cannot be stored in a @code{union}.
 
-@item @code{variant} (C++)
+@item @samp{variant} (C++)
 This is similar to @code{union}, but special storage techniques are used to
 allow any kind of C++ object to be used. For instance:
 @example
-%define api.value.type "variant"
+%define api.value.type variant
 %token <int> INT "integer"
 %token <std::string> STR "string"
 @end example
 This feature needs user feedback to stabilize.
 @xref{C++ Variants}.
 
-@item any other identifier
-Use this name as semantic value.
+@item @samp{@{@var{type}@}}
+Use this @var{type} as semantic value.
 @example
 %code requires
 @{
@@ -5999,7 +6000,7 @@ Use this name as semantic value.
     @} u;
   @};
 @}
-%define api.value.type "struct my_value"
+%define api.value.type @{struct my_value@}
 %token <u.ival> INT "integer"
 %token <u.sval> STR "string"
 @end example
@@ -6115,7 +6116,7 @@ destroyed properly.  This option checks these constraints.
 
 
 @c ================================================== parse.error
-@deffn Directive {%define parse.error}
+@deffn Directive {%define parse.error} @var{verbosity}
 @itemize
 @item Languages(s):
 all
@@ -6142,7 +6143,7 @@ However, this report can often be incorrect when LAC is not enabled
 
 
 @c ================================================== parse.lac
-@deffn Directive {%define parse.lac}
+@deffn Directive {%define parse.lac} @var{when}
 
 @itemize
 @item Languages(s): C (deterministic parsers only)
@@ -6165,7 +6166,7 @@ syntax error handling.  @xref{LAC}.
 @xref{Tracing, ,Tracing Your Parser}.
 
 In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
-@samp{%define api.prefix @var{prefix}}), see @ref{Multiple Parsers,
+@samp{%define api.prefix @{@var{prefix}@}}), see @ref{Multiple Parsers,
 ,Multiple Parsers in the Same Program}) to 1 in the parser implementation
 file if it is not already defined, so that the debugging facilities are
 compiled.
@@ -6308,7 +6309,7 @@ The easy way to do this is to define the @code{%define} variable
 @code{api.prefix}.  With different @code{api.prefix}s it is guaranteed that
 headers do not conflict when included together, and that compiled objects
 can be linked together too.  Specifying @samp{%define api.prefix
-@var{prefix}} (or passing the option @samp{-Dapi.prefix=@var{prefix}}, see
+@{@var{prefix}@}} (or passing the option @samp{-Dapi.prefix=@{@var{prefix}@}}, see
 @ref{Invocation, ,Invoking Bison}) renames the interface functions and
 variables of the Bison parser to start with @var{prefix} instead of
 @samp{yy}, and all the macros to start by @var{PREFIX} (i.e., @var{prefix}
@@ -6322,7 +6323,7 @@ The renamed symbols include @code{yyparse}, @code{yylex}, @code{yyerror},
 @code{YYSTYPE}, @code{YYLTYPE}, and @code{YYDEBUG}, which is treated
 specifically --- more about this below.
 
-For example, if you use @samp{%define api.prefix c}, the names become
+For example, if you use @samp{%define api.prefix @{c@}}, the names become
 @code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
 on.
 
@@ -9555,7 +9556,7 @@ enabled if and only if @code{YYDEBUG} is nonzero.
 @item the option @option{-t} (POSIX Yacc compliant)
 @itemx the option @option{--debug} (Bison extension)
 Use the @samp{-t} option when you run Bison (@pxref{Invocation, ,Invoking
-Bison}).  With @samp{%define api.prefix c}, it defines @code{CDEBUG} to 1,
+Bison}).  With @samp{%define api.prefix @{c@}}, it defines @code{CDEBUG} to 1,
 otherwise it defines @code{YYDEBUG} to 1.
 
 @item the directive @samp{%debug}
@@ -10681,7 +10682,7 @@ Instead of using the built-in types you may use the @code{%define} variable
 @code{api.location.type} to specify your own type:
 
 @example
-%define api.location.type @var{LocationType}
+%define api.location.type @{@var{LocationType}@}
 @end example
 
 The requirements over your @var{LocationType} are:
@@ -10718,7 +10719,7 @@ parser @file{master/parser.yy} might use:
 @example
 %defines
 %locations
-%define namespace "master::"
+%define api.namespace @{master::@}
 @end example
 
 @noindent
@@ -10726,7 +10727,7 @@ to generate the @file{master/position.hh} and @file{master/location.hh}
 files, reused by other parsers as follows:
 
 @example
-%define api.location.type "master::location"
+%define api.location.type @{master::location@}
 %code requires @{ #include <master/location.hh> @}
 @end example
 
@@ -10741,7 +10742,7 @@ files, reused by other parsers as follows:
 The output files @file{@var{output}.hh} and @file{@var{output}.cc}
 declare and define the parser class in the namespace @code{yy}.  The
 class name defaults to @code{parser}, but may be changed using
-@samp{%define parser_class_name "@var{name}"}.  The interface of
+@samp{%define parser_class_name @{@var{name}@}}.  The interface of
 this class is detailed below.  It can be extended using the
 @code{%parse-param} feature: its semantics is slightly changed since
 it describes an additional member of the parser class, and an
@@ -11146,7 +11147,7 @@ the grammar for.
 %skeleton "lalr1.cc" /* -*- C++ -*- */
 %require "@value{VERSION}"
 %defines
-%define parser_class_name "calcxx_parser"
+%define parser_class_name @{calcxx_parser@}
 @end example
 
 @noindent
@@ -11580,7 +11581,7 @@ superclass of all the semantic values using the @samp{%define api.value.type}
 directive.  For example, after the following declaration:
 
 @example
-%define api.value.type "ASTNode"
+%define api.value.type @{ASTNode@}
 @end example
 
 @noindent
@@ -11615,11 +11616,11 @@ class defines a @dfn{position}, a single point in a file; Bison itself
 defines a class representing a @dfn{location}, a range composed of a pair of
 positions (possibly spanning several files).  The location class is an inner
 class of the parser; the name is @code{Location} by default, and may also be
-renamed using @code{%define api.location.type "@var{class-name}"}.
+renamed using @code{%define api.location.type @{@var{class-name}@}}.
 
 The location class treats the position as a completely opaque value.
 By default, the class name is @code{Position}, but this can be changed
-with @code{%define api.position.type "@var{class-name}"}.  This class must
+with @code{%define api.position.type @{@var{class-name}@}}.  This class must
 be supplied by the user.
 
 
@@ -11654,7 +11655,7 @@ properly, the position class should override the @code{equals} and
 The name of the generated parser class defaults to @code{YYParser}.  The
 @code{YY} prefix may be changed using the @code{%name-prefix} directive
 or the @option{-p}/@option{--name-prefix} option.  Alternatively, use
-@samp{%define parser_class_name "@var{name}"} to give a custom name to
+@samp{%define parser_class_name @{@var{name}@}} to give a custom name to
 the class.  The interface of this class is detailed below.
 
 By default, the parser class has package visibility.  A declaration
@@ -11663,7 +11664,7 @@ according to the Java language specification, the name of the @file{.java}
 file should match the name of the class in this case.  Similarly, you can
 use @code{abstract}, @code{final} and @code{strictfp} with the
 @code{%define} declaration to add other modifiers to the parser class.
-A single @samp{%define annotations "@var{annotations}"} directive can
+A single @samp{%define annotations @{@var{annotations}@}} directive can
 be used to add any number of annotations to the parser class.
 
 The Java package name of the parser class can be specified using the
@@ -11781,7 +11782,7 @@ In both cases, the scanner has to implement the following methods.
 @deftypemethod {Lexer} {void} yyerror (Location @var{loc}, String @var{msg})
 This method is defined by the user to emit an error message.  The first
 parameter is omitted if location tracking is not active.  Its type can be
-changed using @code{%define api.location.type "@var{class-name}".}
+changed using @code{%define api.location.type @{@var{class-name}@}}.
 @end deftypemethod
 
 @deftypemethod {Lexer} {int} yylex ()
@@ -11800,14 +11801,14 @@ Return respectively the first position of the last token that
 methods are not needed unless location tracking is active.
 
 The return type can be changed using @code{%define api.position.type
-"@var{class-name}".}
+@{@var{class-name}@}}.
 @end deftypemethod
 
 @deftypemethod {Lexer} {Object} getLVal ()
 Return the semantic value of the last token that yylex returned.
 
 The return type can be changed using @samp{%define api.value.type
-"@var{class-name}".}
+@{@var{class-name}@}}.
 @end deftypemethod
 
 
@@ -12028,12 +12029,12 @@ Whether the parser class is declared @code{abstract}.  Default is false.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define annotations} "@var{annotations}"
+@deffn {Directive} {%define annotations} @{@var{annotations}@}
 The Java annotations for the parser class.  Default is none.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define extends} "@var{superclass}"
+@deffn {Directive} {%define extends} @{@var{superclass}@}
 The superclass of the parser class.  Default is none.
 @xref{Java Bison Interface}.
 @end deffn
@@ -12043,25 +12044,25 @@ Whether the parser class is declared @code{final}.  Default is false.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define implements} "@var{interfaces}"
+@deffn {Directive} {%define implements} @{@var{interfaces}@}
 The implemented interfaces of the parser class, a comma-separated list.
 Default is none.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define init_throws} "@var{exceptions}"
+@deffn {Directive} {%define init_throws} @{@var{exceptions}@}
 The exceptions thrown by @code{%code init} from the parser class
 constructor.  Default is none.
 @xref{Java Parser Interface}.
 @end deffn
 
-@deffn {Directive} {%define lex_throws} "@var{exceptions}"
+@deffn {Directive} {%define lex_throws} @{@var{exceptions}@}
 The exceptions thrown by the @code{yylex} method of the lexer, a
 comma-separated list.  Default is @code{java.io.IOException}.
 @xref{Java Scanner Interface}.
 @end deffn
 
-@deffn {Directive} {%define api.location.type} "@var{class}"
+@deffn {Directive} {%define api.location.type} @{@var{class}@}
 The name of the class used for locations (a range between two
 positions).  This class is generated as an inner class of the parser
 class by @command{bison}.  Default is @code{Location}.
@@ -12069,18 +12070,18 @@ Formerly named @code{location_type}.
 @xref{Java Location Values}.
 @end deffn
 
-@deffn {Directive} {%define package} "@var{package}"
+@deffn {Directive} {%define package} @{@var{package}@}
 The package to put the parser class in.  Default is none.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define parser_class_name} "@var{name}"
+@deffn {Directive} {%define parser_class_name} @{@var{name}@}
 The name of the parser class.  Default is @code{YYParser} or
 @code{@var{name-prefix}Parser}.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define api.position.type} "@var{class}"
+@deffn {Directive} {%define api.position.type} @{@var{class}@}
 The name of the class used for positions. This class must be supplied by
 the user.  Default is @code{Position}.
 Formerly named @code{position_type}.
@@ -12092,7 +12093,7 @@ Whether the parser class is declared @code{public}.  Default is false.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define api.value.type} "@var{class}"
+@deffn {Directive} {%define api.value.type} @{@var{class}@}
 The base type of semantic values.  Default is @code{Object}.
 @xref{Java Semantic Values}.
 @end deffn
@@ -12102,7 +12103,7 @@ Whether the parser class is declared @code{strictfp}.  Default is false.
 @xref{Java Bison Interface}.
 @end deffn
 
-@deffn {Directive} {%define throws} "@var{exceptions}"
+@deffn {Directive} {%define throws} @{@var{exceptions}@}
 The exceptions thrown by user-supplied parser actions and
 @code{%initial-action}, a comma-separated list.  Default is none.
 @xref{Java Parser Interface}.
@@ -12656,6 +12657,7 @@ Precedence}.
 
 @deffn {Directive} %define @var{variable}
 @deffnx {Directive} %define @var{variable} @var{value}
+@deffnx {Directive} %define @var{variable} @{@var{value}@}
 @deffnx {Directive} %define @var{variable} "@var{value}"
 Define a variable to adjust Bison's behavior.  @xref{%define Summary}.
 @end deffn
index 3207e69f7885dc3c9bce6d9eada700104c5e1263..b739a7f324dcb94d6d86d84121c0af83b450a457 100644 (file)
@@ -607,17 +607,17 @@ AT_CHECK_CALC_LALR([%define api.pure full %locations])
 AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %locations])
 AT_CHECK_CALC_LALR([%define parse.error verbose %locations])
 
-AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %define api.prefix {calc} %verbose %yacc])
 AT_CHECK_CALC_LALR([%define parse.error verbose %locations %defines %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
 
 AT_CHECK_CALC_LALR([%debug])
 AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
 
 AT_CHECK_CALC_LALR([%define api.pure full %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR([%define api.push-pull both %define api.pure full %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc])
 
-AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
 
 # ----------------------- #
@@ -639,7 +639,7 @@ AT_CHECK_CALC_GLR()
 AT_CHECK_CALC_GLR([%defines])
 AT_CHECK_CALC_GLR([%locations])
 AT_CHECK_CALC_GLR([%name-prefix "calc"])
-AT_CHECK_CALC_GLR([%define api.prefix "calc"])
+AT_CHECK_CALC_GLR([%define api.prefix {calc}])
 AT_CHECK_CALC_GLR([%verbose])
 AT_CHECK_CALC_GLR([%yacc])
 AT_CHECK_CALC_GLR([%define parse.error verbose])
@@ -651,12 +651,12 @@ AT_CHECK_CALC_GLR([%define parse.error verbose %locations %defines %name-prefix
 
 AT_CHECK_CALC_GLR([%debug])
 AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
+AT_CHECK_CALC_GLR([%define parse.error verbose %debug %locations %defines %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose %yacc])
 
 AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc])
 
 AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
-AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_GLR([%define api.pure %define parse.error verbose %debug %locations %defines %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
 
 # ----------------------------- #
@@ -680,16 +680,16 @@ AT_CHECK_CALC_LALR1_CC([%locations])
 AT_CHECK_CALC_LALR1_CC([%locations %define api.location.type {Span}])
 AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %name-prefix "calc" %verbose %yacc])
 
-AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %define api.prefix {calc} %verbose %yacc])
 AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc])
 
-AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
+AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc])
+AT_CHECK_CALC_LALR1_CC([%locations %define parse.error verbose %debug %define api.prefix {calc} %define api.token.prefix {TOK_} %verbose %yacc])
 
 AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
-AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
-AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR1_CC([%define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_LALR1_CC([%defines %locations %define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
 
 
 
@@ -713,7 +713,7 @@ AT_CHECK_CALC_GLR_CC([])
 AT_CHECK_CALC_GLR_CC([%locations])
 AT_CHECK_CALC_GLR_CC([%locations %define api.location.type {Span}])
 AT_CHECK_CALC_GLR_CC([%defines %define parse.error verbose %name-prefix "calc" %verbose %yacc])
-AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix "calc" %verbose %yacc])
+AT_CHECK_CALC_GLR_CC([%define parse.error verbose %define api.prefix {calc} %verbose %yacc])
 
 AT_CHECK_CALC_GLR_CC([%debug])
 
@@ -721,4 +721,4 @@ AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %ve
 AT_CHECK_CALC_GLR_CC([%define parse.error verbose %debug %name-prefix "calc" %define api.token.prefix {TOK_} %verbose %yacc])
 
 AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %name-prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
-AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %define api.prefix "calc" %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
+AT_CHECK_CALC_GLR_CC([%locations %defines %define parse.error verbose %debug %define api.prefix {calc} %verbose %yacc %parse-param {semantic_value *result} %parse-param {int *count}])
index 11b8c917035c14549da451c507c3dc31e1b4e0c0..0ad7ef3eeeaa33168d727583d05465ea0f45a5a0 100644 (file)
@@ -117,9 +117,9 @@ AT_SETUP([Several parsers])
 # nor yy* identifiers in the header.  Check that headers are
 # self-contained, and can be compiled by a C++ compiler.
 m4_pushdef([AT_TEST],
-[AT_BISON_OPTION_PUSHDEFS([%define api.prefix "$1_" $2])
+[AT_BISON_OPTION_PUSHDEFS([%define api.prefix {$1_} $2])
 AT_DATA_GRAMMAR([$1.y],
-[[%define api.prefix "$1_"
+[[%define api.prefix {$1_}
 $2
 %error-verbose
 %union
index 7d4f0735409bcc89b2dcdc6ecbde0ee2ea65d027..86a38d03af73316f8b4a37885ceb34573aee1d6e 100644 (file)
@@ -1422,8 +1422,8 @@ AT_SETUP([["%define" Boolean variables]])
 
 AT_DATA([Input.y],
 [[%language "Java"
-%define public "maybe"
-%define parser_class_name "Input"
+%define public maybe
+%define parser_class_name {Input}
 %%
 start: %empty;
 ]])
@@ -1453,9 +1453,9 @@ start: TOK;
 ]])
 
 AT_BISON_CHECK([[input.yy]], [0], [],
-[[input.yy:4.9-18: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated]
+[[input.yy:2.9-25: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated]
+input.yy:4.9-18: warning: %define variable 'api.prefix' requires '{...}' values [-Wdeprecated]
 input.yy:5.9-24: warning: %define variable 'api.token.prefix' requires '{...}' values [-Wdeprecated]
-input.yy:2.9-25: warning: %define variable 'api.location.type' requires '{...}' values [-Wdeprecated]
 input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
 ]])
 ])
@@ -1857,10 +1857,10 @@ AT_BISON_CHECK([[$2 input.y]], [[1]], [[]],
 ]])
 ])
 
-AT_TEST([%define api.prefix foo %name-prefix "bar"], [], [input.y:1.9-18])
-AT_TEST([], [-Dapi.prefix=foo -p bar], [<command line>:2])
-AT_TEST([%name-prefix "bar"], [-Dapi.prefix=foo], [<command line>:2])
-AT_TEST([%define api.prefix foo], [-p bar], [input.y:1.9-18])
+AT_TEST([%define api.prefix {foo} %name-prefix "bar"], [], [input.y:1.9-18])
+AT_TEST([], [-Dapi.prefix={foo} -p bar], [<command line>:2])
+AT_TEST([%name-prefix "bar"], [-Dapi.prefix={foo}], [<command line>:2])
+AT_TEST([%define api.prefix {foo}], [-p bar], [input.y:1.9-18])
 
 m4_popdef([AT_TEST])
 
index 3f729260fb20e22ddaf082aed34012ee123de685..968b47f317f0fbf6d1119c2094f38e5bf516e91c 100644 (file)
@@ -37,7 +37,7 @@ AT_DATA([Calc.y],
 [[/* Infix notation calculator--calc */
 %language "Java"
 %name-prefix "Calc"
-%define parser_class_name "Calc"
+%define parser_class_name {Calc}
 %define public
 
 ]$4[
@@ -464,10 +464,10 @@ AT_CHECK_JAVA_GREP([[class PrefixParser]])
 AT_CHECK_JAVA_MINIMAL([[%define api.token.prefix {TOK_}]])
 AT_CHECK_JAVA_GREP([[.*TOK_END.*]])
 
-AT_CHECK_JAVA_MINIMAL([[%define parser_class_name "ParserClassName"]])
+AT_CHECK_JAVA_MINIMAL([[%define parser_class_name {ParserClassName}]])
 AT_CHECK_JAVA_GREP([[class ParserClassName]])
 
-AT_CHECK_JAVA_MINIMAL([[%define package "user_java_package"]])
+AT_CHECK_JAVA_MINIMAL([[%define package {user_java_package}]])
 AT_CHECK_JAVA_GREP([[package user_java_package;]])
 
 AT_CLEANUP
@@ -530,7 +530,7 @@ AT_CHECK_JAVA_GREP([[public final strictfp class YYParser]])
 
 # FIXME: Can't do a Java compile because javacomp.sh is configured for 1.3
 AT_CHECK_JAVA_MINIMAL([[
-%define annotations "/*@Deprecated @SupressWarnings(\"unchecked\") @SupressWarnings({\"unchecked\", \"deprecation\"}) @SupressWarnings(value={\"unchecked\", \"deprecation\"})*/"
+%define annotations {/*@Deprecated @SupressWarnings("unchecked") @SupressWarnings({"unchecked", "deprecation"}) @SupressWarnings(value={"unchecked", "deprecation"})*/}
 %define public]])
 AT_CHECK_JAVA_GREP([[/\*@Deprecated @SupressWarnings("unchecked") @SupressWarnings({"unchecked", "deprecation"}) @SupressWarnings(value={"unchecked", "deprecation"})\*/ public class YYParser]])
 
@@ -543,15 +543,15 @@ AT_CLEANUP
 
 AT_SETUP([Java parser class extends and implements])
 
-AT_CHECK_JAVA_MINIMAL([[%define extends "Thread"]])
+AT_CHECK_JAVA_MINIMAL([[%define extends {Thread}]])
 AT_CHECK_JAVA_GREP([[class YYParser extends Thread]])
 
-AT_CHECK_JAVA_MINIMAL([[%define implements "Cloneable"]])
+AT_CHECK_JAVA_MINIMAL([[%define implements {Cloneable}]])
 AT_CHECK_JAVA_GREP([[class YYParser implements Cloneable]])
 
 AT_CHECK_JAVA_MINIMAL([[
-%define extends "Thread"
-%define implements "Cloneable"]])
+%define extends {Thread}
+%define implements {Cloneable}]])
 AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]])
 
 AT_CLEANUP
@@ -643,9 +643,9 @@ AT_SETUP([Java throws specifications])
 
 m4_define([AT_JT_lex_throws_define], [m4_case(AT_JT_lex_throws,
         -1, [],
-         0, [[%define lex_throws ""]],
-         1, [[%define lex_throws "InterruptedException"]],
-         2, [[%define lex_throws "InterruptedException, IllegalAccessException"]])])
+         0, [[%define lex_throws {}]],
+         1, [[%define lex_throws {InterruptedException}]],
+         2, [[%define lex_throws {InterruptedException, IllegalAccessException}]])])
 
 m4_define([AT_JT_yylex_throws], [m4_case(AT_JT_lex_throws,
         -1, [[ throws java.io.IOException]],
@@ -662,9 +662,9 @@ m4_define([AT_JT_yylex_action], [m4_case(AT_JT_lex_throws,
 
 m4_define([AT_JT_throws_define], [m4_case(AT_JT_throws,
         -1, [],
-         0, [[%define throws ""]],
-         1, [[%define throws "ClassNotFoundException"]],
-         2, [[%define throws "ClassNotFoundException, InstantiationException"]])])
+         0, [[%define throws {}]],
+         1, [[%define throws {ClassNotFoundException}]],
+         2, [[%define throws {ClassNotFoundException, InstantiationException}]])])
 
 m4_define([AT_JT_yyaction_throws], [m4_case(AT_JT_throws,
         -1, [],
@@ -727,16 +727,16 @@ AT_CLEANUP
 AT_SETUP([Java constructor init and init_throws])
 
 AT_CHECK_JAVA_MINIMAL([[
-%define extends "Thread"
+%define extends {Thread}
 %code init { super("Test Thread"); if (true) throw new InterruptedException(); }
-%define init_throws "InterruptedException"
+%define init_throws {InterruptedException}
 %lex-param {int lex_param}]])
 AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
 
 AT_CHECK_JAVA_MINIMAL_W_LEXER([[
-%define extends "Thread"
+%define extends {Thread}
 %code init { super("Test Thread"); if (true) throw new InterruptedException(); }
-%define init_throws "InterruptedException"]], [], [[return EOF;]])
+%define init_throws {InterruptedException}]], [], [[return EOF;]])
 AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
 
 AT_CLEANUP
@@ -749,20 +749,20 @@ AT_CLEANUP
 AT_SETUP([Java value, position, and location types])
 
 AT_CHECK_JAVA_MINIMAL([[
-%define api.value.type "java.awt.Color"
+%define api.value.type {java.awt.Color}
 %type<java.awt.Color> start;
-%define api.location.type "MyLoc"
-%define api.position.type "MyPos"
+%define api.location.type {MyLoc}
+%define api.position.type {MyPos}
 %code { class MyPos {} }]], [[$$ = $<java.awt.Color>1;]], [[MyPos]])
 AT_CHECK([[grep 'java.awt.Color' YYParser.java]], [0], [ignore])
 AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Position']], [1], [ignore])
 AT_CHECK([[$EGREP -v ' */?\*' YYParser.java | grep 'Location']], [1], [ignore])
 
 AT_CHECK_JAVA_MINIMAL_W_LEXER([[
-%define api.value.type "java.awt.Color"
+%define api.value.type {java.awt.Color}
 %type<java.awt.Color> start;
-%define api.location.type "MyLoc"
-%define api.position.type "MyPos"
+%define api.location.type {MyLoc}
+%define api.position.type {MyPos}
 %code { class MyPos {} }]], [], [[return EOF;]], [],
 [[$$ = $<java.awt.Color>1;]],
 [[java.awt.Color]], [[MyPos]], [[MyLoc]])
index 0428b6e8023ca77889dbc3a62a38ab889656f8a0..e6afd36d1feb015ce241cb085771a690e50c6c07 100644 (file)
@@ -178,13 +178,13 @@ m4_bpatsubst([$3], [%parse-param { *\([^{}]*[^{} ]\) *}],
 
 m4_pushdef([AT_PURE_IF],
 [m4_bmatch([$3], [%define  *api\.pure\|%pure-parser],
-           [m4_bmatch([$3], [%define  *api\.pure *"?false"?], [$2], [$1])],
+           [m4_bmatch([$3], [%define  *api\.pure *false], [$2], [$1])],
            [$2])])
 # AT_NAME_PREFIX: also consider api.namespace.
 m4_pushdef([AT_NAME_PREFIX],
 [m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) .*],
    [m4_bregexp([$3],
-     [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) [\{\"]\([^""]*\)[\"\}]],
+     [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) [\{\"]\([^\"\}]*\)[\"\}]],
      [\3])],
    [yy])])
 m4_pushdef([AT_TOKEN_CTOR_IF],
@@ -193,10 +193,10 @@ m4_pushdef([AT_TOKEN_PREFIX],
 [m4_bmatch([$3], [%define api\.token\.prefix {.*}],
            [m4_bregexp([$3], [%define api\.token\.prefix {\(.*\)}], [\1])])])
 m4_pushdef([AT_VARIANT_IF],
-[m4_bmatch([$3], [%define api\.value\.type "?variant"?], [$1], [$2])])
+[m4_bmatch([$3], [%define api\.value\.type variant], [$1], [$2])])
 m4_pushdef([AT_API_prefix],
-[m4_bmatch([$3], [%define api\.prefix ".*"],
-           [m4_bregexp([$3], [%define api\.prefix "\([^""]*\)"], [\1])],
+[m4_bmatch([$3], [%define api\.prefix {.*}],
+           [m4_bregexp([$3], [%define api\.prefix {\([^\}]*\)}], [\1])],
            [yy])])
 m4_pushdef([AT_API_PREFIX],
 [m4_toupper(AT_API_prefix)])
@@ -207,7 +207,7 @@ m4_pushdef([AT_API_PREFIX],
 m4_pushdef([AT_YYERROR_ARG_LOC_IF],
 [AT_LOCATION_IF([AT_PURE_IF([m4_bmatch([$3],
                                        m4_quote(m4_join([\|],
-                                                        [%define api\.pure "?full"?],
+                                                        [%define api\.pure full],
                                                         [%glr-parser],
                                                         [%parse-param],
                                                         [%skeleton "?glr.c"?])),