From 5fa81d43dbc36610310e394ddc73c94d8d2ab24f Mon Sep 17 00:00:00 2001 From: JianjunLiu Date: Tue, 21 Mar 2023 16:46:20 +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 添加简单的html支持 --- designer/utslcodeeditor.tsf | 1 + designer/utslsynmemo.tsf | 31 +++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/designer/utslcodeeditor.tsf b/designer/utslcodeeditor.tsf index 117287a..efc7e78 100644 --- a/designer/utslcodeeditor.tsf +++ b/designer/utslcodeeditor.tsf @@ -1874,6 +1874,7 @@ type TEditer=class(TCustomcontrol) // FSynClasses["js"]:= array(class(TJsSynHighLighter),class(tjssyncompletion),";js;"); FSynClasses["css"]:= array(class(TcssSynHighLighter),class(tcsssyncompletion),";css;"); FSynClasses["xml"]:= array(class(TxmlSynHighLighter),class(tcsssyncompletion),";xml;"); + FSynClasses["html"]:= array(class(ThtmlSynHighLighter),class(tcsssyncompletion),";html;"); FSynClasses["ini"]:= array(class(TINISynHigLighter),class(TSynCompletion),";ini;"); FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;"); FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;"); diff --git a/designer/utslsynmemo.tsf b/designer/utslsynmemo.tsf index f1cc720..8d228fa 100644 --- a/designer/utslsynmemo.tsf +++ b/designer/utslsynmemo.tsf @@ -359,9 +359,23 @@ type TTslSynHighLighter = class(TSynHighLighter) fpairbegin; public hightercolor; + fforcehtml; + function forcehtml(h); + begin + if h then + begin + fforcehtml := true; + FSynBranch := "tslx"; + end else + begin + fforcehtml := false; + FSynBranch := 0; + end + end function Create(AOwner); begin inherited; + fforcehtml := 0; fpairbegin := array("select":1,"sselect":1,"update":1,"mselect":1,"vselect":1,"try":1,"begin":1,"type":1,"case":1); FSynBranch := 0;// 0, "tsl" "tslx" Clean(); @@ -414,7 +428,11 @@ type TTslSynHighLighter = class(TSynHighLighter) // { ' " %% 0 FTokens := array(); FSates := array(0); //״̬ - FSynSates := array(0); + if fforcehtml then + begin + FSynSates := array("tslx"); + end else + FSynSates := array(0); FBBStates := array(new TBBState(")")); FBEStates := array(new TBBState("end")); FMBStates := array(new TBBState("]")); @@ -703,7 +721,7 @@ type TTslSynHighLighter = class(TSynHighLighter) end else if vi="<" then begin - if idx+4<=e and s[idx+1]="?" and lowercase(s[idx+2:idx+4])="tsl" then + if not(fforcehtml) and idx+4<=e and s[idx+1]="?" and lowercase(s[idx+2:idx+4])="tsl" then begin if (idx+4=e) or(s[idx+5] in array(" ","\t")) then //β begin @@ -1265,6 +1283,15 @@ type TTslSynHighLighter = class(TSynHighLighter) FSynBranch; end +type ThtmlSynHighLighter = class(TTslSynHighLighter) + function Create(AOwner); + begin + inherited; + forcehtml(1); + Clean(); + end + +end type TBatSynHigLighter = class(TSynHighLighter) function Create(AOwner); begin