[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] master: variables: rename namespace as api.namespace.
From: |
Akim Demaille |
Subject: |
[PATCH] master: variables: rename namespace as api.namespace. |
Date: |
Wed, 24 Jun 2009 16:52:23 +0200 |
Discussed in
http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00033.html
* data/bison.m4 (b4_percent_define_copy_, b4_percent_define_copy):
New.
(b4_percent_define_use): New.
Use it where applicable.
* data/c++.m4: Replace uses of the variable "namespace" by
"api.namespace".
Default the latter to the former.
* doc/bison.texinfo (Decl Summary): Document "namespace" as
obsolete.
Document api.namespace.
Use @samp to document %define uses, keep @code for identifiers.
* NEWS: Likewise.
* tests/c++.at, tests/input.at: Test api.namespace instead of
namespace. (The tests passed with namespace.)
---
ChangeLog | 21 ++++++
NEWS | 5 ++
data/bison.m4 | 42 ++++++++++-
data/c++.m4 | 25 +++++--
doc/bison.texinfo | 207 ++++++++++++++++++++++++++++-------------------------
tests/c++.at | 2 +-
tests/input.at | 4 +-
7 files changed, 196 insertions(+), 110 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e23fe27..d3980f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2009-06-24 Akim Demaille <address@hidden>
+
+ variables: rename namespace as api.namespace.
+ Discussed in
+ http://lists.gnu.org/archive/html/bison-patches/2009-04/msg00033.html
+
+ * data/bison.m4 (b4_percent_define_copy_, b4_percent_define_copy):
+ New.
+ (b4_percent_define_use): New.
+ Use it where applicable.
+ * data/c++.m4: Replace uses of the variable "namespace" by
+ "api.namespace".
+ Default the latter to the former.
+ * doc/bison.texinfo (Decl Summary): Document "namespace" as
+ obsolete.
+ Document api.namespace.
+ Use @samp to document %define uses, keep @code for identifiers.
+ * NEWS: Likewise.
+ * tests/c++.at, tests/input.at: Test api.namespace instead of
+ namespace. (The tests passed with namespace.)
+
2009-06-11 Akim Demaille <address@hidden>
style changes.
diff --git a/NEWS b/NEWS
index 3c99a87..d5e40d5 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,11 @@ Bison News
use these prefixed token names, although the grammar itself still
uses the short names (as in the sample rule given above).
+** Variable api.namespace
+
+ The "namespace" variable is renamed "api.namespace". Backward
+ compatibility is ensured, but upgrading is recommended.
+
* Changes in version 2.5 (????-??-??):
** IELR(1) and Canonical LR(1) Support
diff --git a/data/bison.m4 b/data/bison.m4
index b532ad7..5661057 100644
--- a/data/bison.m4
+++ b/data/bison.m4
@@ -551,6 +551,44 @@ m4_popdef([b4_start])dnl
m4_popdef([b4_end])dnl
])])
+
+
+## --------------------- ##
+## b4_percent_define_*. ##
+## --------------------- ##
+
+
+# b4_percent_define_use(VARIABLE)
+# -------------------------------
+# Declare that VARIABLE was used.
+m4_define([b4_percent_define_use],
+[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
+])
+
+
+# b4_percent_define_copy_(SOURCE, DESTINATION, [|_loc|_syncline])
+# ---------------------------------------------------------------
+# Copy the value/loc/syncline from the variable SOURCE to the DESTINATION.
+# Ignore undefined values. "Use" the SOURCE so that there are no
+# complaints about unused variables.
+m4_define([b4_percent_define_copy_],
+[m4_ifdef([b4_percent_define$3(]$1[)],
+ [m4_define([b4_percent_define$3(]$2[)],
+ m4_defn([b4_percent_define$3(]$1[)]))])dnl
+])
+
+
+# b4_percent_define_copy(SOURCE, DESTINATION)
+# -------------------------------------------
+# Define the variable DESTINATION as a copy of SOURCE.
+m4_define([b4_percent_define_copy],
+[b4_percent_define_use([$1])dnl
+b4_percent_define_copy_([$1], [$2], [])dnl
+b4_percent_define_copy_([$1], [$2], [_loc])dnl
+b4_percent_define_copy_([$1], [$2], [_syncline])dnl
+])
+
+
# b4_percent_define_get(VARIABLE)
# -------------------------------
# Mimic muscle_percent_define_get in ../src/muscle_tab.h exactly. That is, if
@@ -562,7 +600,7 @@ m4_popdef([b4_end])dnl
#
# b4_percent_define_get([[foo]])
m4_define([b4_percent_define_get],
-[m4_define([b4_percent_define_bison_variables(]$1[)])dnl
+[b4_percent_define_use([$1])dnl
m4_ifdef([b4_percent_define(]$1[)], [m4_indir([b4_percent_define(]$1[)])])])
# b4_percent_define_get_loc(VARIABLE)
@@ -613,7 +651,7 @@ m4_define([b4_percent_define_get_syncline],
# b4_percent_define_ifdef([[foo]], [[it's defined]], [[it's undefined]])
m4_define([b4_percent_define_ifdef],
[m4_ifdef([b4_percent_define(]$1[)],
- [m4_define([b4_percent_define_bison_variables(]$1[)])$2],
+ [b4_percent_define_use([$1])$2],
[$3])])
diff --git a/data/c++.m4 b/data/c++.m4
index 7590f08..1bde73e 100644
--- a/data/c++.m4
+++ b/data/c++.m4
@@ -24,22 +24,31 @@ m4_include(b4_pkgdatadir/[c.m4])
## Default values. ##
## ---------------- ##
-# Default parser class name.
b4_percent_define_default([[parser_class_name]], [[parser]])
b4_percent_define_default([[location_type]], [[location]])
b4_percent_define_default([[filename_type]], [[std::string]])
-b4_percent_define_default([[namespace]], m4_defn([b4_prefix]))
+
+# api.namespace defaults to namespace, and then to b4_prefix.
+b4_percent_define_ifdef([api.namespace],
+ [],
+ [b4_percent_define_ifdef([namespace],
+ [b4_percent_define_copy([namespace], [api.namespace])],
+ [b4_percent_define_default([api.namespace],
+ m4_defn([b4_prefix]))])])
+
b4_percent_define_default([[global_tokens_and_yystype]], [[false]])
b4_percent_define_default([[define_location_comparison]],
[m4_if(b4_percent_define_get([[filename_type]]),
[std::string], [[true]], [[false]])])
+
## ----------- ##
## Namespace. ##
## ----------- ##
-m4_define([b4_namespace_ref], [b4_percent_define_get([[namespace]])])
+m4_define([b4_namespace_ref], [b4_percent_define_get([[api.namespace]])])
+
# Don't permit an empty b4_namespace_ref. Any `::parser::foo' appended to it
# would compile as an absolute reference with `parser' in the global namespace.
@@ -49,7 +58,7 @@ m4_define([b4_namespace_ref],
[b4_percent_define_get([[namespace]])])
# include the header, which is always generated. If we ever need to permit
# internal linkage somehow, surely we can find a cleaner approach.
m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1], [],
-[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
[[namespace reference is empty]])])
# Instead of assuming the C++ compiler will do it, Bison should reject any
@@ -60,20 +69,20 @@ m4_if(m4_bregexp(b4_namespace_ref, [^[ ]*$]), [-1],
[],
# Specifically, don't allow empty names as b4_namespace_open would just convert
# those into anonymous namespaces, and that might tempt some users.
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*::]), [-1], [],
-[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
[[namespace reference has consecutive "::"]])])
m4_if(m4_bregexp(b4_namespace_ref, [::[ ]*$]), [-1], [],
-[b4_complain_at(b4_percent_define_get_loc([[namespace]]),
+[b4_complain_at(b4_percent_define_get_loc([[api.namespace]]),
[[namespace reference has a trailing "::"]])])
m4_define([b4_namespace_open],
-[b4_user_code([b4_percent_define_get_syncline([[namespace]])
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
[namespace ]m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref),
[^\(.\)[ ]*::], [\1])),
[::], [ { namespace ])[ {]])])
m4_define([b4_namespace_close],
-[b4_user_code([b4_percent_define_get_syncline([[namespace]])
+[b4_user_code([b4_percent_define_get_syncline([[api.namespace]])
m4_bpatsubst(m4_dquote(m4_bpatsubst(m4_dquote(b4_namespace_ref[ ]),
[^\(.\)[ ]*\(::\)?\([^][:]\|:[^:]\)*],
[\1])),
diff --git a/doc/bison.texinfo b/doc/bison.texinfo
index 3dd4350..f054181 100644
--- a/doc/bison.texinfo
+++ b/doc/bison.texinfo
@@ -4541,7 +4541,7 @@ statically allocated variables for communication with
@code{yylex},
including @code{yylval} and @code{yylloc}.)
Alternatively, you can generate a pure, reentrant parser. The Bison
-declaration @code{%define api.pure} says that you want the parser to be
+declaration @samp{%define api.pure} says that you want the parser to be
reentrant. It looks like this:
@example
@@ -4645,14 +4645,14 @@ for use by the next invocation of the
@code{yypush_parse} function.
Bison also supports both the push parser interface along with the pull parser
interface in the same generated parser. In order to get this functionality,
-you should replace the @code{%define api.push-pull "push"} declaration with the
address@hidden api.push-pull "both"} declaration. Doing this will create all of
+you should replace the @samp{%define api.push-pull "push"} declaration with the
address@hidden api.push-pull "both"} declaration. Doing this will create all of
the symbols mentioned earlier along with the two extra symbols, @code{yyparse}
and @code{yypull_parse}. @code{yyparse} can be used exactly as it normally
would be used. However, the user should note that it is implemented in the
generated parser by calling @code{yypull_parse}.
This makes the @code{yyparse} function that is generated with the
address@hidden api.push-pull "both"} declaration slower than the normal
address@hidden api.push-pull "both"} declaration slower than the normal
@code{yyparse} function. If the user
calls the @code{yypull_parse} function it will parse the rest of the input
stream. It is possible to @code{yypush_parse} tokens to select a subgrammar
@@ -4668,9 +4668,9 @@ yypull_parse (ps); /* Will call the lexer */
yypstate_delete (ps);
@end example
-Adding the @code{%define api.pure} declaration does exactly the same thing to
-the generated parser with @code{%define api.push-pull "both"} as it did for
address@hidden api.push-pull "push"}.
+Adding the @samp{%define api.pure} declaration does exactly the same thing to
+the generated parser with @samp{%define api.push-pull "both"} as it did for
address@hidden api.push-pull "push"}.
@node Decl Summary
@subsection Bison Declaration Summary
@@ -4871,6 +4871,61 @@ target language and/or parser skeleton.
Some of the accepted @var{variable}s are:
@table @code
address@hidden ================================================== namespace
address@hidden api.namespace
address@hidden %define api.namespace
address@hidden
address@hidden Languages(s): C++
+
address@hidden Purpose: Specifies the namespace for the parser class.
+For example, if you specify:
+
address@hidden
+%define api.namespace "foo::bar"
address@hidden smallexample
+
+Bison uses @code{foo::bar} verbatim in references such as:
+
address@hidden
+foo::bar::parser::semantic_type
address@hidden smallexample
+
+However, to open a namespace, Bison removes any leading @code{::} and then
+splits on any remaining occurrences:
+
address@hidden
+namespace foo @{ namespace bar @{
+ class position;
+ class location;
address@hidden @}
address@hidden smallexample
+
address@hidden Accepted Values:
+Any absolute or relative C++ namespace reference without a trailing
address@hidden"::"}. For example, @code{"foo"} or @code{"::foo::bar"}.
+
address@hidden Default Value:
+The value specified by @code{%name-prefix}, which defaults to @code{yy}.
+This usage of @code{%name-prefix} is for backward compatibility and can
+be confusing since @code{%name-prefix} also specifies the textual prefix
+for the lexical analyzer function. Thus, if you specify
address@hidden, it is best to also specify @samp{%define
+api.namespace} so that @code{%name-prefix} @emph{only} affects the
+lexical analyzer function. For example, if you specify:
+
address@hidden
+%define api.namespace "foo"
+%name-prefix "bar::"
address@hidden smallexample
+
+The parser namespace is @code{foo} and @code{yylex} is referenced as
address@hidden::lex}.
address@hidden itemize
address@hidden namespace
+
+
+
address@hidden ================================================== api.pure
@item api.pure
@findex %define api.pure
@@ -4886,6 +4941,9 @@ Some of the accepted @var{variable}s are:
@end itemize
@c api.pure
+
+
address@hidden ================================================== api.push-pull
@item api.push-pull
@findex %define api.push-pull
@@ -5144,57 +5202,11 @@ facilitate the development of a grammar.
@item Default Value: @code{"LALR"}
@end itemize
+
address@hidden ================================================== namespace
@item namespace
@findex %define namespace
-
address@hidden
address@hidden Languages(s): C++
-
address@hidden Purpose: Specifies the namespace for the parser class.
-For example, if you specify:
-
address@hidden
-%define namespace "foo::bar"
address@hidden smallexample
-
-Bison uses @code{foo::bar} verbatim in references such as:
-
address@hidden
-foo::bar::parser::semantic_type
address@hidden smallexample
-
-However, to open a namespace, Bison removes any leading @code{::} and then
-splits on any remaining occurrences:
-
address@hidden
-namespace foo @{ namespace bar @{
- class position;
- class location;
address@hidden @}
address@hidden smallexample
-
address@hidden Accepted Values: Any absolute or relative C++ namespace
reference without
-a trailing @code{"::"}.
-For example, @code{"foo"} or @code{"::foo::bar"}.
-
address@hidden Default Value: The value specified by @code{%name-prefix}, which
defaults
-to @code{yy}.
-This usage of @code{%name-prefix} is for backward compatibility and can be
-confusing since @code{%name-prefix} also specifies the textual prefix for the
-lexical analyzer function.
-Thus, if you specify @code{%name-prefix}, it is best to also specify
address@hidden namespace} so that @code{%name-prefix} @emph{only} affects the
-lexical analyzer function.
-For example, if you specify:
-
address@hidden
-%define namespace "foo"
-%name-prefix "bar::"
address@hidden smallexample
-
-The parser namespace is @code{foo} and @code{yylex} is referenced as
address@hidden::lex}.
address@hidden itemize
+Obsoleted by @code{api.namespace}
@c namespace
@item parse.assert
@@ -5316,7 +5328,7 @@ is @code{yyparse}, @code{yylex}, @code{yyerror},
@code{yynerrs},
@code{yypstate_new} and @code{yypstate_delete} will
also be renamed. For example, if you use @samp{%name-prefix "c_"}, the
names become @code{c_parse}, @code{c_lex}, and so on.
-For C++ parsers, see the @code{%define namespace} documentation in this
+For C++ parsers, see the @samp{%define api.namespace} documentation in this
section.
@xref{Multiple Parsers, ,Multiple Parsers in the Same Program}.
@end deffn
@@ -5343,7 +5355,7 @@ Specify @var{file} for the parser file.
@end deffn
@deffn {Directive} %pure-parser
-Deprecated version of @code{%define api.pure} (@pxref{Decl Summary, ,%define}),
+Deprecated version of @samp{%define api.pure} (@pxref{Decl Summary, ,%define}),
for which Bison is more careful to warn about unreasonable usage.
@end deffn
@@ -5557,8 +5569,8 @@ exp: @dots{} @{ @dots{}; *randomness += 1; @dots{} @}
More user feedback will help to stabilize it.)
You call the function @code{yypush_parse} to parse a single token. This
-function is available if either the @code{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}.
@deftypefun int yypush_parse (yypstate *yyps)
@@ -5575,7 +5587,7 @@ is required to finish parsing the grammar.
More user feedback will help to stabilize it.)
You call the function @code{yypull_parse} to parse the rest of the input
-stream. This function is available if the @code{%define api.push-pull "both"}
+stream. This function is available if the @samp{%define api.push-pull "both"}
declaration is used.
@xref{Push Decl, ,A Push Parser}.
@@ -5591,8 +5603,8 @@ The value returned by @code{yypull_parse} is the same as
for @code{yyparse}.
More user feedback will help to stabilize it.)
You call the function @code{yypstate_new} to create a new parser instance.
-This function is available if either the @code{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+This function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}.
@deftypefun yypstate *yypstate_new (void)
@@ -5610,8 +5622,8 @@ allocated.
More user feedback will help to stabilize it.)
You call the function @code{yypstate_delete} to delete a parser instance.
-function is available if either the @code{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
+function is available if either the @samp{%define api.push-pull "push"} or
address@hidden api.push-pull "both"} declaration is used.
@xref{Push Decl, ,A Push Parser}.
@deftypefun void yypstate_delete (yypstate *yyps)
@@ -5799,7 +5811,7 @@ The data type of @code{yylloc} has the name
@code{YYLTYPE}.
@node Pure Calling
@subsection Calling Conventions for Pure Parsers
-When you use the Bison declaration @code{%define api.pure} to request a
+When you use the Bison declaration @samp{%define api.pure} to request a
pure, reentrant parser, the global communication variables @code{yylval}
and @code{yylloc} cannot be used. (@xref{Pure Decl, ,A Pure (Reentrant)
Parser}.) In such parsers the two global variables are replaced by
@@ -5850,7 +5862,7 @@ int yylex (int *nastiness);
int yyparse (int *nastiness, int *randomness);
@end example
-If @code{%define api.pure} is added:
+If @samp{%define api.pure} is added:
@example
int yylex (YYSTYPE *lvalp, int *nastiness);
@@ -5858,7 +5870,7 @@ int yyparse (int *nastiness, int *randomness);
@end example
@noindent
-and finally, if both @code{%define api.pure} and @code{%locations} are used:
+and finally, if both @samp{%define api.pure} and @code{%locations} are used:
@example
int yylex (YYSTYPE *lvalp, YYLTYPE *llocp, int *nastiness);
@@ -5885,7 +5897,7 @@ receives one argument. For a syntax error, the string is
normally
@address@hidden"syntax error"}}.
@findex %define error-verbose
-If you invoke the directive @code{%define error-verbose} in the Bison
+If you invoke the directive @samp{%define error-verbose} in the Bison
declarations section (@pxref{Bison Declarations, ,The Bison Declarations
Section}), then Bison provides a more verbose and specific error message
string instead of just plain @address@hidden"syntax error"}}.
@@ -5942,7 +5954,7 @@ void yyerror (int *nastiness, char const *msg); /* GLR
parsers. */
Finally, @acronym{GLR} and Yacc parsers share the same @code{yyerror} calling
convention for absolutely pure parsers, i.e., when the calling
convention of @code{yylex} @emph{and} the calling convention of
address@hidden api.pure} are pure.
address@hidden api.pure} are pure.
I.e.:
@example
@@ -8360,8 +8372,9 @@ The C++ deterministic parser is selected using the
skeleton directive,
When run, @command{bison} will create several entities in the @samp{yy}
namespace.
address@hidden %define namespace
-Use the @samp{%define namespace} directive to change the namespace name, see
address@hidden %define api.namespace
+Use the @samp{%define api.namespace} directive to change the namespace
+name, see
@ref{Decl Summary}.
The various classes are generated in the following files:
@@ -8545,7 +8558,7 @@ described by @var{m}.
The parser invokes the scanner by calling @code{yylex}. Contrary to C
parsers, C++ parsers are always pure: there is no point in using the
address@hidden api.pure} directive. Therefore the interface is as follows.
address@hidden api.pure} directive. Therefore the interface is as follows.
@deftypemethod {parser} {int} yylex (semantic_value_type& @var{yylval},
location_type& @var{yylloc}, @var{type1} @var{arg1}, ...)
Return the next token. Its type is the return value, its semantic
@@ -9109,7 +9122,7 @@ You can create documentation for generated parsers using
Javadoc.
Contrary to C parsers, Java parsers do not use global variables; the
state of the parser is always local to an instance of the parser class.
Therefore, all Java parsers are ``pure'', and the @code{%pure-parser}
-and @code{%define api.pure} directives does not do anything when used in
+and @samp{%define api.pure} directives does not do anything when used in
Java.
Push parsers are currently unsupported in Java and @code{%define
@@ -9157,7 +9170,7 @@ semantic values' types (class names) should be specified
in the
By default, the semantic stack is declared to have @code{Object} members,
which means that the class types you specify can be of any class.
To improve the type safety of the parser, you can declare the common
-superclass of all the semantic values using the @code{%define stype}
+superclass of all the semantic values using the @samp{%define stype}
directive. For example, after the following declaration:
@example
@@ -9197,11 +9210,11 @@ 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
address@hidden location_type "@var{class-name}}.
address@hidden 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 position_type "@var{class-name}"}. This class must
+with @samp{%define position_type "@var{class-name}"}. This class must
be supplied by the user.
@@ -9236,22 +9249,22 @@ 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
address@hidden parser_class_name "@var{name}"} to give a custom name to
address@hidden 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
address@hidden public} will change to public visibility. Remember that,
address@hidden public} will change to public visibility. Remember that,
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 @code{%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
address@hidden package} directive. The superclass and the implemented
address@hidden package} directive. The superclass and the implemented
interfaces of the parser class can be specified with the @code{%define
-extends} and @code{%define implements} directives.
+extends} and @samp{%define implements} directives.
The parser class defines an inner class, @code{Location}, that is used
for location tracking (see @ref{Java Location Values}), and a inner
@@ -9272,7 +9285,7 @@ used.
Use @code{%code init} for code added to the start of the constructor
body. This is especially useful to initialize superclasses. Use
address@hidden init_throws} to specify any uncatch exceptions.
address@hidden init_throws} to specify any uncatch exceptions.
@end deftypeop
@deftypeop {Constructor} {YYParser} {} YYParser (Lexer @var{lexer},
@var{parse_param}, @dots{})
@@ -9285,7 +9298,7 @@ created with the correct @code{%lex-param}s.
Use @code{%code init} for code added to the start of the constructor
body. This is especially useful to initialize superclasses. Use
address@hidden init_throws} to specify any uncatch exceptions.
address@hidden init_throws} to specify any uncatch exceptions.
@end deftypeop
@deftypemethod {YYParser} {boolean} parse ()
@@ -9296,7 +9309,7 @@ Run the syntactic analysis, and return @code{true} on
success,
@deftypemethod {YYParser} {boolean} getErrorVerbose ()
@deftypemethodx {YYParser} {void} setErrorVerbose (boolean @var{verbose})
Get or set the option to produce verbose error messages. These are only
-available with the @code{%define error-verbose} directive, which also turn on
+available with the @samp{%define error-verbose} directive, which also turn on
verbose error messages.
@end deftypemethod
@@ -9362,7 +9375,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 location_type "@var{class-name}".}
+changed using @samp{%define location_type "@var{class-name}".}
@end deftypemethod
@deftypemethod {Lexer} {int} yylex ()
@@ -9370,7 +9383,7 @@ Return the next token. Its type is the return value, its
semantic
value and location are saved and returned by the ther methods in the
interface.
-Use @code{%define lex_throws} to specify any uncaught exceptions.
+Use @samp{%define lex_throws} to specify any uncaught exceptions.
Default is @code{java.io.IOException}.
@end deftypemethod
@@ -9380,14 +9393,14 @@ Return respectively the first position of the last
token that
@code{yylex} returned, and the first position beyond it. These
methods are not needed unless location tracking is active.
-The return type can be changed using @code{%define position_type
+The return type can be changed using @samp{%define position_type
"@var{class-name}".}
@end deftypemethod
@deftypemethod {Lexer} {Object} getLVal ()
Return the semantical value of the last token that yylex returned.
-The return type can be changed using @code{%define stype
+The return type can be changed using @samp{%define stype
"@var{class-name}".}
@end deftypemethod
@@ -9398,7 +9411,7 @@ The return type can be changed using @code{%define stype
The following special constructs can be uses in Java actions.
Other analogous C action features are currently unavailable for Java.
-Use @code{%define throws} to specify any uncaught exceptions from parser
+Use @samp{%define throws} to specify any uncaught exceptions from parser
actions, and initial actions specified by @code{%initial-action}.
@defvar address@hidden
@@ -9415,7 +9428,7 @@ Like @address@hidden but specifies a alternative type
@var{typealt}.
@defvar $$
The semantic value for the grouping made by the current rule. As a
value, this is in the base type (@code{Object} or as specified by
address@hidden stype}) as in not cast to the declared subtype because
address@hidden stype}) as in not cast to the declared subtype because
casts are not allowed on the left-hand side of Java assignments.
Use an explicit Java cast if the correct subtype is needed.
@xref{Java Semantic Values}.
@@ -9502,7 +9515,7 @@ corresponds to these C macros.}.
@item
Java lacks unions, so @code{%union} has no effect. Instead, semantic
values have a common base type: @code{Object} or as specified by
address@hidden stype}. Angle backets on @code{%token}, @code{type},
address@hidden stype}. Angle backets on @code{%token}, @code{type},
@address@hidden and @code{$$} specify subtypes rather than fields of
an union. The type of @code{$$}, even with angle brackets, is the base
type since Java casts are not allow on the left-hand side of assignments.
@@ -9516,7 +9529,7 @@ The prolog declarations have a different meaning than in
C/C++ code.
@item @code{%code imports}
blocks are placed at the beginning of the Java source code. They may
include copyright notices. For a @code{package} declarations, it is
-suggested to use @code{%define package} instead.
+suggested to use @samp{%define package} instead.
@item unqualified @code{%code}
blocks are placed inside the parser class.
@@ -9557,7 +9570,7 @@ constructor that @emph{creates} a lexer. Default is none.
@deffn {Directive} %name-prefix "@var{prefix}"
The prefix of the parser class name @address@hidden if
address@hidden parser_class_name} is not used. Default is @code{YY}.
address@hidden parser_class_name} is not used. Default is @code{YY}.
@xref{Java Bison Interface}.
@end deffn
@@ -9747,7 +9760,7 @@ or
@display
My parser includes support for an @samp{#include}-like feature, in
which case I run @code{yyparse} from @code{yyparse}. This fails
-although I did specify @code{%define api.pure}.
+although I did specify @samp{%define api.pure}.
@end display
These problems typically come not from Bison itself, but from
@@ -10309,7 +10322,7 @@ Bison declaration to assign precedence to token(s), but
no associativity
@end deffn
@deffn {Directive} %pure-parser
-Deprecated version of @code{%define api.pure} (@pxref{Decl Summary, ,%define}),
+Deprecated version of @samp{%define api.pure} (@pxref{Decl Summary, ,%define}),
for which Bison is more careful to warn about unreasonable usage.
@end deffn
@@ -10431,7 +10444,7 @@ An obsolete macro used in the @file{yacc.c} skeleton,
that you define
with @code{#define} in the prologue to request verbose, specific error
message strings when @code{yyerror} is called. It doesn't matter what
definition you use for @code{YYERROR_VERBOSE}, just whether you define
-it. Using @code{%define error-verbose} is preferred (@pxref{Error
+it. Using @samp{%define error-verbose} is preferred (@pxref{Error
Reporting, ,The Error Reporting Function @code{yyerror}}).
@end deffn
diff --git a/tests/c++.at b/tests/c++.at
index 608024e..c7359d5 100644
--- a/tests/c++.at
+++ b/tests/c++.at
@@ -303,7 +303,7 @@ m4_define([AT_CHECK_NAMESPACE],
AT_DATA_GRAMMAR([[input.y]],
[[%language "C++"
%defines
-%define namespace "]$1["
+%define api.namespace "]$1["
%union { int i; }
%define global_tokens_and_yystype
%locations
diff --git a/tests/input.at b/tests/input.at
index bf40ab4..51b8819 100644
--- a/tests/input.at
+++ b/tests/input.at
@@ -1123,14 +1123,14 @@ m4_define([AT_CHECK_NAMESPACE_ERROR],
AT_DATA([[input.y]],
[[%language "C++"
%defines
-%define namespace "]$1["
+%define api.namespace "]$1["
%%
start: ;
]])
AT_BISON_CHECK([[input.y]], [1], [],
[m4_foreach([b4_arg], m4_dquote(m4_shift($@)),
-[[input.y:3.9-17: ]b4_arg[
+[[input.y:3.9-21: ]b4_arg[
]])])
])
--
1.6.3.2
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] master: variables: rename namespace as api.namespace.,
Akim Demaille <=