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