From 92d65037043fa73dc9783eef4200d97d48c2a86d Mon Sep 17 00:00:00 2001 From: paul Date: Wed, 22 Dec 2010 02:01:40 +0000 Subject: [PATCH] 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 - --- compiler/htypechk.pas | 16 ++++++++-------- compiler/pdecl.pas | 16 ++++++++-------- compiler/pdecsub.pas | 12 ++++++------ compiler/pdecvar.pas | 6 +++--- compiler/pexpr.pas | 8 ++++---- compiler/ptype.pas | 2 +- compiler/scanner.pas | 18 +++++++++--------- compiler/tokens.pas | 4 ++-- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/compiler/htypechk.pas b/compiler/htypechk.pas index 3551fdf930..18102676dd 100644 --- a/compiler/htypechk.pas +++ b/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; diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index dd73e32e22..2033e0f438 100644 --- a/compiler/pdecl.pas +++ b/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; diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index a9d8a2669b..508dc166a1 100644 --- a/compiler/pdecsub.pas +++ b/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 . } 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 diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index cbd8b1cac0..ab8ab8caad 100644 --- a/compiler/pdecvar.pas +++ b/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 diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index 4efb0521ec..d2240dd4c9 100644 --- a/compiler/pexpr.pas +++ b/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; diff --git a/compiler/ptype.pas b/compiler/ptype.pas index 709986501e..b5a6f298f9 100644 --- a/compiler/ptype.pas +++ b/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; diff --git a/compiler/scanner.pas b/compiler/scanner.pas index cfa925c113..55ce11fa54 100644 --- a/compiler/scanner.pas +++ b/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:=l1hs2; _LT : b:=hs1' : 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 diff --git a/compiler/tokens.pas b/compiler/tokens.pas index 9e911c1f16..f4377426bf 100644 --- a/compiler/tokens.pas +++ b/compiler/tokens.pas @@ -34,12 +34,12 @@ type _MINUS, _STAR, _SLASH, - _EQUAL, + _EQ, _GT, _LT, _GTE, _LTE, - _UNEQUAL, + _NE, _SYMDIF, _STARSTAR, _OP_AS,