Remove some uses of "object_files"
[deliverable/binutils-gdb.git] / gdb / p-exp.y
index dbccf358d5c58564efc4025d73cdf095a364e96a..da25ae42af6784ed4045570df251905f3dd023a1 100644 (file)
@@ -68,6 +68,9 @@
 
 static struct parser_state *pstate = NULL;
 
+/* Depth of parentheses.  */
+static int paren_depth;
+
 int yyparse (void);
 
 static int yylex (void);
@@ -282,14 +285,14 @@ exp       :       field_exp name
                        }
        ;
 exp    :       field_exp  name COMPLETE
-                       { mark_struct_expression (pstate);
+                       { pstate->mark_struct_expression ();
                          write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
                          write_exp_string (pstate, $2);
                          write_exp_elt_opcode (pstate, STRUCTOP_STRUCT); }
        ;
 exp    :       field_exp COMPLETE
                        { struct stoken s;
-                         mark_struct_expression (pstate);
+                         pstate->mark_struct_expression ();
                          write_exp_elt_opcode (pstate, STRUCTOP_STRUCT);
                          s.ptr = "";
                          s.length = 0;
@@ -331,11 +334,11 @@ exp       :       exp '('
                        /* This is to save the value of arglist_len
                           being accumulated by an outer function call.  */
                        { push_current_type ();
-                         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);
                          pop_current_type ();
                          if (current_type)
@@ -345,9 +348,9 @@ exp :       exp '('
 
 arglist        :
          | exp
-                       { arglist_len = 1; }
+                       { pstate->arglist_len = 1; }
         | arglist ',' exp   %prec ABOVE_COMMA
-                       { arglist_len++; }
+                       { pstate->arglist_len++; }
        ;
 
 exp    :       type '(' exp ')' %prec UNARY
@@ -709,7 +712,7 @@ variable:   name_not_typename
                          if (sym.symbol)
                            {
                              if (symbol_read_needs_frame (sym.symbol))
-                               innermost_block.update (sym);
+                               pstate->block_tracker->update (sym);
 
                              write_exp_elt_opcode (pstate, OP_VAR_VALUE);
                              write_exp_elt_block (pstate, sym.block);
@@ -723,7 +726,7 @@ variable:   name_not_typename
                              /* Object pascal: it hangs off of `this'.  Must
                                 not inadvertently convert from a method call
                                 to data ref.  */
-                             innermost_block.update (sym);
+                             pstate->block_tracker->update (sym);
                              write_exp_elt_opcode (pstate, OP_THIS);
                              write_exp_elt_opcode (pstate, OP_THIS);
                              write_exp_elt_opcode (pstate, STRUCTOP_PTR);
@@ -1125,10 +1128,10 @@ yylex (void)
 
  retry:
 
-  prev_lexptr = lexptr;
+  pstate->prev_lexptr = pstate->lexptr;
 
-  tokstart = lexptr;
-  explen = strlen (lexptr);
+  tokstart = pstate->lexptr;
+  explen = strlen (pstate->lexptr);
 
   /* See if it is a special token of length 3.  */
   if (explen > 2)
@@ -1138,7 +1141,7 @@ yylex (void)
               || (!isalpha (tokstart[3])
                  && !isdigit (tokstart[3]) && tokstart[3] != '_')))
         {
-          lexptr += 3;
+          pstate->lexptr += 3;
           yylval.opcode = tokentab3[i].opcode;
           return tokentab3[i].token;
         }
@@ -1151,7 +1154,7 @@ yylex (void)
               || (!isalpha (tokstart[2])
                  && !isdigit (tokstart[2]) && tokstart[2] != '_')))
         {
-          lexptr += 2;
+          pstate->lexptr += 2;
           yylval.opcode = tokentab2[i].opcode;
           return tokentab2[i].token;
         }
@@ -1159,7 +1162,7 @@ yylex (void)
   switch (c = *tokstart)
     {
     case 0:
-      if (search_field && parse_completion)
+      if (search_field && pstate->parse_completion)
        return COMPLETE;
       else
        return 0;
@@ -1167,31 +1170,31 @@ yylex (void)
     case ' ':
     case '\t':
     case '\n':
-      lexptr++;
+      pstate->lexptr++;
       goto retry;
 
     case '\'':
       /* We either have a character constant ('0' or '\177' for example)
         or we have a quoted symbol reference ('foo(int,int)' in object pascal
         for example).  */
-      lexptr++;
-      c = *lexptr++;
+      pstate->lexptr++;
+      c = *pstate->lexptr++;
       if (c == '\\')
-       c = parse_escape (pstate->gdbarch (), &lexptr);
+       c = parse_escape (pstate->gdbarch (), &pstate->lexptr);
       else if (c == '\'')
        error (_("Empty character constant."));
 
       yylval.typed_val_int.val = c;
       yylval.typed_val_int.type = parse_type (pstate)->builtin_char;
 
-      c = *lexptr++;
+      c = *pstate->lexptr++;
       if (c != '\'')
        {
          namelen = skip_quoted (tokstart) - tokstart;
          if (namelen > 2)
            {
-             lexptr = tokstart + namelen;
-             if (lexptr[-1] != '\'')
+             pstate->lexptr = tokstart + namelen;
+             if (pstate->lexptr[-1] != '\'')
                error (_("Unmatched single quote."));
              namelen -= 2;
               tokstart++;
@@ -1204,25 +1207,25 @@ yylex (void)
 
     case '(':
       paren_depth++;
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case ')':
       if (paren_depth == 0)
        return 0;
       paren_depth--;
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case ',':
-      if (comma_terminates && paren_depth == 0)
+      if (pstate->comma_terminates && paren_depth == 0)
        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')
        {
          goto symbol;          /* Nope, must be a symbol.  */
        }
@@ -1290,7 +1293,7 @@ yylex (void)
            err_copy[p - tokstart] = 0;
            error (_("Invalid number \"%s\"."), err_copy);
          }
-       lexptr = p;
+       pstate->lexptr = p;
        return toktype;
       }
 
@@ -1314,7 +1317,7 @@ yylex (void)
     case '{':
     case '}':
     symbol:
-      lexptr++;
+      pstate->lexptr++;
       return c;
 
     case '"':
@@ -1366,7 +1369,7 @@ yylex (void)
       tempbuf[tempbufindex] = '\0';    /* See note above.  */
       yylval.sval.ptr = tempbuf;
       yylval.sval.length = tempbufindex;
-      lexptr = tokptr;
+      pstate->lexptr = tokptr;
       return (STRING);
     }
 
@@ -1417,7 +1420,7 @@ yylex (void)
       return 0;
     }
 
-  lexptr += namelen;
+  pstate->lexptr += namelen;
 
   tryname:
 
@@ -1613,7 +1616,7 @@ yylex (void)
             us whether a type is nested), we just ignore the
             containing type.  */
 
-         p = lexptr;
+         p = pstate->lexptr;
          best_sym = sym;
          while (1)
            {
@@ -1658,7 +1661,7 @@ yylex (void)
                          if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
                            {
                              best_sym = cur_sym;
-                             lexptr = p;
+                             pstate->lexptr = p;
                            }
                          else
                            break;
@@ -1723,6 +1726,7 @@ pascal_parse (struct parser_state *par_state)
   scoped_restore pstate_restore = make_scoped_restore (&pstate);
   gdb_assert (par_state != NULL);
   pstate = par_state;
+  paren_depth = 0;
 
   return yyparse ();
 }
@@ -1730,8 +1734,8 @@ pascal_parse (struct parser_state *par_state)
 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.028292 seconds and 4 git commands to generate.