parent
8dc7a0c6d8
commit
b78f2d8bfd
|
|
@ -1838,7 +1838,7 @@ type thighlighter= class(tcustomsynhighlighter)
|
|||
end
|
||||
function publishs();override;
|
||||
begin
|
||||
return array("name","keywordcolor","symcolor","stringcolor","annotationcolor");
|
||||
return array("name","keywordcolor","symcolor","stringcolor","annotationcolor","ignorecase");
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -3217,19 +3217,51 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
property stringcolor:color read fstringcolor write fstringcolor;
|
||||
property annotationcolor:color read fannotationcolor write fannotationcolor;
|
||||
property symcolor:color read fsymcolor write fsymcolor;
|
||||
property ignorecase:bool read fignorecase write setignorecase;
|
||||
private
|
||||
function setignorecase(i);
|
||||
begin
|
||||
ni := i?true:false;
|
||||
if ni<>FIgnoreCase then
|
||||
begin
|
||||
FIgnoreCase := ni;
|
||||
for i,v in array(fstrstires ,
|
||||
fkeystires,
|
||||
fblockstiresa,
|
||||
fblockstiresb,
|
||||
frowstires,
|
||||
fsymstires) do
|
||||
begin
|
||||
for j,vj in v do
|
||||
begin
|
||||
vj.ignorecase := ni;
|
||||
end
|
||||
end
|
||||
if fswordpairshashdata then
|
||||
begin
|
||||
td := fswordpairshashdata;
|
||||
setpairs(td);
|
||||
end
|
||||
end
|
||||
end
|
||||
function dopair(d,bttk); //´¦ÀíÅä¶ÔÐÅÏ¢
|
||||
begin
|
||||
n := fswordpairshash[bttk];
|
||||
if FIgnoreCase then
|
||||
begin
|
||||
lttk := lowercase(bttk);
|
||||
end else
|
||||
begin
|
||||
lttk := bttk;
|
||||
end
|
||||
n := fswordpairshash[lttk];
|
||||
if n then
|
||||
begin
|
||||
st := fcbgestate[n];
|
||||
if fswordpairs[n][1]=bttk then
|
||||
if fswordpairs[n][1]=lttk then
|
||||
begin
|
||||
st.GetRight();
|
||||
end else
|
||||
begin
|
||||
|
||||
st.GetLeft();
|
||||
end
|
||||
d.FMATe := st.GetSate();
|
||||
|
|
@ -3399,17 +3431,24 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
begin
|
||||
fswordpairs := array();
|
||||
fswordpairshash := array();
|
||||
fswordpairshashdata := array();
|
||||
for i,v in d do
|
||||
begin
|
||||
if not ifarray(v) then continue;
|
||||
v0 := v[0];
|
||||
v1 := v[1];
|
||||
if FIgnoreCase then
|
||||
begin
|
||||
v0 := lowercase(v0);
|
||||
v1 := lowercase(v1);
|
||||
end
|
||||
if ifstring(v0) and ifstring(v1) and v0 and v1 then
|
||||
begin
|
||||
fswordpairs[v1,0]:= v0;
|
||||
fswordpairs[v1,1]:= v1;
|
||||
fswordpairshash[v0]:=v1;
|
||||
fswordpairshash[v1]:=v1;
|
||||
fswordpairshashdata[i] := v;
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -3505,6 +3544,7 @@ type tcustomsynhighlighter = class(TSynHighLighter)
|
|||
//
|
||||
fswordpairs;
|
||||
fswordpairshash;
|
||||
fswordpairshashdata;
|
||||
|
||||
end
|
||||
type TSynCustomMemo = class(TCustomMemo)
|
||||
|
|
|
|||
|
|
@ -1637,19 +1637,23 @@ type TTire = class
|
|||
FChar;
|
||||
FSub;
|
||||
FEnd;
|
||||
Ficase;
|
||||
function Create(v);
|
||||
begin
|
||||
FChar := v;
|
||||
FSub := array();
|
||||
FEnd := false;
|
||||
Ficase := false;
|
||||
end
|
||||
function Add(s);
|
||||
begin
|
||||
v0 := s[1];
|
||||
if Ficase then v0 := lowercase(v0);
|
||||
vsub := FSub[v0];
|
||||
if not vsub then
|
||||
begin
|
||||
vsub := new TTireNode(v0);
|
||||
vsub.Ficase := Ficase;
|
||||
FSub[v0] := vsub;
|
||||
end
|
||||
ls := length(s);
|
||||
|
|
@ -1664,6 +1668,7 @@ type TTire = class
|
|||
begin
|
||||
if idx>slen then return FEnd;
|
||||
v0 := s[idx];
|
||||
if Ficase then v0 := lowercase(v0);
|
||||
vsub := FSub[v0];
|
||||
if vsub then
|
||||
begin
|
||||
|
|
@ -1672,6 +1677,28 @@ type TTire = class
|
|||
end
|
||||
return FEnd ;
|
||||
end
|
||||
function seticase(i);
|
||||
begin
|
||||
ni := i?true:false;
|
||||
if ni<>Ficase then
|
||||
begin
|
||||
Ficase := ni;
|
||||
for i,v in mrows(FSub,1) do
|
||||
begin
|
||||
vi := FSub[v];
|
||||
if ni then //ºöÂÔ´óСд
|
||||
begin
|
||||
reindex(FSub,array(v:nil));
|
||||
FSub[lowercase(vi.FChar)] := vi;
|
||||
end else //Çø·Ö´óСд
|
||||
begin
|
||||
reindex(FSub,array(v:nil));
|
||||
FSub[vi.FChar] := vi;
|
||||
end
|
||||
vi.seticase(i);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function Add(s);
|
||||
begin
|
||||
|
|
@ -1679,7 +1706,9 @@ type TTire = class
|
|||
end
|
||||
function Create();
|
||||
begin
|
||||
fignorecase := false;
|
||||
FRoot := new TTireNode();
|
||||
FRoot.Ficase := false;
|
||||
end
|
||||
function Find(s,slen,idx,outidx,ostr);
|
||||
begin
|
||||
|
|
@ -1694,6 +1723,17 @@ type TTire = class
|
|||
return r;
|
||||
end
|
||||
FRoot;
|
||||
property ignorecase read fignorecase write setignorecase;
|
||||
private
|
||||
function setignorecase(i);
|
||||
begin
|
||||
ni := i?true :false;
|
||||
if ni<>fignorecase then
|
||||
begin
|
||||
FRoot.seticase(ni);
|
||||
end
|
||||
end
|
||||
fignorecase;
|
||||
end
|
||||
type tpairstate =class //À¨ºÅ״̬
|
||||
function Create(t);
|
||||
|
|
|
|||
Loading…
Reference in New Issue