mirror of https://gitlab.com/basile.b/dexed.git
highlitgther, add attributes for the phobos-style types, close #92
This commit is contained in:
parent
1e9e727155
commit
64ba94705d
|
@ -12,7 +12,7 @@ uses
|
||||||
type
|
type
|
||||||
|
|
||||||
TTokenKind = (tkCommt, tkIdent, tkKeywd, tkStrng, tkBlank, tkSymbl, tkNumbr,
|
TTokenKind = (tkCommt, tkIdent, tkKeywd, tkStrng, tkBlank, tkSymbl, tkNumbr,
|
||||||
tkDDocs, tkSpecK, tkError, tkAsmbl, tkAttri, tkLost);
|
tkDDocs, tkSpecK, tkError, tkAsmbl, tkAttri, tkLost, tkTypes);
|
||||||
|
|
||||||
TRangeKind = (rkString1, rkString2, rkTokString, rkBlockCom1, rkBlockCom2,
|
TRangeKind = (rkString1, rkString2, rkTokString, rkBlockCom1, rkBlockCom2,
|
||||||
rkBlockDoc1, rkBlockDoc2, rkAsm);
|
rkBlockDoc1, rkBlockDoc2, rkAsm);
|
||||||
|
@ -56,12 +56,14 @@ type
|
||||||
fErrorAttrib: TSynHighlighterAttributes;
|
fErrorAttrib: TSynHighlighterAttributes;
|
||||||
fAttriAttrib: TSynHighlighterAttributes;
|
fAttriAttrib: TSynHighlighterAttributes;
|
||||||
fLost_Attrib: TSynHighlighterAttributes;
|
fLost_Attrib: TSynHighlighterAttributes;
|
||||||
|
fTypesAttrib: TSynHighlighterAttributes;
|
||||||
fLineBuf: string;
|
fLineBuf: string;
|
||||||
fTokStart, fTokStop: Integer;
|
fTokStart, fTokStop: Integer;
|
||||||
fTokKind: TTokenKind;
|
fTokKind: TTokenKind;
|
||||||
fCurrRange: TSynD2SynRange;
|
fCurrRange: TSynD2SynRange;
|
||||||
fFoldKinds: TFoldKinds;
|
fFoldKinds: TFoldKinds;
|
||||||
fAttribLut: array[TTokenKind] of TSynHighlighterAttributes;
|
fAttribLut: array[TTokenKind] of TSynHighlighterAttributes;
|
||||||
|
fPhobosStyleType: boolean;
|
||||||
procedure setFoldKinds(value: TFoldKinds);
|
procedure setFoldKinds(value: TFoldKinds);
|
||||||
procedure setWhiteAttrib(value: TSynHighlighterAttributes);
|
procedure setWhiteAttrib(value: TSynHighlighterAttributes);
|
||||||
procedure setNumbrAttrib(value: TSynHighlighterAttributes);
|
procedure setNumbrAttrib(value: TSynHighlighterAttributes);
|
||||||
|
@ -75,13 +77,15 @@ type
|
||||||
procedure setSpeckAttrib(value: TSynHighlighterAttributes);
|
procedure setSpeckAttrib(value: TSynHighlighterAttributes);
|
||||||
procedure setErrorAttrib(value: TSynHighlighterAttributes);
|
procedure setErrorAttrib(value: TSynHighlighterAttributes);
|
||||||
procedure setAttriAttrib(value: TSynHighlighterAttributes);
|
procedure setAttriAttrib(value: TSynHighlighterAttributes);
|
||||||
|
procedure setTypesAttrib(value: TSynHighlighterAttributes);
|
||||||
procedure doAttribChange(sender: TObject);
|
procedure doAttribChange(sender: TObject);
|
||||||
procedure doChanged;
|
procedure doChanged;
|
||||||
protected
|
protected
|
||||||
function GetRangeClass: TSynCustomHighlighterRangeClass; override;
|
function GetRangeClass: TSynCustomHighlighterRangeClass; override;
|
||||||
function GetIdentChars: TSynIdentChars; override;
|
function GetIdentChars: TSynIdentChars; override;
|
||||||
published
|
published
|
||||||
property foldKinds: TFoldKinds read fFoldKinds write setFoldKinds;
|
property phobosStyleType: boolean read fPhobosStyleType write fPhobosStyleType stored true;
|
||||||
|
property foldKinds: TFoldKinds read fFoldKinds write setFoldKinds stored true;
|
||||||
property whites: TSynHighlighterAttributes read fWhiteAttrib write setWhiteAttrib stored true;
|
property whites: TSynHighlighterAttributes read fWhiteAttrib write setWhiteAttrib stored true;
|
||||||
property numbers: TSynHighlighterAttributes read fNumbrAttrib write setNumbrAttrib stored true;
|
property numbers: TSynHighlighterAttributes read fNumbrAttrib write setNumbrAttrib stored true;
|
||||||
property symbols: TSynHighlighterAttributes read fSymblAttrib write setSymblAttrib stored true;
|
property symbols: TSynHighlighterAttributes read fSymblAttrib write setSymblAttrib stored true;
|
||||||
|
@ -94,6 +98,7 @@ type
|
||||||
property special: TSynHighlighterAttributes read fSpeckAttrib write setSpeckAttrib stored true;
|
property special: TSynHighlighterAttributes read fSpeckAttrib write setSpeckAttrib stored true;
|
||||||
property errors: TSynHighlighterAttributes read fErrorAttrib write setErrorAttrib stored true;
|
property errors: TSynHighlighterAttributes read fErrorAttrib write setErrorAttrib stored true;
|
||||||
property attributes: TSynHighlighterAttributes read fAttriAttrib write setAttriAttrib stored true;
|
property attributes: TSynHighlighterAttributes read fAttriAttrib write setAttriAttrib stored true;
|
||||||
|
property types: TSynHighlighterAttributes read fTypesAttrib write setTypesAttrib stored true;
|
||||||
property DefaultFilter stored false;
|
property DefaultFilter stored false;
|
||||||
property enabled stored false;
|
property enabled stored false;
|
||||||
public
|
public
|
||||||
|
@ -197,6 +202,7 @@ begin
|
||||||
fSpeckAttrib := TSynHighlighterAttributes.Create('Speck','Speck');
|
fSpeckAttrib := TSynHighlighterAttributes.Create('Speck','Speck');
|
||||||
fErrorAttrib := TSynHighlighterAttributes.Create('Error','Error');
|
fErrorAttrib := TSynHighlighterAttributes.Create('Error','Error');
|
||||||
fAttriAttrib := TSynHighlighterAttributes.Create('Attri','Attri');
|
fAttriAttrib := TSynHighlighterAttributes.Create('Attri','Attri');
|
||||||
|
fTypesAttrib := TSynHighlighterAttributes.Create('Types','Types');
|
||||||
fLost_Attrib := TSynHighlighterAttributes.Create('Lost','Lost');
|
fLost_Attrib := TSynHighlighterAttributes.Create('Lost','Lost');
|
||||||
|
|
||||||
fNumbrAttrib.Foreground := $000079F2;
|
fNumbrAttrib.Foreground := $000079F2;
|
||||||
|
@ -210,6 +216,7 @@ begin
|
||||||
fAttriAttrib.Foreground := clNavy;
|
fAttriAttrib.Foreground := clNavy;
|
||||||
fLost_Attrib.Foreground := clLime;
|
fLost_Attrib.Foreground := clLime;
|
||||||
fDDocsAttrib.Foreground := clTeal;
|
fDDocsAttrib.Foreground := clTeal;
|
||||||
|
fTypesAttrib.Foreground := clBlack;
|
||||||
|
|
||||||
fLost_Attrib.Background := clBlack;
|
fLost_Attrib.Background := clBlack;
|
||||||
|
|
||||||
|
@ -219,6 +226,7 @@ begin
|
||||||
fSpeckAttrib.Style := [fsBold];
|
fSpeckAttrib.Style := [fsBold];
|
||||||
fAttriAttrib.Style := [fsBold];
|
fAttriAttrib.Style := [fsBold];
|
||||||
fLost_Attrib.Style := [fsBold];
|
fLost_Attrib.Style := [fsBold];
|
||||||
|
fTypesAttrib.Style := [fsBold];
|
||||||
|
|
||||||
fErrorAttrib.Foreground:= fIdentAttrib.Foreground;
|
fErrorAttrib.Foreground:= fIdentAttrib.Foreground;
|
||||||
fErrorAttrib.FrameStyle:= slsWaved;
|
fErrorAttrib.FrameStyle:= slsWaved;
|
||||||
|
@ -237,6 +245,7 @@ begin
|
||||||
AddAttribute(fSpeckAttrib);
|
AddAttribute(fSpeckAttrib);
|
||||||
AddAttribute(fErrorAttrib);
|
AddAttribute(fErrorAttrib);
|
||||||
AddAttribute(fAttriAttrib);
|
AddAttribute(fAttriAttrib);
|
||||||
|
AddAttribute(fTypesAttrib);
|
||||||
|
|
||||||
fAttribLut[TTokenKind.tkident] := fIdentAttrib;
|
fAttribLut[TTokenKind.tkident] := fIdentAttrib;
|
||||||
fAttribLut[TTokenKind.tkBlank] := fWhiteAttrib;
|
fAttribLut[TTokenKind.tkBlank] := fWhiteAttrib;
|
||||||
|
@ -250,6 +259,7 @@ begin
|
||||||
fAttribLut[TTokenKind.tkError] := fErrorAttrib;
|
fAttribLut[TTokenKind.tkError] := fErrorAttrib;
|
||||||
fAttribLut[TTokenKind.tkAsmbl] := fAsblrAttrib;
|
fAttribLut[TTokenKind.tkAsmbl] := fAsblrAttrib;
|
||||||
fAttribLut[TTokenKind.tkAttri] := fAttriAttrib;
|
fAttribLut[TTokenKind.tkAttri] := fAttriAttrib;
|
||||||
|
fAttribLut[TTokenKind.tkTypes] := fTypesAttrib;
|
||||||
fAttribLut[TTokenKind.tkLost] := fLost_Attrib;
|
fAttribLut[TTokenKind.tkLost] := fLost_Attrib;
|
||||||
|
|
||||||
SetAttributesOnChange(@doAttribChange);
|
SetAttributesOnChange(@doAttribChange);
|
||||||
|
@ -273,6 +283,7 @@ begin
|
||||||
begin
|
begin
|
||||||
srcsyn := TSynD2Syn(Source);
|
srcsyn := TSynD2Syn(Source);
|
||||||
foldKinds := srcsyn.foldKinds;
|
foldKinds := srcsyn.foldKinds;
|
||||||
|
fPhobosStyleType:=srcsyn.fPhobosStyleType;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -365,6 +376,11 @@ begin
|
||||||
fAttriAttrib.Assign(value);
|
fAttriAttrib.Assign(value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSynD2Syn.setTypesAttrib(value: TSynHighlighterAttributes);
|
||||||
|
begin
|
||||||
|
fTypesAttrib.Assign(value);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSynD2Syn.setLine(const NewValue: string; LineNumber: Integer);
|
procedure TSynD2Syn.setLine(const NewValue: string; LineNumber: Integer);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
|
@ -940,6 +956,8 @@ begin
|
||||||
end
|
end
|
||||||
else if specialKeywordsMap.match(fLineBuf[FTokStart..fTokStop-1]) then
|
else if specialKeywordsMap.match(fLineBuf[FTokStart..fTokStop-1]) then
|
||||||
fTokKind := tkSpecK
|
fTokKind := tkSpecK
|
||||||
|
else if fPhobosStyleType and ('A' <= fLineBuf[FTokStart]) and (fLineBuf[FTokStart] <= 'Z') then
|
||||||
|
fTokKind:= tkTypes
|
||||||
else if rkAsm in fCurrRange.rangeKinds then
|
else if rkAsm in fCurrRange.rangeKinds then
|
||||||
fTokKind:=tkAsmbl;
|
fTokKind:=tkAsmbl;
|
||||||
exit;
|
exit;
|
||||||
|
|
|
@ -326,6 +326,11 @@ begin
|
||||||
//
|
//
|
||||||
currentLine.Background:= 15789545;
|
currentLine.Background:= 15789545;
|
||||||
currentLine.Foreground:= clNone;
|
currentLine.Foreground:= clNone;
|
||||||
|
//
|
||||||
|
getHl.phobosStyleType:=false;
|
||||||
|
getHl.types.Background:=clNone;
|
||||||
|
getHl.types.Foreground:=clBlack;
|
||||||
|
getHl.types.Style:=[fsBold];
|
||||||
end;
|
end;
|
||||||
with fPresets.addPreset do
|
with fPresets.addPreset do
|
||||||
begin
|
begin
|
||||||
|
@ -353,6 +358,10 @@ begin
|
||||||
getHl.errors.Foreground := 14807024;
|
getHl.errors.Foreground := 14807024;
|
||||||
getHl.attributes.Foreground := 9684887;
|
getHl.attributes.Foreground := 9684887;
|
||||||
getHl.attributes.FrameEdges := sfeNone;
|
getHl.attributes.FrameEdges := sfeNone;
|
||||||
|
getHl.phobosStyleType:=false;
|
||||||
|
getHl.types.Background:=clNone;
|
||||||
|
getHl.types.Foreground:=14807024;
|
||||||
|
getHl.types.Style:=[fsBold];
|
||||||
background := 4210752;
|
background := 4210752;
|
||||||
bracketMatch.Background := clNone;
|
bracketMatch.Background := clNone;
|
||||||
bracketMatch.Foreground := clFuchsia;
|
bracketMatch.Foreground := clFuchsia;
|
||||||
|
@ -391,6 +400,9 @@ begin
|
||||||
getHl.errors.Foreground := 1975089;
|
getHl.errors.Foreground := 1975089;
|
||||||
getHl.attributes.Foreground := 3226202;
|
getHl.attributes.Foreground := 3226202;
|
||||||
getHl.attributes.FrameEdges := sfeNone;
|
getHl.attributes.FrameEdges := sfeNone;
|
||||||
|
getHl.types.Background:=clNone;
|
||||||
|
getHl.types.Foreground:=1975089;
|
||||||
|
getHl.types.Style:=[fsBold];
|
||||||
background := 9818842;
|
background := 9818842;
|
||||||
currentLine.Background := 9030871;
|
currentLine.Background := 9030871;
|
||||||
currentLine.Foreground := clNone;
|
currentLine.Foreground := clNone;
|
||||||
|
@ -407,6 +419,8 @@ begin
|
||||||
with fPresets.addPreset do
|
with fPresets.addPreset do
|
||||||
begin
|
begin
|
||||||
name := 'Mars bright';
|
name := 'Mars bright';
|
||||||
|
getHl.identifiers.Foreground := clBlack;
|
||||||
|
getHl.identifiers.FrameEdges := sfeNone;
|
||||||
getHl.numbers.Foreground := 7763655;
|
getHl.numbers.Foreground := 7763655;
|
||||||
getHl.comments.Foreground := clMedGray;
|
getHl.comments.Foreground := clMedGray;
|
||||||
getHl.strings.Foreground := 3750276;
|
getHl.strings.Foreground := 3750276;
|
||||||
|
@ -414,6 +428,9 @@ begin
|
||||||
getHl.ddoc.Foreground := 7105644;
|
getHl.ddoc.Foreground := 7105644;
|
||||||
getHl.special.Foreground := 2631874;
|
getHl.special.Foreground := 2631874;
|
||||||
getHl.attributes.Foreground := 2631874;
|
getHl.attributes.Foreground := 2631874;
|
||||||
|
getHl.types.Background:=clNone;
|
||||||
|
getHl.types.Foreground:=clBlack;
|
||||||
|
getHl.types.Style:=[fsBold];
|
||||||
background := 16579836;
|
background := 16579836;
|
||||||
bracketMatch.Background := 12698077;
|
bracketMatch.Background := 12698077;
|
||||||
bracketMatch.Foreground := clNone;
|
bracketMatch.Foreground := clNone;
|
||||||
|
@ -449,6 +466,9 @@ begin
|
||||||
getHl.special.Foreground := 2631874;
|
getHl.special.Foreground := 2631874;
|
||||||
getHl.errors.Foreground := clCream;
|
getHl.errors.Foreground := clCream;
|
||||||
getHl.attributes.Foreground := 2631874;
|
getHl.attributes.Foreground := 2631874;
|
||||||
|
getHl.types.Background:=clNone;
|
||||||
|
getHl.types.Foreground:=clCream;
|
||||||
|
getHl.types.Style:=[fsBold];
|
||||||
background := 5263440;
|
background := 5263440;
|
||||||
bracketMatch.Background := 9276865;
|
bracketMatch.Background := 9276865;
|
||||||
bracketMatch.Foreground := clNone;
|
bracketMatch.Foreground := clNone;
|
||||||
|
|
Loading…
Reference in New Issue