* MAINTAINERS: Change my e-mail address.
[deliverable/binutils-gdb.git] / gdb / objc-exp.y
index 54b99b00610d977fe3ab4f3a0c897a53a19e241a..9e7cf11cc0127ff162e6a91948fc1d499c3d9b85 100644 (file)
@@ -52,6 +52,7 @@
 #include "objfiles.h" /* For have_full_symbols and have_partial_symbols.  */
 #include "top.h"
 #include "completer.h" /* For skip_quoted().  */
+#include "block.h"
 
 /* Remap normal yacc parser interface names (yyparse, yylex, yyerror,
    etc), as well as gratuitiously global symbol names, so we can have
@@ -203,9 +204,6 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
 
 %token <opcode> ASSIGN_MODIFY
 
-/* C++ */
-%token THIS
-
 %left ','
 %left ABOVE_COMMA
 %right '=' ASSIGN_MODIFY
@@ -249,9 +247,11 @@ exp1       :       exp
 /* Expressions, not including the comma operator.  */
 exp    :       '*' exp    %prec UNARY
                        { write_exp_elt_opcode (UNOP_IND); }
+       ;
 
 exp    :       '&' exp    %prec UNARY
                        { write_exp_elt_opcode (UNOP_ADDR); }
+       ;
 
 exp    :       '-' exp    %prec UNARY
                        { write_exp_elt_opcode (UNOP_NEG); }
@@ -344,9 +344,9 @@ exp :       '[' TYPENAME
                          start_msglist();
                        }
                msglist ']'
-                       { write_exp_elt_opcode (OP_MSGCALL);
+                       { write_exp_elt_opcode (OP_OBJC_MSGCALL);
                          end_msglist();
-                         write_exp_elt_opcode (OP_MSGCALL); 
+                         write_exp_elt_opcode (OP_OBJC_MSGCALL); 
                        }
        ;
 
@@ -359,18 +359,18 @@ exp       :       '[' CLASSNAME
                          start_msglist();
                        }
                msglist ']'
