Browse Source

compiler: rename _EQUAL token to _EQ to prevent problems with adding delphi operator names which contains "EQUAL" name, also rename _UNEQUAL to _NE for consistency

git-svn-id: trunk@16608 -
paul 14 years ago
parent
commit
92d6503704

+ 8 - 8
compiler/htypechk.pas

@@ -101,7 +101,7 @@ interface
         (tok:_MINUS     ;nod:subn;op_overloading_supported:true),      { binary and unary overloading supported }
         (tok:_STAR      ;nod:muln;op_overloading_supported:true),      { binary overloading supported }
         (tok:_SLASH     ;nod:slashn;op_overloading_supported:true),    { binary overloading supported }
-        (tok:_EQUAL     ;nod:equaln;op_overloading_supported:true),    { binary overloading supported }
+        (tok:_EQ        ;nod:equaln;op_overloading_supported:true),    { binary overloading supported }
         (tok:_GT        ;nod:gtn;op_overloading_supported:true),       { binary overloading supported }
         (tok:_LT        ;nod:ltn;op_overloading_supported:true),       { binary overloading supported }
         (tok:_GTE       ;nod:gten;op_overloading_supported:true),      { binary overloading supported }
@@ -120,7 +120,7 @@ interface
         (tok:_OP_SHR    ;nod:shrn;op_overloading_supported:true),      { binary overloading supported }
         (tok:_OP_XOR    ;nod:xorn;op_overloading_supported:true),      { binary overloading supported }
         (tok:_ASSIGNMENT;nod:assignn;op_overloading_supported:true),   { unary overloading supported }
-        (tok:_UNEQUAL   ;nod:unequaln;op_overloading_supported:true)   { binary overloading supported }
+        (tok:_NE        ;nod:unequaln;op_overloading_supported:true)   { binary overloading supported }
       );
 
       { true, if we are parsing stuff which allows array constructors }
@@ -648,9 +648,9 @@ implementation
 
         case t.nodetype of
            equaln:
-             optoken:=_EQUAL;
+             optoken:=_EQ;
            unequaln:
-             optoken:=_UNEQUAL;
+             optoken:=_NE;
            addn:
              optoken:=_PLUS;
            subn:
@@ -693,14 +693,14 @@ implementation
              end;
         end;
 
-        cand_cnt:=search_operator(optoken,optoken<>_UNEQUAL);
+        cand_cnt:=search_operator(optoken,optoken<>_NE);
 
         { no operator found for "<>" then search for "=" operator }
-        if (cand_cnt=0) and (optoken=_UNEQUAL) then
+        if (cand_cnt=0) and (optoken=_NE) then
           begin
             ppn.free;
             operpd:=nil;
-            optoken:=_EQUAL;
+            optoken:=_EQ;
             cand_cnt:=search_operator(optoken,true);
           end;
 
@@ -723,7 +723,7 @@ implementation
 
         { if we found "=" operator for "<>" expression then use it
           together with "not" }
-        if (t.nodetype=unequaln) and (optoken=_EQUAL) then
+        if (t.nodetype=unequaln) and (optoken=_EQ) then
           ht:=cnotnode.create(ht);
         t:=ht;
       end;

+ 8 - 8
compiler/pdecl.pas

@@ -184,9 +184,9 @@ implementation
            consume(_ID);
            case token of
 
-             _EQUAL:
+             _EQ:
                 begin
-                   consume(_EQUAL);
+                   consume(_EQ);
                    sym:=readconstant(orgname,filepos);
                    { Support hint directives }
                    dummysymoptions:=[];
@@ -271,7 +271,7 @@ implementation
                    if not skipequal then
                     begin
                       { get init value }
-                      consume(_EQUAL);
+                      consume(_EQ);
                       if (cs_typed_const_writable in current_settings.localswitches) then
                         tclist:=current_asmdata.asmlists[al_rotypedconsts]
                       else
@@ -282,7 +282,7 @@ implementation
 
               else
                 { generate an error }
-                consume(_EQUAL);
+                consume(_EQ);
            end;
          until (token<>_ID)or(in_structure and (idtoken in [_PRIVATE,_PROTECTED,_PUBLIC,_PUBLISHED,_STRICT]));
          block_type:=old_block_type;
@@ -478,7 +478,7 @@ implementation
                consume(_RSHARPBRACKET);
              end;
 
-           consume(_EQUAL);
+           consume(_EQ);
 
            { support 'ttype=type word' syntax }
            isunique:=try_to_consume(_TYPE);
