parent
dc98618d53
commit
029ead93cd
|
|
@ -1831,6 +1831,7 @@ type TEditer=class(TCustomcontrol) //
|
||||||
FSynClasses["txt"]:= array(class(TSynHighLighter),class(TSynCompletion),";txt;");
|
FSynClasses["txt"]:= array(class(TSynHighLighter),class(TSynCompletion),";txt;");
|
||||||
FSynClasses["tsl"]:= array(class(TTslSynHighLighter),class(TTslCompletion),";tsl;tsf;pas;stm;");
|
FSynClasses["tsl"]:= array(class(TTslSynHighLighter),class(TTslCompletion),";tsl;tsf;pas;stm;");
|
||||||
FSynClasses["json"]:= array(class(TJsonSynHighLighter),class(TSynCompletion),";json;");
|
FSynClasses["json"]:= array(class(TJsonSynHighLighter),class(TSynCompletion),";json;");
|
||||||
|
FSynClasses["js"]:= array(class(TJsSynHighLighter),class(tjssyncompletion),";js;");
|
||||||
FSynClasses["ini"]:= array(class(TINISynHigLighter),class(TSynCompletion),";ini;");
|
FSynClasses["ini"]:= array(class(TINISynHigLighter),class(TSynCompletion),";ini;");
|
||||||
FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;");
|
FSynClasses["bat"]:= array(class(TBatSynHigLighter),class(TSynCompletion),";bat;cmd;");
|
||||||
FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;");
|
FSynClasses["tfm"]:= array(class(ttfmhighlighter),class(TSynCompletion),";tfm;");
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,54 @@ type thighlitcolor = class(tcomponent)
|
||||||
end
|
end
|
||||||
FColors;
|
FColors;
|
||||||
end
|
end
|
||||||
|
type tjssyncompletion = class(TSynCompletion)
|
||||||
|
function Create(AOwner);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
IgnoreCase := false;
|
||||||
|
end
|
||||||
|
function PrepareCompletion(m);override;
|
||||||
|
begin
|
||||||
|
//½âÎö
|
||||||
|
if not Memo then return ;
|
||||||
|
sd := static getjswords();
|
||||||
|
d := gettextwords(Memo.Text);
|
||||||
|
if d then sd union=d;
|
||||||
|
SetCompData(sd);
|
||||||
|
end
|
||||||
|
function getjswords();
|
||||||
|
begin
|
||||||
|
getjskeywordstip(r);
|
||||||
|
getcsskeywords(r);
|
||||||
|
return r;
|
||||||
|
end
|
||||||
|
function gettextwords(s);
|
||||||
|
begin
|
||||||
|
parseregexpr("[A-Zaz0-9_\\-]+",s,"mi",mched,mchpos,mathlen);
|
||||||
|
r := array();
|
||||||
|
for ri,v in mched do
|
||||||
|
begin
|
||||||
|
v0 := v[0];
|
||||||
|
lv := lowercase(v0);
|
||||||
|
if r[lv] then continue;
|
||||||
|
r[lv] := v0;
|
||||||
|
end
|
||||||
|
d := array();
|
||||||
|
i := 0;
|
||||||
|
for lv,v in r do
|
||||||
|
begin
|
||||||
|
d[i,"caption"] := v;
|
||||||
|
d[i,"value"] := v;
|
||||||
|
d[i,"lvalue"] := lv;
|
||||||
|
cl := length(v);
|
||||||
|
d[i,"clen"] := cl;
|
||||||
|
d[i,"vlen"] := cl;
|
||||||
|
i++;
|
||||||
|
end
|
||||||
|
return d;
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
type TTSLCompletion= class(TSynCompletion)
|
type TTSLCompletion= class(TSynCompletion)
|
||||||
{**
|
{**
|
||||||
@explan(˵Ã÷) tslÌáʾ×Ô¶¯Íê³ÉÀà
|
@explan(˵Ã÷) tslÌáʾ×Ô¶¯Íê³ÉÀà
|
||||||
|
|
@ -242,107 +290,9 @@ type TTSLCompletion= class(TSynCompletion)
|
||||||
r[idx]["order"] := 2;
|
r[idx]["order"] := 2;
|
||||||
idx++;
|
idx++;
|
||||||
end
|
end
|
||||||
//cfk "abstract","break","case","class","continue","delete","do","else","eval","false","goto","if","new","while","with","for","function","in","interface","finally","private","protected","public","return","static","true","try","var",
|
getjskeywordstip(r);
|
||||||
for i,v in array("arguments","boolean","byte","catch","char","const","debugger","default","double","enum","export","extends","final","float","implements","import","instanceof","int","let","long","native","null","package","short","super","switch","synchronized","this","typeof","throw","throws","transient","void","volatile","yield")
|
getcsskeywords(r);
|
||||||
do
|
|
||||||
begin
|
|
||||||
c := v+" <js key>";
|
|
||||||
r[idx]["caption"] := c;
|
|
||||||
r[idx]["value"] := v;
|
|
||||||
r[idx]["lvalue"] := lowercase(v);
|
|
||||||
r[idx]["vlen"] := length(v);
|
|
||||||
r[idx]["clen"] := length(c);
|
|
||||||
r[idx]["order"] := 4;
|
|
||||||
idx++;
|
|
||||||
|
|
||||||
end
|
|
||||||
//"Array","function","length","eval",
|
|
||||||
for i,v in array("Date","hasOwnProperty","Infinity","isFinite","isNaN","isPrototypeOf","Math",
|
|
||||||
"NaN","name","Number","Object","prototype","String","toString","undefined","valueOf")
|
|
||||||
do
|
|
||||||
begin
|
|
||||||
c := v+" <js class>";
|
|
||||||
r[idx]["caption"] := c;
|
|
||||||
r[idx]["value"] := v;
|
|
||||||
r[idx]["lvalue"] := lowercase(v);
|
|
||||||
r[idx]["vlen"] := length(v);
|
|
||||||
r[idx]["clen"] := length(c);
|
|
||||||
r[idx]["order"] := 4;
|
|
||||||
idx++;
|
|
||||||
end
|
|
||||||
//"all","select","self",
|
|
||||||
for i,v in array("$","alert","anchor","anchors","area","assign","blur","button","checkbox",
|
|
||||||
"clearInterval","clearTimeout","clientInformation","close","closed","confirm",
|
|
||||||
"constructor","crypto","decodeURI","decodeURIComponent","defaultStatus","document",
|
|
||||||
"element","elements","embed","embeds","encodeURI","encodeURIComponent","escape","event",
|
|
||||||
"fileUpload","focus","form","forms","frame","innerHeight","innerWidth","layer","layers",
|
|
||||||
"link","location","mimeTypes","navigate","navigator","frames","frameRate","hidden","history",
|
|
||||||
"image","images","offscreenBuffering","open","opener","option","outerHeight","outerWidth","packages",
|
|
||||||
"pageXOffset","pageYOffset","parent","parseFloat","parseInt","password","pkcs11","plugin","prompt",
|
|
||||||
"propertyIsEnum","radio","reset","screenX","screenY","scroll","secure","setInterval",
|
|
||||||
"setTimeout","status","submit","taint","text","textarea","top","unescape","untaint","window")
|
|
||||||
do
|
|
||||||
begin
|
|
||||||
c := v+" <js win>";
|
|
||||||
r[idx]["caption"] := c;
|
|
||||||
r[idx]["value"] := v;
|
|
||||||
r[idx]["lvalue"] := lowercase(v);
|
|
||||||
r[idx]["vlen"] := length(v);
|
|
||||||
r[idx]["clen"] := length(c);
|
|
||||||
r[idx]["order"] := 4;
|
|
||||||
idx++;
|
|
||||||
end
|
|
||||||
for i,v in array("onblur","onclick","onerror","onfocus","onkeydown","onkeypress","onkeyup","onmouseover","onload","onmouseup","onmousedown","onsubmit")
|
|
||||||
do
|
|
||||||
begin
|
|
||||||
c := v+" <html ev>";
|
|
||||||
r[idx]["caption"] := c;
|
|
||||||
r[idx]["value"] := v;
|
|
||||||
r[idx]["lvalue"] := lowercase(v);
|
|
||||||
r[idx]["vlen"] := length(v);
|
|
||||||
r[idx]["clen"] := length(c);
|
|
||||||
r[idx]["order"] := 4;
|
|
||||||
idx++;
|
|
||||||
end
|
|
||||||
for i,v in array("align-content","align-items","align-self","all","animation","animation-delay",
|
|
||||||
"animation-direction","animation-duration","animation-fill-mode","animation-iteration-count",
|
|
||||||
"animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility",
|
|
||||||
"background","background-attachment","background-blend-mode","background-clip","background-color",
|
|
||||||
"background-image","background-origin","background-position","background-repeat","background-size",
|
|
||||||
"border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius",
|
|
||||||
"border-bottom-style","border-bottom-width","border-collapse","border-color","border-image",
|
|
||||||
"border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width",
|
|
||||||
"border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right",
|
|
||||||
"border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top",
|
|
||||||
"border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width",
|
|
||||||
"border-width","bottom","box-align","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group",
|
|
||||||
"box-orient","box-pack","box-shadow","box-sizing","caption-side","clear","clip","color","column-count","column-fill",
|
|
||||||
"column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width",
|
|
||||||
"columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex",
|
|
||||||
"flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-face","font-family",
|
|
||||||
"font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","grid-columns","grid-rows",
|
|
||||||
"hanging-punctuation","height","icon","justify-content","keyframes","left","letter-spacing","line-height","list-style",
|
|
||||||
"list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top",
|
|
||||||
"max-height","max-width","media","min-height","min-width","mix-blend-mode","object-fit","object-position","nav-down","nav-index",
|
|
||||||
"nav-left","nav-right","nav-up","opacity","order","outline","outline-color","outline-offset","outline-style","outline-width",
|
|
||||||
"overflow","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after",
|
|
||||||
"page-break-before","page-break-inside","perspective","perspective-origin","position","punctuation-trim","quotes","resize","right",
|
|
||||||
"rotation","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last",
|
|
||||||
"text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-justify",
|
|
||||||
"text-outline","text-overflow","text-shadow","text-transform","text-wrap","top","transform","transform-origin","transform-style",
|
|
||||||
"transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align",
|
|
||||||
"visibility","white-space","width","word-break","word-spacing","word-wrap","z-index","writing-mode")
|
|
||||||
do
|
|
||||||
begin
|
|
||||||
c := v+" <css pro>";
|
|
||||||
r[idx]["caption"] := c;
|
|
||||||
r[idx]["value"] := v;
|
|
||||||
r[idx]["lvalue"] := lowercase(v);
|
|
||||||
r[idx]["vlen"] := length(v);
|
|
||||||
r[idx]["clen"] := length(c);
|
|
||||||
r[idx]["order"] := 5;
|
|
||||||
idx++;
|
|
||||||
end
|
|
||||||
return r;
|
return r;
|
||||||
end
|
end
|
||||||
private
|
private
|
||||||
|
|
@ -381,8 +331,7 @@ type TTslSynHighLighter = class(TSynHighLighter)
|
||||||
FBinFunc[v]:=v;
|
FBinFunc[v]:=v;
|
||||||
end
|
end
|
||||||
FJsKeyWords := array();
|
FJsKeyWords := array();
|
||||||
for i,v in array("abstract","arguments","boolean","break","byte","case","catch","char","class","const","continue","debugger","default","delete","do","double","else","enum","eval","export","extends","false","final","finally","float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long","native","new","null","package","private","protected","public","return","short","static","super","switch","synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield")
|
for i,v in getjskeywords() do
|
||||||
do
|
|
||||||
begin
|
begin
|
||||||
FJsKeyWords[v]:=v;
|
FJsKeyWords[v]:=v;
|
||||||
|
|
||||||
|
|
@ -1386,7 +1335,7 @@ type TJsonSynHighLighter = class(tcustomsynhighlighter)
|
||||||
function create(AOwner);
|
function create(AOwner);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
ExecuteCommand("string",array(('"',"\\")));
|
ExecuteCommand("string",array(('"',"\\"),("'","\\")));
|
||||||
ExecuteCommand("keywords",array("null","true","false"));
|
ExecuteCommand("keywords",array("null","true","false"));
|
||||||
ExecuteCommand("rowannotes",array());
|
ExecuteCommand("rowannotes",array());
|
||||||
ExecuteCommand("blockannotes",array());
|
ExecuteCommand("blockannotes",array());
|
||||||
|
|
@ -1394,6 +1343,32 @@ type TJsonSynHighLighter = class(tcustomsynhighlighter)
|
||||||
ExecuteCommand("pairs",array(("{","}"),("[","]")));
|
ExecuteCommand("pairs",array(("{","}"),("[","]")));
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
type TJsSynHighLighter = class(tcustomsynhighlighter)
|
||||||
|
function create(AOwner);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
keywordcolor := 0xff0000;
|
||||||
|
stringcolor := 0x968080;
|
||||||
|
annotationcolor := 0x8D9600;
|
||||||
|
ExecuteCommand("string",array(('"',"\\")));
|
||||||
|
ExecuteCommand("keywords",jskeywords1());
|
||||||
|
ExecuteCommand("rowannotes",array("//"));
|
||||||
|
ExecuteCommand("blockannotes",array(("/*","*/")));
|
||||||
|
ExecuteCommand("syms",array("{","}","[","]","<",">","(",")",":",",","=","?","+","-","*","/","."));
|
||||||
|
ExecuteCommand("pairs",array(("{","}"),("[","]"),("(",")")));
|
||||||
|
ExecuteCommand("sysfun",jskeywords2());
|
||||||
|
end
|
||||||
|
function jskeywords1();
|
||||||
|
begin
|
||||||
|
return getjskeywords() union2 getdomeventwords();
|
||||||
|
|
||||||
|
end
|
||||||
|
function jskeywords2();
|
||||||
|
begin
|
||||||
|
return getjsclasswords() union2 getjsfunwords();
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
type ttfmhighlighter = class(tcustomsynhighlighter)
|
type ttfmhighlighter = class(tcustomsynhighlighter)
|
||||||
|
|
@ -1411,6 +1386,132 @@ type ttfmhighlighter = class(tcustomsynhighlighter)
|
||||||
end
|
end
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
function getcsskeywords(r);
|
||||||
|
begin
|
||||||
|
if not ifarray(r) then r := array();
|
||||||
|
idx := length(r);
|
||||||
|
for i,v in array("align-content","align-items","align-self","all","animation","animation-delay",
|
||||||
|
"animation-direction","animation-duration","animation-fill-mode","animation-iteration-count",
|
||||||
|
"animation-name","animation-play-state","animation-timing-function","appearance","backface-visibility",
|
||||||
|
"background","background-attachment","background-blend-mode","background-clip","background-color",
|
||||||
|
"background-image","background-origin","background-position","background-repeat","background-size",
|
||||||
|
"border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius",
|
||||||
|
"border-bottom-style","border-bottom-width","border-collapse","border-color","border-image",
|
||||||
|
"border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width",
|
||||||
|
"border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right",
|
||||||
|
"border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top",
|
||||||
|
"border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width",
|
||||||
|
"border-width","bottom","box-align","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group",
|
||||||
|
"box-orient","box-pack","box-shadow","box-sizing","caption-side","clear","clip","color","column-count","column-fill",
|
||||||
|
"column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width",
|
||||||
|
"columns","content","counter-increment","counter-reset","cursor","direction","display","empty-cells","filter","flex",
|
||||||
|
"flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","font","font-face","font-family",
|
||||||
|
"font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","grid-columns","grid-rows",
|
||||||
|
"hanging-punctuation","height","icon","justify-content","keyframes","left","letter-spacing","line-height","list-style",
|
||||||
|
"list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top",
|
||||||
|
"max-height","max-width","media","min-height","min-width","mix-blend-mode","object-fit","object-position","nav-down","nav-index",
|
||||||
|
"nav-left","nav-right","nav-up","opacity","order","outline","outline-color","outline-offset","outline-style","outline-width",
|
||||||
|
"overflow","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page-break-after",
|
||||||
|
"page-break-before","page-break-inside","perspective","perspective-origin","position","punctuation-trim","quotes","resize","right",
|
||||||
|
"rotation","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last",
|
||||||
|
"text-decoration","text-decoration-color","text-decoration-line","text-decoration-style","text-indent","text-justify",
|
||||||
|
"text-outline","text-overflow","text-shadow","text-transform","text-wrap","top","transform","transform-origin","transform-style",
|
||||||
|
"transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align",
|
||||||
|
"visibility","white-space","width","word-break","word-spacing","word-wrap","z-index","writing-mode")
|
||||||
|
do
|
||||||
|
begin
|
||||||
|
c := v+" <css pro>";
|
||||||
|
r[idx]["caption"] := c;
|
||||||
|
r[idx]["value"] := v;
|
||||||
|
r[idx]["lvalue"] := lowercase(v);
|
||||||
|
r[idx]["vlen"] := length(v);
|
||||||
|
r[idx]["clen"] := length(c);
|
||||||
|
r[idx]["order"] := 5;
|
||||||
|
idx++;
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function getjskeywords();
|
||||||
|
begin
|
||||||
|
return array("abstract","arguments","boolean","break","byte","case","catch","char","class","const","continue",
|
||||||
|
"debugger","default","delete","do","double","else","enum","eval","export","extends","false","final","finally",
|
||||||
|
"float","for","function","goto","if","implements","import","in","instanceof","int","interface","let","long",
|
||||||
|
"native","new","null","package","private","protected","public","return","short","static","super","switch",
|
||||||
|
"synchronized","this","throw","throws","transient","true","try","typeof","var","void","volatile","while","with","yield");
|
||||||
|
end
|
||||||
|
function getjsclasswords();
|
||||||
|
begin
|
||||||
|
return array("Date","hasOwnProperty","Infinity","isFinite","isNaN","isPrototypeOf","Math",
|
||||||
|
"NaN","name","Number","Object","prototype","String","toString","undefined","valueOf");
|
||||||
|
end
|
||||||
|
function getjsfunwords();
|
||||||
|
begin
|
||||||
|
return array("$","alert","anchor","anchors","area","assign","blur","button","checkbox",
|
||||||
|
"clearInterval","clearTimeout","clientInformation","close","closed","confirm",
|
||||||
|
"constructor","crypto","decodeURI","decodeURIComponent","defaultStatus","document",
|
||||||
|
"element","elements","embed","embeds","encodeURI","encodeURIComponent","escape","event",
|
||||||
|
"fileUpload","focus","form","forms","frame","innerHeight","innerWidth","layer","layers",
|
||||||
|
"link","location","mimeTypes","navigate","navigator","frames","frameRate","hidden","history",
|
||||||
|
"image","images","offscreenBuffering","open","opener","option","outerHeight","outerWidth","packages",
|
||||||
|
"pageXOffset","pageYOffset","parent","parseFloat","parseInt","password","pkcs11","plugin","prompt",
|
||||||
|
"propertyIsEnum","radio","reset","screenX","screenY","scroll","secure","setInterval",
|
||||||
|
"setTimeout","status","submit","taint","text","textarea","top","unescape","untaint","window");
|
||||||
|
end
|
||||||
|
function getdomeventwords();
|
||||||
|
begin
|
||||||
|
return array("onblur","onclick","onerror","onfocus","onkeydown","onkeypress","onkeyup","onmouseover","onload","onmouseup","onmousedown","onsubmit");
|
||||||
|
end
|
||||||
|
function getjskeywordstip(r);
|
||||||
|
begin
|
||||||
|
if not ifarray(r) then r := array();
|
||||||
|
idx := length(r);
|
||||||
|
for i,v in getjskeywords() do
|
||||||
|
begin
|
||||||
|
c := v+" <js key>";
|
||||||
|
r[idx]["caption"] := c;
|
||||||
|
r[idx]["value"] := v;
|
||||||
|
r[idx]["lvalue"] := lowercase(v);
|
||||||
|
r[idx]["vlen"] := length(v);
|
||||||
|
r[idx]["clen"] := length(c);
|
||||||
|
r[idx]["order"] := 4;
|
||||||
|
idx++;
|
||||||
|
|
||||||
|
end
|
||||||
|
//"Array","function","length","eval",
|
||||||
|
for i,v in getjsclasswords() do
|
||||||
|
begin
|
||||||
|
c := v+" <js class>";
|
||||||
|
r[idx]["caption"] := c;
|
||||||
|
r[idx]["value"] := v;
|
||||||
|
r[idx]["lvalue"] := lowercase(v);
|
||||||
|
r[idx]["vlen"] := length(v);
|
||||||
|
r[idx]["clen"] := length(c);
|
||||||
|
r[idx]["order"] := 4;
|
||||||
|
idx++;
|
||||||
|
end
|
||||||
|
//"all","select","self",
|
||||||
|
for i,v in getjsfunwords()do
|
||||||
|
begin
|
||||||
|
c := v+" <js win>";
|
||||||
|
r[idx]["caption"] := c;
|
||||||
|
r[idx]["value"] := v;
|
||||||
|
r[idx]["lvalue"] := lowercase(v);
|
||||||
|
r[idx]["vlen"] := length(v);
|
||||||
|
r[idx]["clen"] := length(c);
|
||||||
|
r[idx]["order"] := 4;
|
||||||
|
idx++;
|
||||||
|
end
|
||||||
|
for i,v in getdomeventwords() do
|
||||||
|
begin
|
||||||
|
c := v+" <html ev>";
|
||||||
|
r[idx]["caption"] := c;
|
||||||
|
r[idx]["value"] := v;
|
||||||
|
r[idx]["lvalue"] := lowercase(v);
|
||||||
|
r[idx]["vlen"] := length(v);
|
||||||
|
r[idx]["clen"] := length(c);
|
||||||
|
r[idx]["order"] := 4;
|
||||||
|
idx++;
|
||||||
|
end
|
||||||
|
end
|
||||||
type tcolor = class()
|
type tcolor = class()
|
||||||
function create(c);
|
function create(c);
|
||||||
begin
|
begin
|
||||||
|
|
|
||||||
|
|
@ -638,6 +638,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
@explan(说明) 带滚动条的编辑控件 %%
|
@explan(说明) 带滚动条的编辑控件 %%
|
||||||
**}
|
**}
|
||||||
private
|
private
|
||||||
|
FSymchars;
|
||||||
[weakref]fongutterclick;//点击
|
[weakref]fongutterclick;//点击
|
||||||
ftmemlockv;
|
ftmemlockv;
|
||||||
fundoing; //清空unredo标记
|
fundoing; //清空unredo标记
|
||||||
|
|
@ -1014,6 +1015,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
function Create(AOwner);override;
|
function Create(AOwner);override;
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
FSymchars := array();
|
||||||
ftmemlockv := new tcountkernel();
|
ftmemlockv := new tcountkernel();
|
||||||
FGutterColor := rgb(228,228,228);
|
FGutterColor := rgb(228,228,228);
|
||||||
fcurrentLineColor := rgb(232,232,255);
|
fcurrentLineColor := rgb(232,232,255);
|
||||||
|
|
@ -1296,6 +1298,26 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
IncPaintLock();
|
IncPaintLock();
|
||||||
try
|
try
|
||||||
case cmd of
|
case cmd of
|
||||||
|
"symchars":
|
||||||
|
begin
|
||||||
|
if ifstring(data) then
|
||||||
|
begin
|
||||||
|
FSymchars := array();
|
||||||
|
for i := 1 to length(data) do
|
||||||
|
begin
|
||||||
|
vi := data[i];
|
||||||
|
if vi= "\t" or vi="\r" or vi="\n" or vi="\b" then
|
||||||
|
begin
|
||||||
|
continue;
|
||||||
|
end
|
||||||
|
FSymchars[vi] := true;
|
||||||
|
end
|
||||||
|
return ;
|
||||||
|
end
|
||||||
|
r := "";
|
||||||
|
for i,v in FSymchars do r+=i;
|
||||||
|
return r;
|
||||||
|
end
|
||||||
"ecruningto":
|
"ecruningto":
|
||||||
begin
|
begin
|
||||||
if Fecruningto <> data then
|
if Fecruningto <> data then
|
||||||
|
|
@ -1673,12 +1695,13 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
begin
|
begin
|
||||||
cx--;
|
cx--;
|
||||||
vi := s[cx];
|
vi := s[cx];
|
||||||
|
if FSymchars[vi] then continue;
|
||||||
ivi := ord(vi);
|
ivi := ord(vi);
|
||||||
{if (ivi<=0x2f) or (ivi>122 and ivi<=127) then
|
{if (ivi<=0x2f) or (ivi>122 and ivi<=127) then
|
||||||
begin
|
begin
|
||||||
ci++;
|
ci++;
|
||||||
break;
|
break;
|
||||||
end }
|
end }
|
||||||
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then
|
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then
|
||||||
begin
|
begin
|
||||||
ci++;
|
ci++;
|
||||||
|
|
@ -1702,6 +1725,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
||||||
while cx <= ls do
|
while cx <= ls do
|
||||||
begin
|
begin
|
||||||
vi := s[cx];
|
vi := s[cx];
|
||||||
|
if FSymchars[vi] then continue;
|
||||||
ivi := ord(vi);
|
ivi := ord(vi);
|
||||||
//if (ivi<=0x2f) or (ivi>122 and ivi<=127) then break;
|
//if (ivi<=0x2f) or (ivi>122 and ivi<=127) then break;
|
||||||
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then break;
|
if(ivi<48)or(ivi>57 and ivi<65)or(ivi>90 and ivi<95)or(ivi>95 and ivi<97)or(ivi>122 and ivi <= 127)then break;
|
||||||
|
|
@ -3114,8 +3138,10 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
fsymcolor := 0xa000a0;
|
fsymcolor := 0xa000a0;
|
||||||
fnumbercolor := 0x666666;
|
fnumbercolor := 0x666666;
|
||||||
fkeywordcolor := 0x0000ff;
|
fkeywordcolor := 0x0000ff;
|
||||||
|
fsysfuncolor := 0xff0000;
|
||||||
fstringcolor := 0xff00ff;
|
fstringcolor := 0xff00ff;
|
||||||
fannotationcolor := 0xff0000;
|
//fannotationcolor := 0xff0000;
|
||||||
|
fannotationcolor := 0xaa3300;
|
||||||
fignorecase := false;//忽略大小写
|
fignorecase := false;//忽略大小写
|
||||||
FChangeDeal := true;
|
FChangeDeal := true;
|
||||||
FTokens := array();
|
FTokens := array();
|
||||||
|
|
@ -3134,6 +3160,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
("[","]"),
|
("[","]"),
|
||||||
("{","}"),
|
("{","}"),
|
||||||
));
|
));
|
||||||
|
setsysfun(array());
|
||||||
clean();
|
clean();
|
||||||
end
|
end
|
||||||
function ExecuteCommand(cmd,pm);override;
|
function ExecuteCommand(cmd,pm);override;
|
||||||
|
|
@ -3164,6 +3191,10 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
begin
|
begin
|
||||||
return setsyms(pm);
|
return setsyms(pm);
|
||||||
end
|
end
|
||||||
|
"sysfun":
|
||||||
|
begin
|
||||||
|
return setsysfun(pm);
|
||||||
|
end
|
||||||
"pairs":
|
"pairs":
|
||||||
begin
|
begin
|
||||||
return setpairs(pm);
|
return setpairs(pm);
|
||||||
|
|
@ -3221,6 +3252,10 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
if ifkeywords(bttk) then
|
if ifkeywords(bttk) then
|
||||||
begin
|
begin
|
||||||
d.FFColor := fkeywordcolor;
|
d.FFColor := fkeywordcolor;
|
||||||
|
end else
|
||||||
|
if ifsysfun(bttk) then
|
||||||
|
begin
|
||||||
|
d.FFColor := fsysfuncolor ;
|
||||||
end
|
end
|
||||||
dopair(d,bttk);
|
dopair(d,bttk);
|
||||||
end else
|
end else
|
||||||
|
|
@ -3256,6 +3291,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
inherited;
|
inherited;
|
||||||
end
|
end
|
||||||
property keywordcolor:color read fkeywordcolor write fkeywordcolor;
|
property keywordcolor:color read fkeywordcolor write fkeywordcolor;
|
||||||
|
property sysfuncolor:color read fsysfuncolor write fsysfuncolor;
|
||||||
property stringcolor:color read fstringcolor write fstringcolor;
|
property stringcolor:color read fstringcolor write fstringcolor;
|
||||||
property annotationcolor:color read fannotationcolor write fannotationcolor;
|
property annotationcolor:color read fannotationcolor write fannotationcolor;
|
||||||
property symcolor:color read fsymcolor write fsymcolor;
|
property symcolor:color read fsymcolor write fsymcolor;
|
||||||
|
|
@ -3273,6 +3309,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
fblockstiresa,
|
fblockstiresa,
|
||||||
fblockstiresb,
|
fblockstiresb,
|
||||||
frowstires,
|
frowstires,
|
||||||
|
fsysfuntires,
|
||||||
fsymstires) do
|
fsymstires) do
|
||||||
begin
|
begin
|
||||||
for j,vj in v do
|
for j,vj in v do
|
||||||
|
|
@ -3352,7 +3389,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
SetTToken(tokens,ttk,idx-1);
|
SetTToken(tokens,ttk,idx-1);
|
||||||
bostr := ostr;
|
bostr := ostr;
|
||||||
ncost := array("annote",bostr,fblockstiresb[bostr]);
|
ncost := array("annote",bostr,fblockstiresb[bostr]);
|
||||||
SetTToken(tokens,ostr,oidx-1);
|
SetTToken(tokens,ostr,oidx-1,array("annote"));
|
||||||
idx := oidx-1;
|
idx := oidx-1;
|
||||||
return ParserTokenLines(s,idx+1,e,ncost,tokens);
|
return ParserTokenLines(s,idx+1,e,ncost,tokens);
|
||||||
end else
|
end else
|
||||||
|
|
@ -3470,6 +3507,18 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function setsysfun(d);//设置系统函数
|
||||||
|
begin
|
||||||
|
st := new TTire();
|
||||||
|
fsysfuntires := array(st);
|
||||||
|
for i,v in d do
|
||||||
|
begin
|
||||||
|
if ifstring(v) and v then
|
||||||
|
begin
|
||||||
|
st.add(v);
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
function setsyms(d);//设置符号
|
function setsyms(d);//设置符号
|
||||||
begin
|
begin
|
||||||
st := new TTire();
|
st := new TTire();
|
||||||
|
|
@ -3543,6 +3592,14 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
return true;
|
return true;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
function ifsysfun(s);//系统函数判断
|
||||||
|
begin
|
||||||
|
for i,v in fsysfuntires do
|
||||||
|
begin
|
||||||
|
if v.find(s,length(s),1,idx,ostr) and (ostr=s) then
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
end
|
||||||
function ifdefsym(s,l,idx,oidx,ostr,tidx); //符号判断
|
function ifdefsym(s,l,idx,oidx,ostr,tidx); //符号判断
|
||||||
begin
|
begin
|
||||||
return cyclefind(fsymstires,s,l,idx,oidx,ostr,tidx);
|
return cyclefind(fsymstires,s,l,idx,oidx,ostr,tidx);
|
||||||
|
|
@ -3588,11 +3645,13 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
||||||
fstrstires;
|
fstrstires;
|
||||||
fstrstires_zy;
|
fstrstires_zy;
|
||||||
fsymstires;
|
fsymstires;
|
||||||
|
fsysfuntires;
|
||||||
frowstires;
|
frowstires;
|
||||||
fblockstiresa;
|
fblockstiresa;
|
||||||
fblockstiresb;
|
fblockstiresb;
|
||||||
/////
|
/////
|
||||||
fkeywordcolor;
|
fkeywordcolor;
|
||||||
|
fsysfuncolor;
|
||||||
fstringcolor;
|
fstringcolor;
|
||||||
fannotationcolor;
|
fannotationcolor;
|
||||||
fsymcolor;
|
fsymcolor;
|
||||||
|
|
@ -3762,9 +3821,9 @@ type TSynCustomMemo = class(TCustomMemo)
|
||||||
s := s.FStr;
|
s := s.FStr;
|
||||||
for i:= b[1] to e[1]-1 do
|
for i:= b[1] to e[1]-1 do
|
||||||
begin
|
begin
|
||||||
ivi := ord(s[i]);
|
ivi := ord(s[i]);
|
||||||
if(ivi<48) or (ivi>57 and ivi<65) or (ivi>90 and ivi<95) or(ivi>95 and ivi<97) or(ivi>122 and ivi<=127) then continue;
|
if(ivi<48) or (ivi>57 and ivi<65) or (ivi>90 and ivi<95) or(ivi>95 and ivi<97) or(ivi>122 and ivi<=127) then continue;
|
||||||
r+=s[i];
|
r+=s[i];
|
||||||
end
|
end
|
||||||
except
|
except
|
||||||
r := "";
|
r := "";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue