+2004-12-15 Akim Demaille <akim@epita.fr>
+
+ Simplify the C++ parser constructor.
+
+ * data/lalr1.cc (debug_): Rename as...
+ (yydebug_): so that the parser's internals are always in the yy*
+ pseudo namespace.
+ Adjust uses.
+ (b4_parse_param_decl): Remove the leading comma as it is now only
+ called as unique argument list.
+ (Parser::Parser): Remove the constructor accepting a location and
+ an initial debugging level.
+ Remove from the other ctor the argument for the debugging level.
+ (debug_level_type, debug_level, set_debug_level): New.
+
+ * tests/actions.at, tests/calc.at, tests/regression.at: Adjust
+ constructor calls.
+
2004-12-15 Akim Demaille <akim@epita.fr>
Remove b4_root related material: failure experiment
- (which goal was to allow to derive from an class).
+ (which goal was to allow to derive from a class).
* data/lalr1.cc (b4_root, b4_param, b4_constructor): Remove
definitions and uses.
# argument name in the constructor.
m4_define([b4_parse_param_decl],
[m4_ifset([b4_parse_param],
- [, m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
+ [m4_map_sep([b4_parse_param_decl_1], [, ], [b4_parse_param])])])
m4_define([b4_parse_param_decl_1],
[$1_yyarg])
typedef Stack<SemanticType> SemanticStack;
typedef Stack<LocationType> LocationStack;
- ]b4_parser_class_name[ (bool debug]b4_parse_param_decl[) :
- debug_ (debug),
+ ]b4_parser_class_name[ (]b4_parse_param_decl[) :
+ yydebug_ (false),
yycdebug_ (&std::cerr)]b4_parse_param_cons[
{
}
- ]b4_parser_class_name[ (bool debug,
- LocationType]b4_parse_param_decl[) :
- debug_ (debug),
- yycdebug_ (&std::cerr)]b4_parse_param_cons[
- {
- *yycdebug_ << __FILE__ << ':' << __LINE__
- << ": this constructor is provided by backward compatibility"
- << ", but will be removed in the near future."
- << std::endl;
- }
-
virtual ~]b4_parser_class_name[ ()
{
}
/// Set the current debugging stream.
void set_debug_stream (std::ostream &);
+ /// Type for debugging levels.
+ typedef int debug_level_type;
+ /// The current debugging level.
+ debug_level_type debug_level () const;
+ /// Set the current debugging level.
+ void set_debug_level (debug_level_type l);
+
private:
virtual void lex_ ();
int errstatus_;
/* Debugging. */
- int debug_;
+ int yydebug_;
std::ostream* yycdebug_;
/* Look-ahead and look-ahead in internal form. */
m4_if(b4_defines_flag, 0, [], [#include @output_header_name@])[
-/* A pseudo ostream that takes debug_ into account. */
+/* A pseudo ostream that takes yydebug_ into account. */
# define YYCDEBUG \
- for (bool yydebugcond_ = debug_; yydebugcond_; yydebugcond_ = false) \
+ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
(*yycdebug_)
/* Enable debugging if requested. */
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \
- if (debug_) \
+ if (yydebug_) \
{ \
*yycdebug_ << (Title) << ' '; \
symprint_ ((Type), (Value), (Location)); \
# define YY_REDUCE_PRINT(Rule) \
do { \
- if (debug_) \
+ if (yydebug_) \
reduce_print_ (Rule); \
} while (0)
# define YY_STACK_PRINT() \
do { \
- if (debug_) \
+ if (yydebug_) \
stack_print_ (); \
} while (0)
}
+yy::]b4_parser_class_name[::debug_level_type
+yy::]b4_parser_class_name[::debug_level () const
+{
+ return yydebug_;
+}
+
+void
+yy::]b4_parser_class_name[::set_debug_level (debug_level_type l)
+{
+ yydebug_ = l;
+}
+
+
int
yy::]b4_parser_class_name[::parse ()
{