2013-08-30 Phil Muldoon <pmuldoon@redhat.com>
[deliverable/binutils-gdb.git] / gdb / p-exp.y
index 0a384e146dd03c94a53bb1374c97ca6b00115b00..da8d5f74714b1ba5e24c503a5ddd87e8cc5ddef7 100644 (file)
@@ -1,6 +1,5 @@
 /* YACC parser for Pascal expressions, for GDB.
-   Copyright (C) 2000, 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2000-2013 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #define yygindex pascal_yygindex
 #define yytable         pascal_yytable
 #define yycheck         pascal_yycheck
+#define yyss   pascal_yyss
+#define yysslim        pascal_yysslim
+#define yyssp  pascal_yyssp
+#define yystacksize pascal_yystacksize
+#define yyvs   pascal_yyvs
+#define yyvsp  pascal_yyvsp
 
 #ifndef YYDEBUG
 #define        YYDEBUG 1               /* Default to yydebug support */
@@ -339,7 +344,7 @@ exp :       field_exp COMPLETE
 
 exp    :       exp '['
                        /* We need to save the current_type value.  */
-                       { char *arrayname;
+                       { const char *arrayname;
                          int arrayfieldindex;
                          arrayfieldindex = is_pascal_string_type (
                                current_type, NULL, NULL,
@@ -612,7 +617,7 @@ exp :       THIS
                          write_exp_elt_opcode (OP_THIS);
                          write_exp_elt_opcode (OP_THIS);
                          /* We need type of this.  */
-                         this_val = value_of_this (parse_language, 0);
+                         this_val = value_of_this_silent (parse_language);
                          if (this_val)
                            this_type = value_type (this_val);
                          else
@@ -653,7 +658,7 @@ block       :       BLOCKNAME
 block  :       block COLONCOLON name
                        { struct symbol *tem
                            = lookup_symbol (copy_name ($3), $1,
-                                            VAR_DOMAIN, (int *) NULL);
+                                            VAR_DOMAIN, NULL);
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
                            error (_("No function \"%s\" in specified context."),
                                   copy_name ($3));
@@ -663,7 +668,7 @@ block       :       block COLONCOLON name
 variable:      block COLONCOLON name
                        { struct symbol *sym;
                          sym = lookup_symbol (copy_name ($3), $1,
-                                              VAR_DOMAIN, (int *) NULL);
+                                              VAR_DOMAIN, NULL);
                          if (sym == 0)
                            error (_("No symbol \"%s\" in specified context."),
                                   copy_name ($3));
@@ -695,11 +700,11 @@ variable: qualified_name
                        {
                          char *name = copy_name ($2);
                          struct symbol *sym;
-                         struct minimal_symbol *msymbol;
+                         struct bound_minimal_symbol msymbol;
 
                          sym =
                            lookup_symbol (name, (const struct block *) NULL,
-                                          VAR_DOMAIN, (int *) NULL);
+                                          VAR_DOMAIN, NULL);
                          if (sym)
                            {
                              write_exp_elt_opcode (OP_VAR_VALUE);
@@ -709,8 +714,8 @@ variable:   qualified_name
                              break;
                            }
 
-                         msymbol = lookup_minimal_symbol (name, NULL, NULL);
-                         if (msymbol != NULL)
+                         msymbol = lookup_bound_minimal_symbol (name);
+                         if (msymbol.minsym != NULL)
                            write_exp_msymbol (msymbol);
                          else if (!have_full_symbols ()
                                   && !have_partial_symbols ())
@@ -760,7 +765,7 @@ variable:   name_not_typename
                              write_exp_string ($1.stoken);
                              write_exp_elt_opcode (STRUCTOP_PTR);
                              /* We need type of this.  */
-                             this_val = value_of_this (parse_language, 0);
+                             this_val = value_of_this_silent (parse_language);
                              if (this_val)
                                this_type = value_type (this_val);
                              else
@@ -774,12 +779,12 @@ variable: name_not_typename
                            }
                          else
                            {
-                             struct minimal_symbol *msymbol;
+                             struct bound_minimal_symbol msymbol;
                              char *arg = copy_name ($1.stoken);
 
                              msymbol =
-                               lookup_minimal_symbol (arg, NULL, NULL);
-                             if (msymbol != NULL)
+                               lookup_bound_minimal_symbol (arg);
+                             if (msymbol.minsym != NULL)
                                write_exp_msymbol (msymbol);
                              else if (!have_full_symbols ()
                                       && !have_partial_symbols ())
@@ -1094,9 +1099,8 @@ static const struct token tokentab2[] =
 
 /* Allocate uppercased var: */
 /* make an uppercased copy of tokstart.  */
-static char * uptok (tokstart, namelen)
-  char *tokstart;
-  int namelen;
+static char *
+uptok (char *tokstart, int namelen)
 {
   int i;
   char *uptokstart = (char *)malloc(namelen+1);
@@ -1233,7 +1237,7 @@ yylex (void)
       /* Might be a floating point number.  */
       if (lexptr[1] < '0' || lexptr[1] > '9')
        {
-         if (in_parse_field)
+         if (parse_completion)
            last_was_structop = 1;
          goto symbol;          /* Nope, must be a symbol.  */
        }
@@ -1479,7 +1483,7 @@ yylex (void)
          static const char this_name[] = "this";
 
          if (lookup_symbol (this_name, expression_context_block,
-                            VAR_DOMAIN, (int *) NULL))
+                            VAR_DOMAIN, NULL))
            {
              free (uptokstart);
              return THIS;
@@ -1518,20 +1522,20 @@ yylex (void)
   {
     char *tmp = copy_name (yylval.sval);
     struct symbol *sym;
-    int is_a_field_of_this = 0;
+    struct field_of_this_result is_a_field_of_this;
     int is_a_field = 0;
     int hextype;
 
 
     if (search_field && current_type)
       is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
-    if (is_a_field || in_parse_field)
+    if (is_a_field || parse_completion)
       sym = NULL;
     else
       sym = lookup_symbol (tmp, expression_context_block,
                           VAR_DOMAIN, &is_a_field_of_this);
     /* second chance uppercased (as Free Pascal does).  */
-    if (!sym && !is_a_field_of_this && !is_a_field)
+    if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
       {
        for (i = 0; i <= namelen; i++)
          {
@@ -1540,12 +1544,12 @@ yylex (void)
          }
        if (search_field && current_type)
         is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
-       if (is_a_field || in_parse_field)
+       if (is_a_field || parse_completion)
         sym = NULL;
        else
         sym = lookup_symbol (tmp, expression_context_block,
                              VAR_DOMAIN, &is_a_field_of_this);
-       if (sym || is_a_field_of_this || is_a_field)
+       if (sym || is_a_field_of_this.type != NULL || is_a_field)
          for (i = 0; i <= namelen; i++)
            {
              if ((tokstart[i] >= 'a' && tokstart[i] <= 'z'))
@@ -1553,7 +1557,7 @@ yylex (void)
            }
       }
     /* Third chance Capitalized (as GPC does).  */
-    if (!sym && !is_a_field_of_this && !is_a_field)
+    if (!sym && is_a_field_of_this.type == NULL && !is_a_field)
       {
        for (i = 0; i <= namelen; i++)
          {
@@ -1568,12 +1572,12 @@ yylex (void)
           }
        if (search_field && current_type)
         is_a_field = (lookup_struct_elt_type (current_type, tmp, 1) != NULL);
-       if (is_a_field || in_parse_field)
+       if (is_a_field || parse_completion)
         sym = NULL;
        else
         sym = lookup_symbol (tmp, expression_context_block,
                              VAR_DOMAIN, &is_a_field_of_this);
-       if (sym || is_a_field_of_this || is_a_field)
+       if (sym || is_a_field_of_this.type != NULL || is_a_field)
           for (i = 0; i <= namelen; i++)
             {
               if (i == 0)
@@ -1603,7 +1607,7 @@ yylex (void)
         || lookup_symtab (tmp))
       {
        yylval.ssym.sym = sym;
-       yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+       yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
        free (uptokstart);
        return BLOCKNAME;
       }
@@ -1669,7 +1673,7 @@ yylex (void)
                      memcpy (tmp1, namestart, p - namestart);
                      tmp1[p - namestart] = '\0';
                      cur_sym = lookup_symbol (ncopy, expression_context_block,
-                                              VAR_DOMAIN, (int *) NULL);
+                                              VAR_DOMAIN, NULL);
                      if (cur_sym)
                        {
                          if (SYMBOL_CLASS (cur_sym) == LOC_TYPEDEF)
@@ -1718,7 +1722,7 @@ yylex (void)
        if (hextype == INT)
          {
            yylval.ssym.sym = sym;
-           yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+           yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
            free (uptokstart);
            return NAME_OR_INT;
          }
@@ -1727,14 +1731,13 @@ yylex (void)
     free(uptokstart);
     /* Any other kind of symbol.  */
     yylval.ssym.sym = sym;
-    yylval.ssym.is_a_field_of_this = is_a_field_of_this;
+    yylval.ssym.is_a_field_of_this = is_a_field_of_this.type != NULL;
     return NAME;
   }
 }
 
 void
-yyerror (msg)
-     char *msg;
+yyerror (char *msg)
 {
   if (prev_lexptr)
     lexptr = prev_lexptr;
This page took 0.027418 seconds and 4 git commands to generate.