From 8cd8af1f0669c212b580455e778a8318395ffc37 Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Wed, 21 Sep 2022 15:00:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化tsl语法解析 --- designer/utslsynmemo.tsf | 53 ++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index 430e50b..3d87c68 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -4,7 +4,6 @@ interface @explan(˵) tsl﷨༭ **} uses utslvclauxiliary,UTslMemo; -function FileSaveThreader(o,d); type TTSLCompletion= class(TSynCompletion) {** @explan(˵) tslʾԶ @@ -1266,7 +1265,7 @@ type TBBState =class(tpairstate) // inherited; end end -type TTsfFileParser = class //ļ +type TTsfFileParser = class() //ļ private fiofs; public @@ -1276,7 +1275,6 @@ type TTsfFileParser = class // fiofs := ioFileseparator(); FCacheDir :=TS_GetUserProfileHome()+"TslSynMemo"+fiofs+"cmpCaches";// d["value"]; //FCacheAbsFileName := FCacheDir+"\\cacheabstruct.stm"; - //FFileWorker := new TThreadWorker("this.OnMessage :=findfunction('UTslSynMemo.FileSaveThreader') ;"); FFindDirs := array(); end function DispatchMethod(o,d);//ַϢ @@ -1623,7 +1621,6 @@ type TTsfFileParser = class // end function ParserFindDir(f); // begin - //mtic; if FCacheDir then begin FFileNames := array(); @@ -1651,7 +1648,7 @@ type TTsfFileParser = class // begin if FCacheDir then begin - return ReadParseredFile(n+".tsf"); + return ReadParseredFile((n+".tsf"),true); end end function parserafile(dir,v); @@ -1703,12 +1700,11 @@ type TTsfFileParser = class // end end function ParserFiles(dir,FFileNames,mf); - begin + begin dirs := FileList("",dir+fiofs+"*"); for i,v in dirs do begin fn := v["FileName"] ; - if not(pos("D",v["Attr"])) and (1=ParseRegExpr("\\.tsf$",fn,"i",m,mp,ml)) then //tsfļ begin parserafile(dir,v); @@ -1749,7 +1745,7 @@ type TTsfFileParser = class // if importfile(ftstream(),"",fn,d)=1 then return d; end end - function ReadParseredFile(n); //ȡļ + function ReadParseredFile(n,g); //ȡļ begin if FCacheDir then begin @@ -1760,14 +1756,16 @@ type TTsfFileParser = class // if d then begin FFilePaths[lowercase(n)] := d["fullpath"]; - return d; + if g then return d; + return 1; end fn := FCacheDir+fiofs+ModifyFname(n)+".p"; if importfile(ftstream(),"",fn,d)=1 and ifarray(d) then begin - FCacheS[lowercase(n)] := r;//new tparserdobject(d); + FCacheS[lowercase(n)] := d;//new tparserdobject(d); FFilePaths[lowercase(n)] := d["fullpath"]; - return d; + if g then return d; + return 1; end end end @@ -1779,14 +1777,20 @@ type TTsfFileParser = class // FFinddirsseted := true; if ifarray(d) and d then begin + cl := FFindDirs?true:falsse; FFindDirs := d; - ClearCache(); + ClearCache(cl); end return r; end - function ClearCache(); //ջ + function ClearCache(cl); //ջ begin - DeleteAllFiles(FCacheDir); + if cl then + begin + DeleteAllFiles(FCacheDir); + end + FFileNames := array(); + FFilePaths := array(); FCacheS := array(); end function filechanged(d); @@ -1806,21 +1810,12 @@ type TTsfFileParser = class // FFindDirs; //Ŀ¼ fmsgcaches; -end -function FileSaveThreader(o,d); -begin - if not ifarray(d) then return ; - m := d["method"]; - f := d["file"]; - c := d["content"]; - if (m="exportfile") and ifstring(f) and f then - begin - exportfile(ftstream(),"",f,c); + function errtslcode(s); //ж function procedureβ㲻 + begin + return 0; + return 0; end end -function errtslcode(s); //ж function procedureβ㲻 -begin - return 0; - return 0; -end + + end. \ No newline at end of file