#include "frame.h"
#include "block.h"
-#define parse_type(ps) builtin_type (parse_gdbarch (ps))
+#define parse_type(ps) builtin_type (ps->gdbarch ())
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
etc). */
#define yy_switch_to_buffer ada_yy_switch_to_buffer
#define yyrestart ada_yyrestart
#define yytext ada_yytext
-#define yywrap ada_yywrap
static struct obstack temp_parse_space;
static void
yyerror (const char *msg)
{
- error (_("Error in expression, near `%s'."), lexptr);
+ error (_("Error in expression, near `%s'."), pstate->lexptr);
}
/* Emit expression to access an instance of SYM, in block BLOCK (if
struct symbol *sym)
{
if (symbol_read_needs_frame (sym))
- innermost_block.update (block, INNERMOST_BLOCK_FOR_SYMBOLS);
+ par_state->block_tracker->update (block, INNERMOST_BLOCK_FOR_SYMBOLS);
write_exp_elt_opcode (par_state, OP_VAR_VALUE);
write_exp_elt_block (par_state, block);
find_primitive_type (struct parser_state *par_state, char *name)
{
struct type *type;
- type = language_lookup_primitive_type (parse_language (par_state),
- parse_gdbarch (par_state),
+ type = language_lookup_primitive_type (par_state->language (),
+ par_state->gdbarch (),
name);
if (type == NULL && strcmp ("system__address", name) == 0)
type = type_system_address (par_state);
int name_len;
if (block == NULL)
- block = expression_context_block;
+ block = par_state->expression_context_block;
encoded_name = ada_encode (name0.ptr);
name_len = strlen (encoded_name);
VAR_DOMAIN, &syms);
encoded_name[tail_index] = terminator;
- /* A single symbol may rename a package or object. */
-
- /* This should go away when we move entirely to new version.
- FIXME pnh 7/20/2007. */
- if (nsyms == 1)
- {
- struct symbol *ren_sym =
- ada_find_renaming_symbol (syms[0].symbol, syms[0].block);
-
- if (ren_sym != NULL)
- syms[0].symbol = ren_sym;
- }
-
type_sym = select_possible_type_sym (syms);
if (type_sym != NULL)
if (!have_full_symbols () && !have_partial_symbols () && block == NULL)
error (_("No symbol table is loaded. Use the \"file\" command."));
- if (block == expression_context_block)
+ if (block == par_state->expression_context_block)
error (_("No definition of \"%s\" in current context."), name0.ptr);
else
error (_("No definition of \"%s\" in specified context."), name0.ptr);
if (strchr (name.ptr, '.') == NULL)
{
std::vector<struct block_symbol> syms;
- int nsyms = ada_lookup_symbol_list (name.ptr, expression_context_block,
+ int nsyms = ada_lookup_symbol_list (name.ptr,
+ par_state->expression_context_block,
VAR_DOMAIN, &syms);
if (nsyms != 1 || SYMBOL_CLASS (syms[0].symbol) == LOC_TYPEDEF)
return val;
xsnprintf (name, sizeof (name), "QU%02x", (int) val);
+ size_t len = strlen (name);
for (f = 0; f < TYPE_NFIELDS (type); f += 1)
{
- if (strcmp (name, TYPE_FIELD_NAME (type, f)) == 0)
+ /* Check the suffix because an enum constant in a package will
+ have a name like "pkg__QUxx". This is safe enough because we
+ already have the correct type, and because mangling means
+ there can't be clashes. */
+ const char *ename = TYPE_FIELD_NAME (type, f);
+ size_t elen = strlen (ename);
+
+ if (elen >= len && strcmp (name, ename + elen - len) == 0)
return TYPE_FIELD_ENUMVAL (type, f);
}
return val;
static struct type *
type_char (struct parser_state *par_state)
{
- return language_string_char_type (parse_language (par_state),
- parse_gdbarch (par_state));
+ return language_string_char_type (par_state->language (),
+ par_state->gdbarch ());
}
static struct type *
type_system_address (struct parser_state *par_state)
{
struct type *type
- = language_lookup_primitive_type (parse_language (par_state),
- parse_gdbarch (par_state),
+ = language_lookup_primitive_type (par_state->language (),
+ par_state->gdbarch (),
"system__address");
return type != NULL ? type : parse_type (par_state)->builtin_data_ptr;
}