* remote.c (minitelnet): Don't redeclare escape_count, echo_check.
[binutils-gdb.git] / gdb / objc-exp.y
index 54b99b00610d977fe3ab4f3a0c897a53a19e241a..002600de9cb2516309a484e7413084d24244cb9d 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)
@@ -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))