parent
4a7e770bf9
commit
c8d44c6756
|
|
@ -1873,6 +1873,7 @@ type TEditer=class(TCustomcontrol) //
|
|||
FSynClasses["json"]:= array(class(TJsonSynHighLighter),class(TSynCompletion),";json;");
|
||||
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["ini"]:= array(class(TINISynHigLighter),class(TSynCompletion),";ini;");
|
||||
FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;");
|
||||
FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;");
|
||||
|
|
|
|||
|
|
@ -1388,6 +1388,45 @@ type TJsonSynHighLighter = class(tcustomsynhighlighter)
|
|||
ExecuteCommand("pairs",array(("{","}"),("[","]")));
|
||||
end
|
||||
|
||||
end
|
||||
type TxmlSynHighLighter = class(tcustomsynhighlighter)
|
||||
function create(AOwner);
|
||||
begin
|
||||
inherited;
|
||||
ExecuteCommand("strings",array(('"'),("'")));
|
||||
ExecuteCommand("keywords",array());
|
||||
ExecuteCommand("rowannotes",array());
|
||||
ExecuteCommand("blockannotes",array(("<!--","-->")));
|
||||
ExecuteCommand("syms",array("<",">","=","?","</"));
|
||||
ExecuteCommand("pairs",array(("<",">"),("</",">")));
|
||||
end
|
||||
function SetTToken(tokens,ttk,idx,ext);override;
|
||||
begin
|
||||
st := ExecuteCommand("getcurrentpairstate",">");
|
||||
st1 := st.state;
|
||||
d := inherited;
|
||||
if not d then return ;
|
||||
if st1=1 and st.state=1 then
|
||||
begin
|
||||
st.subitemadd();
|
||||
case d.FFColor of
|
||||
stringcolor,symcolor:
|
||||
begin
|
||||
end else
|
||||
begin
|
||||
if st.subitemcount()>1 then
|
||||
begin
|
||||
d.FFColor := 0x0000ff;
|
||||
end else
|
||||
d.FFColor := 0xff0000;
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
return d;
|
||||
//echo "\r\n>>>",st1,"====",st2;
|
||||
end
|
||||
|
||||
end
|
||||
type TJsSynHighLighter = class(tcustomsynhighlighter)
|
||||
function create(AOwner);
|
||||
|
|
|
|||
|
|
@ -3149,20 +3149,20 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
fregs := array();
|
||||
setkeyword(array("null","true","false","goto","break","for","to","while","do"));
|
||||
setblockannote(array(
|
||||
("/*","*/"),
|
||||
));
|
||||
("/*","*/"),
|
||||
));
|
||||
setrowannote(array("//"));
|
||||
setsyms(array("+","-","*","/",";","(",")","{","}",":"));
|
||||
setstring(array(
|
||||
("'","\\"),
|
||||
('"',"\\"),
|
||||
));
|
||||
("'","\\"),
|
||||
('"',"\\"),
|
||||
));
|
||||
setpairs(array(
|
||||
("(",")"),
|
||||
("[","]"),
|
||||
("{","}"),
|
||||
));
|
||||
setsysfun(array());
|
||||
("(",")"),
|
||||
("[","]"),
|
||||
("{","}"),
|
||||
));
|
||||
setsysfun(array());
|
||||
clean();
|
||||
end
|
||||
function ExecuteCommand(cmd,pm);override;
|
||||
|
|
@ -3205,6 +3205,14 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
begin
|
||||
return setregs(pm);
|
||||
end
|
||||
"getcurrentpairstate":
|
||||
begin
|
||||
if fcbgestate then
|
||||
begin
|
||||
return fcbgestate[pm];
|
||||
end
|
||||
return nil;
|
||||
end
|
||||
end ;
|
||||
return inherited;
|
||||
end
|
||||
|
|
@ -3243,7 +3251,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
FSatesCount := i+1;
|
||||
FTokens[i]:= tks;
|
||||
end
|
||||
end
|
||||
end
|
||||
function GetLineTokens(idx);override;
|
||||
begin
|
||||
if idx<FSatesCount then return FTokens[idx];
|
||||
|
|
@ -3377,7 +3385,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
end
|
||||
end
|
||||
d.FMATe := st.GetSate();
|
||||
end
|
||||
end
|
||||
end
|
||||
function ParserTokenLines(s,b,e,cst,tokens); //½âÎö×Ö·û
|
||||
begin
|
||||
|
|
@ -3439,8 +3447,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
if b>e then return cst;
|
||||
if ifarray(cst) and (cst[0]="str" or cst[0]="annote") then
|
||||
begin
|
||||
cst1 := cst[1];
|
||||
cstL := length(cst1);
|
||||
|
||||
r := FindRightChar(cst[2],s,b,e,cst[3]);
|
||||
if r=0 then //ûÕÒµ½
|
||||
begin
|
||||
|
|
@ -3453,6 +3460,15 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
begin
|
||||
Setttoken(tokens,s[b:r-1],r-1,cst);
|
||||
end
|
||||
|
||||
if cst[0]="annote" then
|
||||
begin
|
||||
cstL := fblockstiresc[cst[1]];
|
||||
end else
|
||||
begin
|
||||
cst1 := cst[1];
|
||||
cstL := length(cst1);
|
||||
end
|
||||
Setttoken(tokens,s[r:(r-1+cstL)],(r-1+cstL),cst);
|
||||
if r<e then
|
||||
begin
|
||||
|
|
@ -3498,6 +3514,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
begin
|
||||
fblockstiresa := array();
|
||||
fblockstiresb := array();
|
||||
fblockstiresc := array();
|
||||
for i,v in d do
|
||||
begin
|
||||
if not ifarray(d) then continue ;
|
||||
|
|
@ -3510,7 +3527,8 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
fblockstiresa[v0] := st;
|
||||
st := new TTire();
|
||||
st.add(v1);
|
||||
fblockstiresb[v0] := st;
|
||||
fblockstiresb[v0] := st;
|
||||
fblockstiresc[v0] := length(v1);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -3680,6 +3698,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
frowstires;
|
||||
fblockstiresa;
|
||||
fblockstiresb;
|
||||
fblockstiresc;
|
||||
fregs;
|
||||
/////
|
||||
fkeywordcolor;
|
||||
|
|
|
|||
|
|
@ -1827,6 +1827,15 @@ type tpairstate =class //
|
|||
FIndexs := array(0);
|
||||
FIndex := 0;
|
||||
FCstate := false;
|
||||
FSubcount := array(0);
|
||||
end
|
||||
function subitemadd();
|
||||
begin
|
||||
FSubcount[FIndex]++;
|
||||
end
|
||||
function subitemcount();
|
||||
begin
|
||||
return FSubcount[FIndex];
|
||||
end
|
||||
function GetLeft();
|
||||
begin
|
||||
|
|
@ -1837,9 +1846,9 @@ type tpairstate =class //
|
|||
FIndex++;
|
||||
FIndexs[FIndex]:=0;
|
||||
end else //上一个非左括号
|
||||
begin
|
||||
|
||||
begin
|
||||
FIndexs[FIndex]++;
|
||||
FSubcount[FIndex]:=0;
|
||||
end
|
||||
FState := true;
|
||||
end
|
||||
|
|
@ -1886,6 +1895,7 @@ type tpairstate =class //
|
|||
r.FCJ := FCJ;
|
||||
r.FIndexs := FIndexs;
|
||||
r.FIndex := FIndex;
|
||||
r.FSubcount := FSubcount;
|
||||
return r;
|
||||
end
|
||||
protected
|
||||
|
|
@ -1893,6 +1903,7 @@ type tpairstate =class //
|
|||
FState;
|
||||
FCJ;
|
||||
FIndexs;
|
||||
FSubcount;
|
||||
FIndex;
|
||||
FType;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue