Reading signal handler frame in AIX
[deliverable/binutils-gdb.git] / gdb / m2-exp.y
index a52744001f32615ee048903bf4dc3070ed7fa408..2cf2bb536355d915a6b20a7dc5f36680ad360314 100644 (file)
@@ -1,5 +1,5 @@
 /* YACC grammar for Modula-2 expressions, for GDB.
-   Copyright (C) 1986-2016 Free Software Foundation, Inc.
+   Copyright (C) 1986-2018 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.
 
 #define parse_type(ps) builtin_type (parse_gdbarch (ps))
 #define parse_m2_type(ps) builtin_m2_type (parse_gdbarch (ps))
 
-/* Remap normal yacc parser interface names (yyparse, yylex, yyerror, etc),
-   as well as gratuitiously global symbol names, so we can have multiple
-   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.  */
-
-#define        yymaxdepth m2_maxdepth
-#define        yyparse m2_parse_internal
-#define        yylex   m2_lex
-#define        yyerror m2_error
-#define        yylval  m2_lval
-#define        yychar  m2_char
-#define        yydebug m2_debug
-#define        yypact  m2_pact
-#define        yyr1    m2_r1
-#define        yyr2    m2_r2
-#define        yydef   m2_def
-#define        yychk   m2_chk
-#define        yypgo   m2_pgo
-#define        yyact   m2_act
-#define        yyexca  m2_exca
-#define        yyerrflag m2_errflag
-#define        yynerrs m2_nerrs
-#define        yyps    m2_ps
-#define        yypv    m2_pv
-#define        yys     m2_s
-#define        yy_yys  m2_yys
-#define        yystate m2_state
-#define        yytmp   m2_tmp
-#define        yyv     m2_v
-#define        yy_yyv  m2_yyv
-#define        yyval   m2_val
-#define        yylloc  m2_lloc
-#define        yyreds  m2_reds         /* With YYDEBUG defined */
-#define        yytoks  m2_toks         /* With YYDEBUG defined */
-#define yyname m2_name         /* With YYDEBUG defined */
-#define yyrule m2_rule         /* With YYDEBUG defined */
-#define yylhs  m2_yylhs
-#define yylen  m2_yylen
-#define yydefred m2_yydefred
-#define yydgoto        m2_yydgoto
-#define yysindex m2_yysindex
-#define yyrindex m2_yyrindex
-#define yygindex m2_yygindex
-#define yytable         m2_yytable
-#define yycheck         m2_yycheck
-#define yyss   m2_yyss
-#define yysslim        m2_yysslim
-#define yyssp  m2_yyssp
-#define yystacksize m2_yystacksize
-#define yyvs   m2_yyvs
-#define yyvsp  m2_yyvsp
-
-#ifndef YYDEBUG
-#define        YYDEBUG 1               /* Default to yydebug support */
-#endif
-
-#define YYFPRINTF parser_fprintf
+/* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
+   etc).  */
+#define GDB_YY_REMAP_PREFIX m2_
+#include "yy-remap.h"
 
 /* The state of the parser, used internally when we are parsing the
    expression.  */
@@ -120,7 +65,7 @@ int yyparse (void);
 
 static int yylex (void);
 
-void yyerror (char *);
+static void yyerror (const char *);
 
 static int parse_number (int);
 
@@ -137,7 +82,7 @@ static int number_sign = 1;
   {
     LONGEST lval;
     ULONGEST ulval;
-    DOUBLEST dval;
+    gdb_byte val[16];
     struct symbol *sym;
     struct type *tval;
     struct stoken sval;
@@ -158,7 +103,7 @@ static int number_sign = 1;
 
 %token <lval> INT HEX ERROR
 %token <ulval> UINT M2_TRUE M2_FALSE CHAR
-%token <dval> FLOAT
+%token <val> FLOAT
 
 /* Both NAME and TYPENAME tokens represent symbols in the input,
    and both convey their data as strings.
@@ -529,12 +474,12 @@ exp       :       CHAR
 
 
 exp    :       FLOAT
-                       { write_exp_elt_opcode (pstate, OP_DOUBLE);
+                       { write_exp_elt_opcode (pstate, OP_FLOAT);
                          write_exp_elt_type (pstate,
                                              parse_m2_type (pstate)
                                              ->builtin_real);
-                         write_exp_elt_dblcst (pstate, $1);
-                         write_exp_elt_opcode (pstate, OP_DOUBLE); }
+                         write_exp_elt_floatcst (pstate, $1);
+                         write_exp_elt_opcode (pstate, OP_FLOAT); }
        ;
 
 exp    :       variable
@@ -603,12 +548,7 @@ variable:  block COLONCOLON NAME
                            error (_("No symbol \"%s\" in specified context."),
                                   copy_name ($3));
                          if (symbol_read_needs_frame (sym.symbol))
-                           {
-                             if (innermost_block == 0
-                                 || contained_in (sym.block,
-                                                  innermost_block))
-                               innermost_block = sym.block;
-                           }
+                           innermost_block.update (sym);
 
                          write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                          write_exp_elt_block (pstate, sym.block);
@@ -629,12 +569,7 @@ variable:  NAME
                          if (sym.symbol)
                            {
                              if (symbol_read_needs_frame (sym.symbol))
-                               {
-                                 if (innermost_block == 0 ||
-                                     contained_in (sym.block,
-                                                   innermost_block))
-                                   innermost_block = sym.block;
-                               }
+                               innermost_block.update (sym);
 
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                              write_exp_elt_block (pstate, sym.block);
@@ -705,7 +640,11 @@ parse_number (int olen)
     if (p[c] == '.' && base == 10)
       {
        /* It's a float since it contains a point.  */
-       yylval.dval = atof (p);
+       if (!parse_float (p, len,
+                         parse_m2_type (pstate)->builtin_real,
+                         yylval.val))
+         return ERROR;
+
        lexptr += len;
        return FLOAT;
       }
@@ -1091,24 +1030,19 @@ yylex (void)
 int
 m2_parse (struct parser_state *par_state)
 {
-  int result;
-  struct cleanup *c = make_cleanup_clear_parser_state (&pstate);
-
   /* Setting up the parser state.  */
+  scoped_restore pstate_restore = make_scoped_restore (&pstate);
   gdb_assert (par_state != NULL);
   pstate = par_state;
 
-  result = yyparse ();
-  do_cleanups (c);
-
-  return result;
+  return yyparse ();
 }
 
-void
-yyerror (char *msg)
+static void
+yyerror (const char *msg)
 {
   if (prev_lexptr)
     lexptr = prev_lexptr;
 
-  error (_("A %s in expression, near `%s'."), (msg ? msg : "error"), lexptr);
+  error (_("A %s in expression, near `%s'."), msg, lexptr);
 }
This page took 0.025967 seconds and 4 git commands to generate.