-                       { write_exp_elt_opcode (OP_MSGCALL);
+                       { write_exp_elt_opcode (OP_OBJC_MSGCALL);
                          end_msglist();
-                         write_exp_elt_opcode (OP_MSGCALL); 
+                         write_exp_elt_opcode (OP_OBJC_MSGCALL); 
                        }
        ;
 
 exp    :       '[' exp
                        { start_msglist(); }
                msglist ']'
-                       { write_exp_elt_opcode (OP_MSGCALL);
+                       { write_exp_elt_opcode (OP_OBJC_MSGCALL);
                          end_msglist();
-                         write_exp_elt_opcode (OP_MSGCALL); 
+                         write_exp_elt_opcode (OP_OBJC_MSGCALL); 
                        }
        ;
 
@@ -568,9 +568,10 @@ exp        :       VARIABLE
 
 exp    :       SELECTOR 
                        {
-                         write_exp_elt_opcode (OP_SELECTOR);
+                         write_exp_elt_opcode (OP_OBJC_SELECTOR);
                          write_exp_string ($1);
-                         write_exp_elt_opcode (OP_SELECTOR); }
+                         write_exp_elt_opcode (OP_OBJC_SELECTOR); }
+       ;
 
 exp    :       SIZEOF '(' type ')'     %prec UNARY
                        { write_exp_elt_opcode (OP_LONG);
@@ -608,19 +609,11 @@ exp       :       STRING
 exp     :      NSSTRING        /* ObjC NextStep NSString constant
                                 * of the form '@' '"' string '"'.
                                 */
-                       { write_exp_elt_opcode (OP_NSSTRING);
+                       { write_exp_elt_opcode (OP_OBJC_NSSTRING);
                          write_exp_string ($1);
-                         write_exp_elt_opcode (OP_NSSTRING); }
-       ;
-
-/* C++.  */
-exp    :       THIS
-                       { write_exp_elt_opcode (OP_THIS);
-                         write_exp_elt_opcode (OP_THIS); }
+                         write_exp_elt_opcode (OP_OBJC_NSSTRING); }
        ;
 
-/* end of C++.  */
-
 block  :       BLOCKNAME
                        {
                          if ($1.sym != 0)
@@ -641,7 +634,7 @@ block       :       BLOCKNAME
 block  :       block COLONCOLON name
                        { struct symbol *tem
                            = lookup_symbol (copy_name ($3), $1,
-                                            VAR_NAMESPACE, (int *) NULL,
+                                            VAR_DOMAIN, (int *) NULL,
                                             (struct symtab **) NULL);
                          if (!tem || SYMBOL_CLASS (tem) != LOC_BLOCK)
                            error ("No function \"%s\" in specified context.",
@@ -652,7 +645,7 @@ block       :       block COLONCOLON name
 variable:      block COLONCOLON name
                        { struct symbol *sym;
                          sym = lookup_symbol (copy_name ($3), $1,
-                                              VAR_NAMESPACE, (int *) NULL,
+                                              VAR_DOMAIN, (int *) NULL,
                                               (struct symtab **) NULL);
                          if (sym == 0)
                            error ("No symbol \"%s\" in specified context.",
@@ -712,7 +705,7 @@ variable:   qualified_name
 
                          sym =
                            lookup_symbol (name, (const struct block *) NULL,
-                                          VAR_NAMESPACE, (int *) NULL,
+                                          VAR_DOMAIN, (int *) NULL,
                                           (struct symtab **) NULL);
                          if (sym)
                            {
@@ -767,8 +760,8 @@ variable:   name_not_typename
                              if (innermost_block == 0 || 
                                  contained_in (block_found, innermost_block))
                                innermost_block = block_found;
-                             write_exp_elt_opcode (OP_SELF);
-                             write_exp_elt_opcode (OP_SELF);
+                             write_exp_elt_opcode (OP_OBJC_SELF);
+                             write_exp_elt_opcode (OP_OBJC_SELF);
                              write_exp_elt_opcode (STRUCTOP_PTR);
                              write_exp_string ($1.stoken);
                              write_exp_elt_opcode (STRUCTOP_PTR);
@@ -853,7 +846,7 @@ array_mod:  '[' ']'
 func_mod:      '(' ')'
                        { $$ = 0; }
        |       '(' nonempty_typelist ')'
-                       { free ((PTR)$2); $$ = 0; }
+                       { free ($2); $$ = 0; }
        ;
 
 /* We used to try to recognize more pointer to member types here, but
@@ -986,7 +979,7 @@ name_not_typename : NAME
    name_not_typename (=variable, =exp) or just an exp.  If
    name_not_typename was ever used in an lvalue context where only a
    name could occur, this might be useful.  */
-       | NAME_OR_INT */
+/*     | NAME_OR_INT */
        ;
 
 %%
@@ -1033,9 +1026,9 @@ parse_number (p, len, parsed_float, putithere)
       /* It's a float since it contains a point or an exponent.  */
 
       if (sizeof (putithere->typed_val_float.dval) <= sizeof (float))
-       sscanf (p, "%g", &putithere->typed_val_float.dval);
+       sscanf (p, "%g", (float *)&putithere->typed_val_float.dval);
       else if (sizeof (putithere->typed_val_float.dval) <= sizeof (double))
-       sscanf (p, "%lg", &putithere->typed_val_float.dval);
+       sscanf (p, "%lg", (double *)&putithere->typed_val_float.dval);
       else
        {
 #ifdef PRINTF_HAS_LONG_DOUBLE
@@ -1288,6 +1281,7 @@ yylex ()
        return tokentab2[i].token;
       }
 
+  c = 0;
   switch (tokchr = *tokstart)
     {
     case 0:
@@ -1316,9 +1310,7 @@ yylex ()
       c = *lexptr++;
       if (c != '\'')
        {
-         namelen = skip_quoted (tokstart, 
-                                get_gdb_completer_word_break_characters())
-           - tokstart;
+         namelen = skip_quoted (tokstart) - tokstart;
          if (namelen > 2)
            {
              lexptr = tokstart + namelen;
@@ -1631,18 +1623,6 @@ yylex ()
        return ENUM;
       if (STREQN (tokstart, "long", 4))
        return LONG;
-      if (current_language->la_language == language_cplus
-         && STREQN (tokstart, "this", 4))
-       {
-         static const char this_name[] = {
-           CPLUS_MARKER, 't', 'h', 'i', 's', '\0' 
-         };
-
-         if (lookup_symbol (this_name, expression_context_block,
-                            VAR_NAMESPACE, (int *) NULL,
-                            (struct symtab **) NULL))
-           return THIS;
-       }
       break;
     case 3:
       if (STREQN (tokstart, "int", 3))
@@ -1679,7 +1659,7 @@ yylex ()
       need_this = (int *) NULL;
 
     sym = lookup_symbol (tmp, expression_context_block,
-                        VAR_NAMESPACE,
+                        VAR_DOMAIN,
                         need_this,
                         (struct symtab **) NULL);
     /* Call lookup_symtab, not lookup_partial_symtab, in case there
@@ -1758,7 +1738,7 @@ yylex ()
                      tmp1[p - namestart] = '\0';
                      cur_sym = lookup_symbol (ncopy, 
                                               expression_context_block,
-                                              VAR_NAMESPACE, (int *) NULL,
+                                              VAR_DOMAIN, (int *) NULL,
                                               (struct symtab **) NULL);
                      if (cur_sym)
                        {
@@ -1795,7 +1775,6 @@ yylex ()
        CORE_ADDR Class = lookup_objc_class(tmp);
        if (Class)
          {
-           extern struct symbol *lookup_struct_typedef();
            yylval.class.class = Class;
            if ((sym = lookup_struct_typedef (tmp, 
                                              expression_context_block, 
This page took 0.027023 seconds and 4 git commands to generate.