Move arglist_len et al to parser_state
[deliverable/binutils-gdb.git] / gdb / c-exp.y
index cb9e9e002c74c7c749564ac75c0dcf03e0014321..cab5cd55dbd5b8559355531fb6802bd572aad5ec 100644 (file)
@@ -534,11 +534,11 @@ msgarg    :       name ':' exp
 exp    :       exp '('
                        /* This is to save the value of arglist_len
                           being accumulated by an outer function call.  */
-                       { start_arglist (); }
+                       { pstate->start_arglist (); }
                arglist ')'     %prec ARROW
                        { write_exp_elt_opcode (pstate, OP_FUNCALL);
                          write_exp_elt_longcst (pstate,
-                                                (LONGEST) end_arglist ());
+                                                pstate->end_arglist ());
                          write_exp_elt_opcode (pstate, OP_FUNCALL); }
        ;
 
@@ -546,10 +546,10 @@ exp       :       exp '('
    "func()::static_var" further below, which uses
    function_method_void.  */
 exp    :       exp '(' ')' %prec ARROW
-                       { start_arglist ();
+                       { pstate->start_arglist ();
                          write_exp_elt_opcode (pstate, OP_FUNCALL);
                          write_exp_elt_longcst (pstate,
-                                                (LONGEST) end_arglist ());
+                                                pstate->end_arglist ());
                          write_exp_elt_opcode (pstate, OP_FUNCALL); }
        ;
 
@@ -569,30 +569,30 @@ exp       :       UNKNOWN_CPP_NAME '('
                        /* This is to save the value of arglist_len
                           being accumulated by an outer function call.  */
 
-                         start_arglist ();
+                         pstate->start_arglist ();
                        }
                arglist ')'     %prec ARROW
                        {
                          write_exp_elt_opcode (pstate, OP_FUNCALL);
                          write_exp_elt_longcst (pstate,
-                                                (LONGEST) end_arglist ());
+                                                pstate->end_arglist ());
                          write_exp_elt_opcode (pstate, OP_FUNCALL);
                        }
        ;
 
 lcurly :       '{'
-                       { start_arglist (); }
+                       { pstate->start_arglist (); }
        ;
 
 arglist        :
        ;
 
 arglist        :       exp
-                       { arglist_len = 1; }
+                       { pstate->arglist_len = 1; }
        ;
 
 arglist        :       arglist ',' exp   %prec ABOVE_COMMA
-                       { arglist_len++; }
+                       { pstate->arglist_len++; }
        ;
 
 function_method:       exp '(' parameter_typelist ')' const_or_volatile
@@ -645,7 +645,7 @@ exp     :       function_method_void_or_typelist COLONCOLON name
        ;
 
 rcurly :       '}'
-                       { $$ = end_arglist () - 1; }
+                       { $$ = pstate->end_arglist () - 1; }
        ;
 exp    :       lcurly arglist rcurly   %prec ARROW
                        { write_exp_elt_opcode (pstate, OP_ARRAY);
@@ -2483,8 +2483,8 @@ scan_macro_expansion (char *expansion)
 
   /* Save the old lexptr value, so we can return to it when we're done
      parsing the expanded text.  */
-  cpstate->macro_original_text = lexptr;
-  lexptr = copy;
+  cpstate->macro_original_text = pstate->lexptr;
+  pstate->lexptr = copy;
 }
 
 static int
@@ -2500,7 +2500,7 @@ finished_macro_expansion (void)
   gdb_assert (cpstate->macro_original_text);
 
   /* Pop back to the original text.  */
-  lexptr = cpstate->macro_original_text;
+  pstate->lexptr = cpstate->macro_original_text;
   cpstate->macro_original_text = 0;
 }
 
@@ -2550,7 +2550,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
   /* Check if this is a macro invocation that we need to expand.  */
   if (! scanning_macro_expansion ())
     {
-      char *expanded = macro_expand_next (&lexptr,
+      char *expanded = macro_expand_next (&pstate->lexptr,
                                           standard_macro_lookup,
                                           expression_macro_scope);
 
@@ -2558,9 +2558,9 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
         scan_macro_expansion (expanded);
     }
 
-  prev_lexptr = lexptr;
+  pstate->prev_lexptr = pstate->lexptr;
 
-  tokstart = lexptr;
+  tokstart = pstate->lexptr;
   /* See if it is a special token of length 3.  */
   for (i = 0; i < sizeof tokentab3 / sizeof tokentab3[0]; i++)
     if (strncmp (tokstart, tokentab3[i].oper, 3) == 0)
@@ -2569,7 +2569,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            && par_state->language ()->la_language != language_cplus)
          break;
 