@@ -770,9 +770,9 @@ implementation
            filepos:=current_tokenpos;
            consume(_ID);
            case token of
-             _EQUAL:
+             _EQ:
                 begin
-                   consume(_EQUAL);
+                   consume(_EQ);
                    p:=comp_expr(true,false);
                    storetokenpos:=current_tokenpos;
                    current_tokenpos:=filepos;
@@ -816,7 +816,7 @@ implementation
                    consume(_SEMICOLON);
                    p.free;
                 end;
-              else consume(_EQUAL);
+              else consume(_EQ);
            end;
          until token<>_ID;
          block_type:=old_block_type;

+ 6 - 6
compiler/pdecsub.pas

@@ -705,7 +705,7 @@ implementation
                 { default parameter }
                 if (m_default_para in current_settings.modeswitches) then
                  begin
-                   if try_to_consume(_EQUAL) then
+                   if try_to_consume(_EQ) then
                     begin
                       vs:=tparavarsym(sc[0]);
                       if sc.count>1 then
@@ -855,7 +855,7 @@ implementation
            consume(_ID);
            { Create unique name <interface>.<method> }
            hs:=sp+'.'+pattern;
-           consume(_EQUAL);
+           consume(_EQ);
            if assigned(ImplIntf) and
               (token=_ID) then
              ImplIntf.AddMapping(hs,pattern);
@@ -1315,7 +1315,7 @@ implementation
                   else
                    begin
                      single_type(pd.returndef,false,false);
-                     if (optoken in [_EQUAL,_UNEQUAL,_GT,_LT,_GTE,_LTE]) and
+                     if (optoken in [_EQ,_NE,_GT,_LT,_GTE,_LTE]) and
                         ((pd.returndef.typ<>orddef) or
                          (torddef(pd.returndef).ordtype<>pasbool)) then
                         Message(parser_e_comparative_operator_return_boolean);
@@ -2810,12 +2810,12 @@ const
               res:=parse_proc_direc(pd,pdflags);
             end;
            { A procedure directive normally followed by a semicolon, but in
-             a const section or reading a type we should stop when _EQUAL is found,
+             a const section or reading a type we should stop when _EQ is found,
              because a constant/default value follows }
            if res then
             begin
               if (block_type=bt_const_type) and
-                 (token=_EQUAL) then
+                 (token=_EQ) then
                break;
               { support procedure proc;stdcall export; }
               if not(check_proc_directive((pd.typ=procvardef))) then
@@ -2823,7 +2823,7 @@ const
                   { support "record p : procedure stdcall end;" and
                     "var p : procedure stdcall = nil;" }
                   if (pd_procvar in pdflags) and
-                     (token in [_END,_RKLAMMER,_EQUAL]) then
+                     (token in [_END,_RKLAMMER,_EQ]) then
                     break
                   else
                     begin

+ 3 - 3
compiler/pdecvar.pas

@@ -1010,7 +1010,7 @@ implementation
             Message(parser_e_initialized_only_one_var);
           if vo_is_thread_var in vs.varoptions then
             Message(parser_e_initialized_not_for_threadvar);
-          consume(_EQUAL);
+          consume(_EQ);
           case vs.typ of
             localvarsym :
               begin
@@ -1299,7 +1299,7 @@ implementation
 
              { Handling of Delphi typed const = initialized vars }
              if allowdefaultvalue and
-                (token=_EQUAL) and
+                (token=_EQ) and
                 not(m_tp7 in current_settings.modeswitches) and
                 (symtablestack.top.symtabletype<>parasymtable) then
                begin
@@ -1326,7 +1326,7 @@ implementation
                  { Add calling convention for procvar }
                  handle_calling_convention(tprocvardef(hdef));
                  { Handling of Delphi typed const = initialized vars }
-                 if (token=_EQUAL) and
+                 if (token=_EQ) and
                     not(m_tp7 in current_settings.modeswitches) and
                     (symtablestack.top.symtabletype<>parasymtable) then
                    begin

+ 4 - 4
compiler/pexpr.pas

@@ -2787,7 +2787,7 @@ implementation
    const
       { Warning these stay be ordered !! }
       operator_levels:array[Toperator_precedence] of set of Ttoken=
