original_expr = par_state->lexptr;
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
- parser_debug);
+ par_state->debug);
lexer_init (yyin); /* (Re-)initialize lexer. */
obstack_free (&temp_parse_space, NULL);
= make_scoped_restore (&expression_macro_scope, macro_scope.get ());
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
- parser_debug);
+ par_state->debug);
/* Initialize some state used by the lexer. */
last_was_structop = false;
pstate = par_state;
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
- parser_debug);
+ par_state->debug);
struct type_stack stack;
scoped_restore restore_type_stack = make_scoped_restore (&type_stack,
/* This flag is set if a top-level comma terminates the
expression. */
PARSER_COMMA_TERMINATES = (1 << 1),
+
+ /* This flag is set if the parser should print debugging output as
+ it parses. For yacc-based parsers, this translates to setting
+ yydebug. */
+ PARSER_DEBUG = (1 << 2),
};
DEF_ENUM_FLAGS_TYPE (enum parser_flag, parser_flags);
/* Setting up the parser state. */
scoped_restore pstate_restore = make_scoped_restore (&pstate);
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
- parser_debug);
+ par_state->debug);
gdb_assert (par_state != NULL);
pstate = par_state;
last_was_structop = false;
pstate = par_state;
scoped_restore restore_yydebug = make_scoped_restore (&yydebug,
- parser_debug);
+ par_state->debug);
/* Initialize some state used by the lexer. */
last_was_structop = 0;
/* True if an expression parser should set yydebug. */
-bool parser_debug;
+static bool parser_debug;
static void
show_parserdebug (struct ui_file *file, int from_tty,
struct internalvar;
class innermost_block_tracker;
-extern bool parser_debug;
-
/* A class that can be used to build a "struct expression". */
struct expr_builder
block_tracker (tracker),
comma_terminates ((flags & PARSER_COMMA_TERMINATES) != 0),
parse_completion (completion),
- void_context_p ((flags & PARSER_VOID_CONTEXT) != 0)
+ void_context_p ((flags & PARSER_VOID_CONTEXT) != 0),
+ debug ((flags & PARSER_DEBUG) != 0)
{
}
/* True if no value is expected from the expression. */
bool void_context_p;
+ /* True if parser debugging should be enabled. */
+ bool debug;
+
private:
/* Data structure for saving values of arglist_len for function calls whose