* m88k-pinsn.c: Moved code into opcodes/m88k-dis.c.
[deliverable/binutils-gdb.git] / gdb / m2-exp.y
index 037a07419b493be00122b52512f90ee4e1ec0e1e..449b13f4bb126e871fa2a1943976834460a945b0 100644 (file)
@@ -45,9 +45,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "parser-defs.h"
 #include "m2-lang.h"
 
-/* These MUST be included in any grammar file!!!! Please choose unique names!
-   Note that this are a combined list of variables that can be produced
-   by any one of bison, byacc, or yacc. */
+/* 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
 #define        yylex   m2_lex
@@ -75,18 +79,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #define        yy_yyv  m2_yyv
 #define        yyval   m2_val
 #define        yylloc  m2_lloc
-#define yyss   m2_yyss         /* byacc */
-#define        yyssp   m2_yysp         /* byacc */
-#define        yyvs    m2_yyvs         /* byacc */
-#define        yyvsp   m2_yyvsp        /* byacc */
+#define yyreds m2_reds         /* With YYDEBUG defined */
+#define yytoks m2_toks         /* With YYDEBUG defined */
 
-#if 0
-static char *
-make_qualname PARAMS ((char *, char *));
+#ifndef YYDEBUG
+#define        YYDEBUG 0               /* Default to no yydebug support */
 #endif
 
-static int
-parse_number PARAMS ((int));
+int
+yyparse PARAMS ((void));
 
 static int
 yylex PARAMS ((void));
@@ -94,8 +95,13 @@ yylex PARAMS ((void));
 void
 yyerror PARAMS ((char *));
 
-int
-yyparse PARAMS ((void));
+#if 0
+static char *
+make_qualname PARAMS ((char *, char *));
+#endif
+
+static int
+parse_number PARAMS ((int));
 
 /* The sign of the number being parsed. */
 static int number_sign = 1;
@@ -106,7 +112,6 @@ static int number_sign = 1;
 static struct block *modblock=0;
 #endif
 
-/* #define     YYDEBUG 1 */
 %}
 
 /* Although the yacc "value" of an expression is not used,
@@ -328,9 +333,9 @@ exp     :       exp '['
                           function types */
                         { start_arglist(); }
                 non_empty_arglist ']'  %prec DOT
-                        { write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT);
+                        { write_exp_elt_opcode (MULTI_SUBSCRIPT);
                          write_exp_elt_longcst ((LONGEST) end_arglist());
-                         write_exp_elt_opcode (BINOP_MULTI_SUBSCRIPT); }
+                         write_exp_elt_opcode (MULTI_SUBSCRIPT); }
         ;
 
 exp    :       exp '('
@@ -612,6 +617,7 @@ variable:   NAME
                                case LOC_LABEL: /* maybe should go above? */
                                case LOC_BLOCK:
                                case LOC_CONST_BYTES:
+                               case LOC_OPTIMIZED_OUT:
                                  /* These are listed so gcc -Wall will reveal
                                     un-handled cases.  */
                                  break;
@@ -848,7 +854,7 @@ yylex ()
 
   /* See if it is a special token of length 2 */
   for( i = 0 ; i < sizeof tokentab2 / sizeof tokentab2[0] ; i++)
-     if(!strncmp(tokentab2[i].name, tokstart, 2))
+     if(STREQN(tokentab2[i].name, tokstart, 2))
      {
        lexptr += 2;
        return tokentab2[i].token;
@@ -1043,14 +1049,14 @@ yylex ()
   if (*tokstart == '$') {
     for (c = 0; c < NUM_REGS; c++)
       if (namelen - 1 == strlen (reg_names[c])
-         && !strncmp (tokstart + 1, reg_names[c], namelen - 1))
+         && STREQN (tokstart + 1, reg_names[c], namelen - 1))
        {
          yylval.lval = c;
          return REGNAME;
        }
     for (c = 0; c < num_std_regs; c++)
      if (namelen - 1 == strlen (std_regs[c].name)
-        && !strncmp (tokstart + 1, std_regs[c].name, namelen - 1))
+        && STREQN (tokstart + 1, std_regs[c].name, namelen - 1))
        {
         yylval.lval = std_regs[c].regnum;
         return REGNAME;
@@ -1060,7 +1066,7 @@ yylex ()
 
   /*  Lookup special keywords */
   for(i = 0 ; i < sizeof(keytab) / sizeof(keytab[0]) ; i++)
-     if(namelen == strlen(keytab[i].keyw) && !strncmp(tokstart,keytab[i].keyw,namelen))
+     if(namelen == strlen(keytab[i].keyw) && STREQN(tokstart,keytab[i].keyw,namelen))
           return keytab[i].token;
 
   yylval.sval.ptr = tokstart;
@@ -1126,12 +1132,12 @@ yylex ()
     else
     {
        /* Built-in BOOLEAN type.  This is sort of a hack. */
-       if(!strncmp(tokstart,"TRUE",4))
+       if(STREQN(tokstart,"TRUE",4))
        {
          yylval.ulval = 1;
          return M2_TRUE;
        }
-       else if(!strncmp(tokstart,"FALSE",5))
+       else if(STREQN(tokstart,"FALSE",5))
        {
          yylval.ulval = 0;
          return M2_FALSE;
This page took 0.043292 seconds and 4 git commands to generate.