/* YACC parser for Fortran expressions, for GDB.
- Copyright (C) 1986, 1989-1991, 1993-1996, 2000-2012 Free Software
- Foundation, Inc.
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
Contributed by Motorola. Adapted from the C parser by Farooq Butt
(fmbutt@engage.sps.mot.com).
%{
#include "defs.h"
-#include "gdb_string.h"
+#include <string.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
%{
/* YYSTYPE gets defined by %union */
-static int parse_number (char *, int, int, YYSTYPE *);
+static int parse_number (const char *, int, int, YYSTYPE *);
%}
%type <voidval> exp type_exp start variable
}
else
{
- struct minimal_symbol *msymbol;
+ struct bound_minimal_symbol msymbol;
char *arg = copy_name ($1.stoken);
msymbol =
- lookup_minimal_symbol (arg, NULL, NULL);
- if (msymbol != NULL)
+ lookup_bound_minimal_symbol (arg);
+ if (msymbol.minsym != NULL)
write_exp_msymbol (msymbol);
else if (!have_full_symbols () && !have_partial_symbols ())
error (_("No symbol table is loaded. Use the \"file\" command."));
/*** Needs some error checking for the float case ***/
static int
-parse_number (char *p, int len, int parsed_float, YYSTYPE *putithere)
+parse_number (const char *p, int len, int parsed_float, YYSTYPE *putithere)
{
LONGEST n = 0;
LONGEST prevn = 0;
static int
match_string_literal (void)
{
- char *tokptr = lexptr;
+ const char *tokptr = lexptr;
for (tempbufindex = 0, tokptr++; *tokptr != '\0'; tokptr++)
{
int c;
int namelen;
unsigned int i,token;
- char *tokstart;
+ const char *tokstart;
retry:
{
/* It's a number. */
int got_dot = 0, got_e = 0, got_d = 0, toktype;
- char *p = tokstart;
+ const char *p = tokstart;
int hex = input_radix > 10;
if (c == '0' && (p[1] == 'x' || p[1] == 'X'))
char *tmp = copy_name (yylval.sval);
struct symbol *sym;
struct field_of_this_result is_a_field_of_this;
+ enum domain_enum_tag lookup_domains[] =
+ {
+ STRUCT_DOMAIN,
+ VAR_DOMAIN,
+ MODULE_DOMAIN
+ };
+ int i;
int hextype;
-
- /* Initialize this in case we *don't* use it in this call; that
- way we can refer to it unconditionally below. */
- memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
-
- sym = lookup_symbol (tmp, expression_context_block,
- VAR_DOMAIN,
- parse_language->la_language == language_cplus
- ? &is_a_field_of_this : NULL);
- if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+
+ for (i = 0; i < ARRAY_SIZE (lookup_domains); ++i)
{
- yylval.tsym.type = SYMBOL_TYPE (sym);
- return TYPENAME;
+ /* Initialize this in case we *don't* use it in this call; that
+ way we can refer to it unconditionally below. */
+ memset (&is_a_field_of_this, 0, sizeof (is_a_field_of_this));
+
+ sym = lookup_symbol (tmp, expression_context_block,
+ lookup_domains[i],
+ parse_language->la_language == language_cplus
+ ? &is_a_field_of_this : NULL);
+ if (sym && SYMBOL_CLASS (sym) == LOC_TYPEDEF)
+ {
+ yylval.tsym.type = SYMBOL_TYPE (sym);
+ return TYPENAME;
+ }
+
+ if (sym)
+ break;
}
+
yylval.tsym.type
= language_lookup_primitive_type_by_name (parse_language,
parse_gdbarch, tmp);