X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fshared%2Fexoma.pas;h=b6f66bda1c3b6a505412265cdff8b5ada730607d;hb=ded89321df07e3f5832331127637375840c25e6f;hp=8616b7ba21d138914aaf2f109b91c7669799f7ef;hpb=2e74c901511298e44d168948d85e9cff009fcb7e;p=d2df-sdl.git diff --git a/src/shared/exoma.pas b/src/shared/exoma.pas index 8616b7b..b6f66bd 100644 --- a/src/shared/exoma.pas +++ b/src/shared/exoma.pas @@ -1,4 +1,4 @@ -(* Copyright (C) DooM 2D:Forever Developers +(* Copyright (C) Doom 2D: Forever Developers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,9 @@ unit exoma; interface uses - typinfo, SysUtils, Variants, hashtable, xparser; + {$IFDEF USE_MEMPOOL}mempool,{$ENDIF} + typinfo, SysUtils, Variants, + hashtable, xparser; // ////////////////////////////////////////////////////////////////////////// // @@ -41,7 +43,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TPropHash = class + TPropHash = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} private mClass: TClass; mNames: THashStrInt; @@ -59,7 +61,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TExprConstList = class + TExprConstList = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public function valid (const cname: AnsiString): Boolean; virtual; abstract; function get (const cname: AnsiString; out v: Variant): Boolean; virtual; abstract; @@ -68,7 +70,7 @@ type // ////////////////////////////////////////////////////////////////////////// // type - TExprScope = class + TExprScope = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public class procedure error (const amsg: AnsiString); class procedure errorfmt (const afmt: AnsiString; const args: array of const); @@ -78,7 +80,7 @@ type procedure setField (obj: TObject; const afldname: AnsiString; var aval: Variant); virtual; end; - TExprBase = class + TExprBase = class{$IFDEF USE_MEMPOOL}(TPoolObject){$ENDIF} public class function coerce2bool (var v0: Variant): Boolean; class function toInt (var v: Variant): LongInt; @@ -345,7 +347,7 @@ var n: AnsiString; begin mClass := aklass; - mNames := hashNewStrInt(); + mNames := THashStrInt.Create(); pi := aklass.ClassInfo; pt := GetTypeData(pi); GetMem(pl, pt^.PropCount*sizeof(Pointer)); @@ -931,7 +933,7 @@ begin try while true do begin - while pr.eatTT(pr.TTSemi) do begin end; + while pr.eatDelim(';') do begin end; if (pr.tokType = pr.TTEOF) then break; e := parse(clist, pr, true); if (e = nil) then break; @@ -940,7 +942,7 @@ begin if (pr.tokType = pr.TTEOF) then break; //writeln('tt=', pr.tokType, ' <', pr.tokStr, '>'); //writeln(r.toString()); - pr.expectTT(pr.TTSemi); + pr.expectDelim(';'); end; result := r; r := nil; @@ -1130,7 +1132,7 @@ class function TExprBase.parse (clist: TExprConstList; pr: TTextParser; allowAss e := doLogOr(); if neg then e := TUnExprNeg.Create(e); if allowAssign and pr.eatDelim('=') then e := TBinAssign.Create(e, expr()); - if not pr.eatTT(pr.TTComma) then + if not pr.eatDelim(',') then begin if (result = nil) then result := e else list.append(e); break; @@ -1162,7 +1164,7 @@ class function TExprBase.parse (clist: TExprConstList; pr: TTextParser; allowAss c.mCond := result; try c.mTrue := expr(); - pr.expectTT(pr.TTColon); + pr.expectDelim(':'); c.mFalse := expr(); result := c; except @@ -1172,16 +1174,16 @@ class function TExprBase.parse (clist: TExprConstList; pr: TTextParser; allowAss end; var - oas: Boolean; + oas: TTextParser.TOptions; begin if (pr = nil) or (pr.tokType = pr.TTEOF) then begin result := nil; exit; end; - oas := pr.allowSignedNumbers; + oas := pr.options; try - pr.allowSignedNumbers := false; + pr.options := pr.options-[pr.TOption.SignedNumbers]; try result := expr(); finally - pr.allowSignedNumbers := oas; + pr.options := oas; end; except on e: TExomaException do