* 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.
# ---------------------------------------------------------------------
m4_define([b4_percent_define_check_kind],
[b4_percent_define_ifdef_([$1],
# ---------------------------------------------------------------------
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],
[b4_error([m4_default([$3], [complain])],
b4_percent_define_get_loc([$1]),
[m4_case([$2],
## Sanity checks. ##
## --------------- ##
## 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],
# api.prefix >< %name-prefix.
b4_percent_define_check_kind([api.prefix], [code], [deprecated])
b4_percent_define_ifdef([api.prefix],
## Checks. ##
## -------- ##
## 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([api.namespace], [code], [deprecated])
+b4_percent_define_check_kind([parser_class_name], [code], [deprecated])
## ---------------- ##
## Default values. ##
## ---------------- ##
## Default values. ##
+## -------- ##
+## 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. ##
## ---------------- ##
## ---------------- ##
## Default values. ##
## ---------------- ##
@c ================================================== api.value.type
@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
@itemize @bullet
@item Language(s):
all
@item Accepted Values:
@table @asis
@item Accepted Values:
@table @asis
This grammar has no semantic value at all. This is not properly supported
yet.
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
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
%token <sval> STR "string"
@end example
%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
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}.
%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
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}.
%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
@{
@example
%code requires
@{
-%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
%token <u.ival> INT "integer"
%token <u.sval> STR "string"
@end example
@c ================================================== parse.error
@c ================================================== parse.error
-@deffn Directive {%define parse.error}
+@deffn Directive {%define parse.error} @var{verbosity}
@itemize
@item Languages(s):
all
@itemize
@item Languages(s):
all
@c ================================================== parse.lac
@c ================================================== parse.lac
-@deffn Directive {%define parse.lac}
+@deffn Directive {%define parse.lac} @var{when}
@itemize
@item Languages(s): C (deterministic parsers only)
@itemize
@item Languages(s): C (deterministic parsers only)
@xref{Tracing, ,Tracing Your Parser}.
In C/C++, define the macro @code{YYDEBUG} (or @code{@var{prefix}DEBUG} with
@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.
,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.
@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
@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}
@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}
@code{YYSTYPE}, @code{YYLTYPE}, and @code{YYDEBUG}, which is treated
specifically --- more about this below.
@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.
@code{cparse}, @code{clex}, @dots{}, @code{CSTYPE}, @code{CLTYPE}, and so
on.
@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
@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}
otherwise it defines @code{YYDEBUG} to 1.
@item the directive @samp{%debug}
@code{api.location.type} to specify your own type:
@example
@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:
@end example
The requirements over your @var{LocationType} are:
@example
%defines
%locations
@example
%defines
%locations
-%define namespace "master::"
+%define api.namespace @{master::@}
files, reused by other parsers as follows:
@example
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
%code requires @{ #include <master/location.hh> @}
@end example
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
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
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
%skeleton "lalr1.cc" /* -*- C++ -*- */
%require "@value{VERSION}"
%defines
%skeleton "lalr1.cc" /* -*- C++ -*- */
%require "@value{VERSION}"
%defines
-%define parser_class_name "calcxx_parser"
+%define parser_class_name @{calcxx_parser@}
directive. For example, after the following declaration:
@example
directive. For example, after the following declaration:
@example
-%define api.value.type "ASTNode"
+%define api.value.type @{ASTNode@}
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
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
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
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
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
the class. The interface of this class is detailed below.
By default, the parser class has package visibility. A declaration
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.
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
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
@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
@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 ()
@end deftypemethod
@deftypemethod {Lexer} {int} yylex ()
methods are not needed unless location tracking is active.
The return type can be changed using @code{%define api.position.type
methods are not needed unless location tracking is active.
The return type can be changed using @code{%define api.position.type
@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
@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
@xref{Java Bison Interface}.
@end deffn
@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
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
The superclass of the parser class. Default is none.
@xref{Java Bison Interface}.
@end deffn
@xref{Java Bison Interface}.
@end deffn
@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
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
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
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}.
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}.
@xref{Java Location Values}.
@end deffn
@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
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
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}.
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}.
@xref{Java Bison Interface}.
@end deffn
@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
The base type of semantic values. Default is @code{Object}.
@xref{Java Semantic Values}.
@end deffn
@xref{Java Bison Interface}.
@end deffn
@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}.
The exceptions thrown by user-supplied parser actions and
@code{%initial-action}, a comma-separated list. Default is none.
@xref{Java Parser Interface}.
@deffn {Directive} %define @var{variable}
@deffnx {Directive} %define @var{variable} @var{value}
@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
@deffnx {Directive} %define @var{variable} "@var{value}"
Define a variable to adjust Bison's behavior. @xref{%define Summary}.
@end deffn
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 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 %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.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}])
# ----------------------- #
# ----------------------- #
AT_CHECK_CALC_GLR([%defines])
AT_CHECK_CALC_GLR([%locations])
AT_CHECK_CALC_GLR([%name-prefix "calc"])
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])
AT_CHECK_CALC_GLR([%verbose])
AT_CHECK_CALC_GLR([%yacc])
AT_CHECK_CALC_GLR([%define parse.error verbose])
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([%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 %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}])
# ----------------------------- #
# ----------------------------- #
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 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 %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([%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}])
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([%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])
AT_CHECK_CALC_GLR_CC([%debug])
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([%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}])
# nor yy* identifiers in the header. Check that headers are
# self-contained, and can be compiled by a C++ compiler.
m4_pushdef([AT_TEST],
# 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])
-[[%define api.prefix "$1_"
+[[%define api.prefix {$1_}
AT_DATA([Input.y],
[[%language "Java"
AT_DATA([Input.y],
[[%language "Java"
-%define public "maybe"
-%define parser_class_name "Input"
+%define public maybe
+%define parser_class_name {Input}
]])
AT_BISON_CHECK([[input.yy]], [0], [],
]])
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: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]
]])
])
input.yy:3.9-21: warning: %define variable 'api.namespace' requires '{...}' values [-Wdeprecated]
]])
])
-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])
[[/* Infix notation calculator--calc */
%language "Java"
%name-prefix "Calc"
[[/* Infix notation calculator--calc */
%language "Java"
%name-prefix "Calc"
-%define parser_class_name "Calc"
+%define parser_class_name {Calc}
AT_CHECK_JAVA_MINIMAL([[%define api.token.prefix {TOK_}]])
AT_CHECK_JAVA_GREP([[.*TOK_END.*]])
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_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
AT_CHECK_JAVA_GREP([[package user_java_package;]])
AT_CLEANUP
# FIXME: Can't do a Java compile because javacomp.sh is configured for 1.3
AT_CHECK_JAVA_MINIMAL([[
# 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]])
%define public]])
AT_CHECK_JAVA_GREP([[/\*@Deprecated @SupressWarnings("unchecked") @SupressWarnings({"unchecked", "deprecation"}) @SupressWarnings(value={"unchecked", "deprecation"})\*/ public class YYParser]])
AT_SETUP([Java parser class extends and implements])
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_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([[
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
AT_CHECK_JAVA_GREP([[class YYParser extends Thread implements Cloneable]])
AT_CLEANUP
m4_define([AT_JT_lex_throws_define], [m4_case(AT_JT_lex_throws,
-1, [],
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]],
m4_define([AT_JT_yylex_throws], [m4_case(AT_JT_lex_throws,
-1, [[ throws java.io.IOException]],
m4_define([AT_JT_throws_define], [m4_case(AT_JT_throws,
-1, [],
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, [],
m4_define([AT_JT_yyaction_throws], [m4_case(AT_JT_throws,
-1, [],
AT_SETUP([Java constructor init and init_throws])
AT_CHECK_JAVA_MINIMAL([[
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(); }
%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([[
%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(); }
%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
AT_CHECK([[grep -q 'super("Test Thread"); if (true) throw new InterruptedException();' YYParser.java]])
AT_CLEANUP
AT_SETUP([Java value, position, and location types])
AT_CHECK_JAVA_MINIMAL([[
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;
%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([[
%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;
%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]])
%code { class MyPos {} }]], [], [[return EOF;]], [],
[[$$ = $<java.awt.Color>1;]],
[[java.awt.Color]], [[MyPos]], [[MyLoc]])
m4_pushdef([AT_PURE_IF],
[m4_bmatch([$3], [%define *api\.pure\|%pure-parser],
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],
[$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],
[\3])],
[yy])])
m4_pushdef([AT_TOKEN_CTOR_IF],
[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\.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_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)])
[yy])])
m4_pushdef([AT_API_PREFIX],
[m4_toupper(AT_API_prefix)])
m4_pushdef([AT_YYERROR_ARG_LOC_IF],
[AT_LOCATION_IF([AT_PURE_IF([m4_bmatch([$3],
m4_quote(m4_join([\|],
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"?])),
[%glr-parser],
[%parse-param],
[%skeleton "?glr.c"?])),