-       lexptr += 3;
+       pstate->lexptr += 3;
        yylval.opcode = tokentab3[i].opcode;
        return tokentab3[i].token;
       }
@@ -2582,7 +2582,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            && par_state->language ()->la_language != language_cplus)
          break;
 
-       lexptr += 2;
+       pstate->lexptr += 2;
        yylval.opcode = tokentab2[i].opcode;
        if (tokentab2[i].token == ARROW)
          last_was_structop = 1;
@@ -2616,13 +2616,13 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
     case ' ':
     case '\t':
     case '\n':
-      lexptr++;
+      pstate->lexptr++;
       goto retry;
 
     case '[':
     case '(':
       paren_depth++;
-      lexptr++;
+      pstate->lexptr++;
       if (par_state->language ()->la_language == language_objc
          && c == '[')
        return OBJC_LBRAC;
@@ -2633,20 +2633,20 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
       if (paren_depth == 0)
        return 0;
       paren_depth--;
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case ',':
-      if (comma_terminates
+      if (pstate->comma_terminates
           && paren_depth == 0
           && ! scanning_macro_expansion ())
        return 0;
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case '.':
       /* Might be a floating point number.  */
-      if (lexptr[1] < '0' || lexptr[1] > '9')
+      if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
        {
          last_was_structop = true;
          goto symbol;          /* Nope, must be a symbol. */
@@ -2713,7 +2713,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            err_copy[p - tokstart] = 0;
            error (_("Invalid number \"%s\"."), err_copy);
          }
-       lexptr = p;
+       pstate->lexptr = p;
        return toktype;
       }
 
@@ -2728,7 +2728,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            if (strncmp (p, "selector", len) == 0
                && (p[len] == '\0' || ISSPACE (p[len])))
              {
-               lexptr = p + len;
+               pstate->lexptr = p + len;
                return SELECTOR;
              }
            else if (*p == '"')
@@ -2741,7 +2741,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
        if (strncmp (p, "entry", len) == 0 && !c_ident_is_alnum (p[len])
            && p[len] != '_')
          {
-           lexptr = &p[len];
+           pstate->lexptr = &p[len];
            return ENTRY;
          }
       }
@@ -2764,7 +2764,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
     case '{':
     case '}':
     symbol:
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case 'L':
@@ -2779,8 +2779,8 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
     parse_string:
       {
        int host_len;
-       int result = parse_string_or_char (tokstart, &lexptr, &yylval.tsval,
-                                          &host_len);
+       int result = parse_string_or_char (tokstart, &pstate->lexptr,
+                                          &yylval.tsval, &host_len);
        if (result == CHAR)
          {
            if (host_len == 0)
@@ -2788,7 +2788,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
            else if (host_len > 2 && c == '\'')
              {
                ++tokstart;
-               namelen = lexptr - tokstart - 1;
+               namelen = pstate->lexptr - tokstart - 1;
                *is_quoted_name = true;
 
                goto tryname;
@@ -2860,7 +2860,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
        return 0;
     }
 
-  lexptr += namelen;
+  pstate->lexptr += namelen;
 
   tryname:
 
@@ -2902,7 +2902,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
   if (*tokstart == '$')
     return DOLLAR_VARIABLE;
 
-  if (parse_completion && *lexptr == '\0')
+  if (parse_completion && *pstate->lexptr == '\0')
     saw_name_at_eof = 1;
 
   yylval.ssym.stoken = yylval.sval;
@@ -3388,8 +3388,8 @@ c_print_token (FILE *file, int type, YYSTYPE value)
 static void
 yyerror (const char *msg)
 {
-  if (prev_lexptr)
-    lexptr = prev_lexptr;
+  if (pstate->prev_lexptr)
+    pstate->lexptr = pstate->prev_lexptr;
 
-  error (_("A %s in expression, near `%s'."), msg, lexptr);
+  error (_("A %s in expression, near `%s'."), msg, pstate->lexptr);
 }
This page took 0.0362 seconds and 4 git commands to generate.