/* YACC grammar for Modula-2 expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1999,
- 2000, 2007, 2008, 2009 Free Software Foundation, Inc.
+ 2000, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Generated from expread.y (now c-exp.y) and contributed by the Department
of Computer Science at the State University of New York at Buffalo, 1991.
generator. Doing this with #defines and trying to control the interaction
with include files (<malloc.h> and <stdlib.h> for example) just became
too messy, particularly when such includes can be inserted at random
- times by the parser generator. */
+ times by the parser generator. */
%{
yacc generated parsers in gdb. Note that these are only the variables
produced by yacc. If other parser generators (bison, byacc, etc) produce
additional global names that conflict at link time, then those parser
- generators need to be fixed instead of adding those names to this list. */
+ generators need to be fixed instead of adding those names to this list. */
#define yymaxdepth m2_maxdepth
#define yyparse m2_parse
static int parse_number (int);
-/* The sign of the number being parsed. */
+/* The sign of the number being parsed. */
static int number_sign = 1;
/* The block that the module specified by the qualifer on an identifer is
write_exp_elt_opcode (OP_M2_STRING); }
;
-/* This will be used for extensions later. Like adding modules. */
+/* This will be used for extensions later. Like adding modules. */
block : fblock
{ $$ = SYMBOL_BLOCK_VALUE($1); }
;
write_exp_elt_opcode (OP_VAR_VALUE); }
;
-/* Base case for variables. */
+/* Base case for variables. */
variable: NAME
{ struct symbol *sym;
int is_a_field_of_this;
type
: TYPENAME
- { $$ = lookup_typename (copy_name ($1),
+ { $$ = lookup_typename (parse_language, parse_gdbarch,
+ copy_name ($1),
expression_context_block, 0); }
;
%%
-#if 0 /* FIXME! */
-int
-overflow(a,b)
- long a,b;
-{
- return (MAX_OF_TYPE(parse_m2_type->builtin_int) - b) < a;
-}
-
-int
-uoverflow(a,b)
- unsigned long a,b;
-{
- return (MAX_OF_TYPE(parse_m2_type->builtin_card) - b) < a;
-}
-#endif /* FIXME */
-
/* Take care of parsing a number (anything that starts with a digit).
Set yylval and return the token type; update lexptr.
LEN is the number of characters in it. */
if(!unsigned_p && number_sign == 1 && (prevn >= n))
unsigned_p=1; /* Try something unsigned */
/* Don't do the range check if n==i and i==0, since that special
- case will give an overflow error. */
+ case will give an overflow error. */
if(RANGE_CHECK && n!=i && i)
{
if((unsigned_p && (unsigned)prevn >= (unsigned)n) ||
char *tmp = copy_name (yylval.sval);
struct symbol *sym;
- if (lookup_partial_symtab (tmp))
+ if (lookup_symtab (tmp))
return BLOCKNAME;
sym = lookup_symbol (tmp, expression_context_block, VAR_DOMAIN, 0);
if (sym && SYMBOL_CLASS (sym) == LOC_BLOCK)
return BLOCKNAME;
- if (lookup_typename (copy_name (yylval.sval), expression_context_block, 1))
+ if (lookup_typename (parse_language, parse_gdbarch,
+ copy_name (yylval.sval), expression_context_block, 1))
return TYPENAME;
if(sym)
}
else
{
- /* Built-in BOOLEAN type. This is sort of a hack. */
+ /* Built-in BOOLEAN type. This is sort of a hack. */
if (strncmp (tokstart, "TRUE", 4) == 0)
{
yylval.ulval = 1;
}
}
- /* Must be another type of name... */
+ /* Must be another type of name... */
return NAME;
}
}