-         ([_LT,_LTE,_GT,_GTE,_EQUAL,_UNEQUAL,_OP_IN],
+         ([_LT,_LTE,_GT,_GTE,_EQ,_NE,_OP_IN],
           [_PLUS,_MINUS,_OP_OR,_PIPE,_OP_XOR],
           [_CARET,_SYMDIF,_STARSTAR,_STAR,_SLASH,
            _OP_AS,_OP_IS,_OP_AND,_AMPERSAND,_OP_DIV,_OP_MOD,_OP_SHL,_OP_SHR],
@@ -2808,7 +2808,7 @@ implementation
           p1:=sub_expr(succ(pred_level),true,typeonly);
         repeat
           if (token in operator_levels[pred_level]) and
-             ((token<>_EQUAL) or accept_equal) then
+             ((token<>_EQ) or accept_equal) then
            begin
              oldt:=token;
              filepos:=current_tokenpos;
@@ -2826,7 +2826,7 @@ implementation
                  p1:=caddnode.create(muln,p1,p2);
                _SLASH :
                  p1:=caddnode.create(slashn,p1,p2);
-               _EQUAL :
+               _EQ:
                  p1:=caddnode.create(equaln,p1,p2);
                _GT :
                  p1:=caddnode.create(gtn,p1,p2);
@@ -2874,7 +2874,7 @@ implementation
                  p1:=caddnode.create(xorn,p1,p2);
                _ASSIGNMENT :
                  p1:=cassignmentnode.create(p1,p2);
-               _UNEQUAL :
+               _NE :
                  p1:=caddnode.create(unequaln,p1,p2);
              end;
              p1.fileinfo:=filepos;

+ 1 - 1
compiler/ptype.pas

@@ -1207,7 +1207,7 @@ implementation
                         with previous 1.0.x versions }
                       ((m_fpc in current_settings.modeswitches) and
                        try_to_consume(_ASSIGNMENT)) or
-                      try_to_consume(_EQUAL)
+                      try_to_consume(_EQ)
                      ) then
                     begin
                        oldlocalswitches:=current_settings.localswitches;

+ 9 - 9
compiler/scanner.pas

@@ -1303,7 +1303,7 @@ In case not, the value returned can be arbitrary.
            op:=current_scanner.preproc_token;
            if (op = _ID) and (current_scanner.preproc_pattern = 'IN') then
              op := _IN;
-           if not (op in [_IN,_EQUAL,_UNEQUAL,_LT,_GT,_LTE,_GTE]) then
+           if not (op in [_IN,_EQ,_NE,_LT,_GT,_LTE,_GTE]) then
              begin
                 read_expr:=hs1;
                 exit;
@@ -1341,9 +1341,9 @@ In case not, the value returned can be arbitrary.
                        val(hs1,l1,w);
                        val(hs2,l2,w);
                        case op of
-                         _EQUAL :
+                         _EQ :
                            b:=l1=l2;
-                         _UNEQUAL :
+                         _NE :
                            b:=l1<>l2;
                          _LT :
                            b:=l1<l2;
@@ -1358,9 +1358,9 @@ In case not, the value returned can be arbitrary.
                    else
                      begin
                        case op of
-                         _EQUAL :
+                         _EQ:
                            b:=hs1=hs2;
-                         _UNEQUAL :
+                         _NE :
                            b:=hs1<>hs2;
                          _LT :
                            b:=hs1<hs2;
@@ -3728,7 +3728,7 @@ In case not, the value returned can be arbitrary.
              '=' :
                begin
                  readchar;
-                 token:=_EQUAL;
+                 token:=_EQ;
                  goto exit_label;
                end;
 
@@ -4050,7 +4050,7 @@ In case not, the value returned can be arbitrary.
                        '>' :
                          begin
                            readchar;
-                           token:=_UNEQUAL;
+                           token:=_NE;
                            goto exit_label;
                          end;
                        '=' :
@@ -4169,7 +4169,7 @@ exit_label:
            '=' :
              begin
                readchar;
-               readpreproc:=_EQUAL;
+               readpreproc:=_EQ;
              end;
            '>' :
              begin
@@ -4189,7 +4189,7 @@ exit_label:
                  '>' :
                    begin
                      readchar;
-                     readpreproc:=_UNEQUAL;
+                     readpreproc:=_NE;
                    end;
                  '=' :
                    begin

+ 2 - 2
compiler/tokens.pas

@@ -34,12 +34,12 @@ type
     _MINUS,
     _STAR,
     _SLASH,
-    _EQUAL,
+    _EQ,
     _GT,
     _LT,
     _GTE,
     _LTE,
-    _UNEQUAL,
+    _NE,
     _SYMDIF,
     _STARSTAR,
     _OP_AS,