static struct parser_state *pstate = NULL;
+using namespace expr;
+
/* Data that must be held for the duration of a parse. */
struct ada_parse_state
return result.get ();
}
+ /* The components being constructed during this parse. */
+ std::vector<ada_component_up> components;
+
+ /* The associations being constructed during this parse. */
+ std::vector<ada_association_up> associations;
+
private:
/* We don't have a good way to manage non-POD data in Yacc, so store
static struct type *type_system_address (struct parser_state *);
-using namespace expr;
-
/* Handle Ada type resolution for OP. DEPROCEDURE_P and CONTEXT_TYPE
are passed to the resolve method, if called. */
static operation_up
pstate->push (std::move (funcall));
}
-/* The components being constructed during this parse. */
-static std::vector<ada_component_up> components;
-
/* Create a new ada_component_up of the indicated type and arguments,
and push it on the global 'components' vector. */
template<typename T, typename... Arg>
void
push_component (Arg... args)
{
- components.emplace_back (new T (std::forward<Arg> (args)...));
+ ada_parser->components.emplace_back (new T (std::forward<Arg> (args)...));
}
/* Examine the final element of the 'components' vector, and return it
static ada_choices_component *
choice_component ()
{
- ada_component *last = components.back ().get ();
+ ada_component *last = ada_parser->components.back ().get ();
return gdb::checked_static_cast<ada_choices_component *> (last);
}
static ada_component_up
pop_component ()
{
- ada_component_up result = std::move (components.back ());
- components.pop_back ();
+ ada_component_up result = std::move (ada_parser->components.back ());
+ ada_parser->components.pop_back ();
return result;
}
return result;
}
-/* The associations being constructed during this parse. */
-static std::vector<ada_association_up> associations;
-
/* Create a new ada_association_up of the indicated type and
arguments, and push it on the global 'associations' vector. */
template<typename T, typename... Arg>
void
push_association (Arg... args)
{
- associations.emplace_back (new T (std::forward<Arg> (args)...));
+ ada_parser->associations.emplace_back (new T (std::forward<Arg> (args)...));
}
/* Pop the most recent association from the global stack, and return
static ada_association_up
pop_association ()
{
- ada_association_up result = std::move (associations.back ());
- associations.pop_back ();
+ ada_association_up result = std::move (ada_parser->associations.back ());
+ ada_parser->associations.pop_back ();
return result;
}
lexer_init (yyin); /* (Re-)initialize lexer. */
obstack_free (&temp_parse_space, NULL);
obstack_init (&temp_parse_space);
- components.clear ();
- associations.clear ();
assignments.clear ();
iterated_associations.clear ();