/* YACC grammar for Chill expressions, for GDB.
- Copyright (C) 1992 Free Software Foundation, Inc.
+ Copyright 1992, 1993 Free Software Foundation, Inc.
This file is part of GDB.
#include "value.h"
#include "parser-defs.h"
#include "ch-lang.h"
+#include "bfd.h" /* Required by objfiles.h. */
+#include "symfile.h" /* Required by objfiles.h. */
+#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
as well as gratuitiously global symbol names, so we can have multiple
#define yypgo chill_pgo
#define yyact chill_act
#define yyexca chill_exca
-#define yyerrflag chill_errflag
-#define yynerrs chill_nerrs
+#define yyerrflag chill_errflag
+#define yynerrs chill_nerrs
#define yyps chill_ps
#define yypv chill_pv
#define yys chill_s
#define yy_yyv chill_yyv
#define yyval chill_val
#define yylloc chill_lloc
-#define yyreds chill_reds /* With YYDEBUG defined */
-#define yytoks chill_toks /* With YYDEBUG defined */
+#define yyreds chill_reds /* With YYDEBUG defined */
+#define yytoks chill_toks /* With YYDEBUG defined */
#ifndef YYDEBUG
#define YYDEBUG 0 /* Default to no yydebug support */
%token <voidval> SUCC
%token <voidval> ABS
%token <voidval> CARD
-%token <voidval> MAX
-%token <voidval> MIN
+%token <voidval> MAX_TOKEN
+%token <voidval> MIN_TOKEN
%token <voidval> SIZE
%token <voidval> UPPER
%token <voidval> LOWER
/* Z.200, 5.3.1 */
-start : value
+start : value { }
| mode_name
{ write_exp_elt_opcode(OP_TYPE);
write_exp_elt_type($1.type);
access_name : LOCATION_NAME
{
write_exp_elt_opcode (OP_VAR_VALUE);
+ write_exp_elt_block (NULL);
write_exp_elt_sym ($1.sym);
write_exp_elt_opcode (OP_VAR_VALUE);
}
| GENERAL_PROCEDURE_NAME
{
write_exp_elt_opcode (OP_VAR_VALUE);
+ write_exp_elt_block (NULL);
write_exp_elt_sym ($1.sym);
write_exp_elt_opcode (OP_VAR_VALUE);
}
}
| operand_2 IN operand_3
{
- $$ = 0; /* FIXME */
+ write_exp_elt_opcode (BINOP_IN);
}
;
{
$$ = 0; /* FIXME */
}
- | MAX '(' expression ')'
+ | MAX_TOKEN '(' expression ')'
{
$$ = 0; /* FIXME */
}
- | MIN '(' expression ')'
+ | MIN_TOKEN '(' expression ')'
{
$$ = 0; /* FIXME */
}
char *tokptr = lexptr;
char *buf;
char *copy;
- char ch;
double dval;
extern double strtod ();
return (0);
}
-/* Recognize a string literal. A string literal is a nonzero sequence
+/* Recognize a string literal. A string literal is a sequence
of characters enclosed in matching single or double quotes, except that
a single character inside single quotes is a character literal, which
we reject as a string literal. To embed the terminator character inside
tempbuf[tempbufindex++] = *tokptr;
}
if (*tokptr == '\0' /* no terminator */
- || tempbufindex == 0 /* no string */
|| (tempbufindex == 1 && *tokptr == '\'')) /* char literal */
{
return (0);
&& !isalnum (tokptr[namelength]))
{
yylval.lval = regno;
- lexptr += namelength + 1;
+ lexptr += namelength;
return (GDB_REGNAME);
}
}
{ "orif", ORIF },
{ "num", NUM },
{ "abs", ABS },
- { "max", MAX },
- { "min", MIN },
+ { "max", MAX_TOKEN },
+ { "min", MIN_TOKEN },
{ "mod", MOD },
{ "rem", REM },
{ "not", NOT },
{
case '\'':
case '\"':
- /* First try to match a string literal, which is any nonzero
+ /* First try to match a string literal, which is any
sequence of characters enclosed in matching single or double
quotes, except that a single character inside single quotes
is a character literal, so we have to catch that case also. */
simplename = match_simple_name_string ();
- /* See if it is a reserved identifier. */
- for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
- {
- if (STREQ (simplename, idtokentab[i].operator))
- {
- return (idtokentab[i].token);
- }
- }
-
- /* Look for other special tokens. */
- if (STREQ (simplename, "true"))
- {
- yylval.ulval = 1;
- return (BOOLEAN_LITERAL);
- }
- if (STREQ (simplename, "false"))
- {
- yylval.ulval = 0;
- return (BOOLEAN_LITERAL);
- }
-
if (simplename != NULL)
{
+ /* See if it is a reserved identifier. */
+ for (i = 0; i < sizeof (idtokentab) / sizeof (idtokentab[0]); i++)
+ {
+ if (STREQ (simplename, idtokentab[i].operator))
+ {
+ return (idtokentab[i].token);
+ }
+ }
+
+ /* Look for other special tokens. */
+ if (STREQ (simplename, "true"))
+ {
+ yylval.ulval = 1;
+ return (BOOLEAN_LITERAL);
+ }
+ if (STREQ (simplename, "false"))
+ {
+ yylval.ulval = 0;
+ return (BOOLEAN_LITERAL);
+ }
+
sym = lookup_symbol (simplename, expression_context_block,
VAR_NAMESPACE, (int *) NULL,
(struct symtab **) NULL);
case LOC_ARG:
case LOC_REF_ARG:
case LOC_REGPARM:
+ case LOC_REGPARM_ADDR:
case LOC_LOCAL:
case LOC_LOCAL_ARG:
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
if (innermost_block == NULL
|| contained_in (block_found, innermost_block))
{
yyerror (msg)
char *msg; /* unused */
{
- printf ("Parsing: %s\n", lexptr);
+ printf_unfiltered ("Parsing: %s\n", lexptr);
if (yychar < 256)
{
error ("Invalid syntax in expression near character '%c'.", yychar);