mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
c++: make operator() an alias to the parse function
* data/glr.cc, data/lalr1.cc (operator()): New. * doc/bison.texi: Update.
This commit is contained in:
2
NEWS
2
NEWS
@@ -14,6 +14,8 @@ GNU Bison NEWS
|
||||
|
||||
Variant-based symbols in C++ should use emplace() rather than build().
|
||||
|
||||
In C++ parsers, parser::operator() is now a synonym for the parser::parse.
|
||||
|
||||
* Noteworthy changes in release 3.1.91 (2018-10-18) [beta]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
10
data/glr.cc
10
data/glr.cc
@@ -166,6 +166,12 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::operator() ()
|
||||
{
|
||||
return parse ();
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::parse ()
|
||||
{
|
||||
@@ -267,6 +273,10 @@ b4_percent_code_get([[requires]])[
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
|
||||
@@ -190,6 +190,10 @@ m4_define([b4_shared_declarations],
|
||||
]b4_parser_class_name[ (]b4_parse_param_decl[);
|
||||
virtual ~]b4_parser_class_name[ ();
|
||||
|
||||
/// Parse. An alias for parse ().
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
int operator() ();
|
||||
|
||||
/// Parse.
|
||||
/// \returns 0 iff parsing succeeded.
|
||||
virtual int parse ();
|
||||
@@ -743,6 +747,12 @@ m4_if(b4_prefix, [yy], [],
|
||||
return yyvalue == yytable_ninf_;
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::operator() ()
|
||||
{
|
||||
return parse ();
|
||||
}
|
||||
|
||||
int
|
||||
]b4_parser_class_name[::parse ()
|
||||
{
|
||||
|
||||
@@ -10714,8 +10714,10 @@ Build a new parser object. There are no arguments, unless
|
||||
Instantiate a syntax-error exception.
|
||||
@end deftypeop
|
||||
|
||||
@deftypemethod {parser} {int} parse ()
|
||||
Run the syntactic analysis, and return 0 on success, 1 otherwise.
|
||||
@deftypemethod {parser} {int} operator() ()
|
||||
@deftypemethodx {parser} {int} parse ()
|
||||
Run the syntactic analysis, and return 0 on success, 1 otherwise. Both
|
||||
routines are equivalent, @code{operator()} being more C++ish.
|
||||
|
||||
@cindex exceptions
|
||||
The whole function is wrapped in a @code{try}/@code{catch} block, so that
|
||||
|
||||
Reference in New Issue
Block a user