编辑器
添加xml语法高亮
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user