mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 09:19:22 +02:00
SynEdit: improved bat, ini highlighter by VRODE
git-svn-id: trunk@28770 -
This commit is contained in:
parent
3dffaaee76
commit
cdb10f937d
@ -72,6 +72,8 @@ type
|
|||||||
|
|
||||||
TSynBatSyn = class(TSynCustomHighlighter)
|
TSynBatSyn = class(TSynCustomHighlighter)
|
||||||
private
|
private
|
||||||
|
fEcho: Boolean;
|
||||||
|
fIgnoreComment: Boolean;
|
||||||
fLine: PChar;
|
fLine: PChar;
|
||||||
fLineNumber: Integer;
|
fLineNumber: Integer;
|
||||||
fProcTable: array[#0..#255] of TProcTableProc;
|
fProcTable: array[#0..#255] of TProcTableProc;
|
||||||
@ -234,7 +236,7 @@ var
|
|||||||
Temp: PChar;
|
Temp: PChar;
|
||||||
begin
|
begin
|
||||||
Temp := fToIdent;
|
Temp := fToIdent;
|
||||||
if Length(aKey) = fStringLen then
|
if not fEcho and (Length(aKey) = fStringLen) then
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
for i := 1 to fStringLen do
|
for i := 1 to fStringLen do
|
||||||
@ -291,7 +293,11 @@ end;
|
|||||||
|
|
||||||
function TSynBatSyn.Func31: TtkTokenKind;
|
function TSynBatSyn.Func31: TtkTokenKind;
|
||||||
begin
|
begin
|
||||||
if KeyComp('echo') then Result := tkKey else Result := tkIdentifier;
|
if KeyComp('echo') then begin
|
||||||
|
Result := tkKey;
|
||||||
|
fEcho := True;
|
||||||
|
end
|
||||||
|
else Result := tkIdentifier;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBatSyn.Func34: TtkTokenKind;
|
function TSynBatSyn.Func34: TtkTokenKind;
|
||||||
@ -413,6 +419,8 @@ procedure TSynBatSyn.SetLine({$IFDEF FPC}const {$ENDIF}NewValue: String; LineNum
|
|||||||
begin
|
begin
|
||||||
fLine := PChar(NewValue);
|
fLine := PChar(NewValue);
|
||||||
Run := 0;
|
Run := 0;
|
||||||
|
fEcho := False;
|
||||||
|
fIgnoreComment := False;
|
||||||
fLineNumber := LineNumber;
|
fLineNumber := LineNumber;
|
||||||
Next;
|
Next;
|
||||||
end;
|
end;
|
||||||
@ -474,7 +482,7 @@ end;
|
|||||||
|
|
||||||
procedure TSynBatSyn.REMCommentProc;
|
procedure TSynBatSyn.REMCommentProc;
|
||||||
begin
|
begin
|
||||||
if (FLine[Run+1] in ['E','e']) and (FLine[Run+2] in ['M','m'])
|
if not fIgnoreComment and (FLine[Run+1] in ['E','e']) and (FLine[Run+2] in ['M','m'])
|
||||||
and (FLine[Run+3] < #33) then //Fiala
|
and (FLine[Run+3] < #33) then //Fiala
|
||||||
begin
|
begin
|
||||||
fTokenID := tkComment;
|
fTokenID := tkComment;
|
||||||
@ -522,6 +530,7 @@ procedure TSynBatSyn.Next;
|
|||||||
begin
|
begin
|
||||||
fTokenPos := Run;
|
fTokenPos := Run;
|
||||||
fProcTable[fLine[Run]];
|
fProcTable[fLine[Run]];
|
||||||
|
if FTokenID <> tkSpace then fIgnoreComment := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSynBatSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
|
function TSynBatSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes;
|
||||||
|
@ -174,6 +174,7 @@ begin
|
|||||||
fSectionAttri.Style := [fsBold];
|
fSectionAttri.Style := [fsBold];
|
||||||
AddAttribute(fSectionAttri);
|
AddAttribute(fSectionAttri);
|
||||||
fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey);
|
fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey);
|
||||||
|
fKeyAttri.Foreground := clBlue;
|
||||||
AddAttribute(fKeyAttri);
|
AddAttribute(fKeyAttri);
|
||||||
fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber);
|
fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber);
|
||||||
AddAttribute(fNumberAttri);
|
AddAttribute(fNumberAttri);
|
||||||
@ -182,6 +183,7 @@ begin
|
|||||||
fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString);
|
fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString);
|
||||||
AddAttribute(fStringAttri);
|
AddAttribute(fStringAttri);
|
||||||
fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol);
|
fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol);
|
||||||
|
fSymbolAttri.Foreground := clRed;
|
||||||
AddAttribute(fSymbolAttri);
|
AddAttribute(fSymbolAttri);
|
||||||
SetAttributesOnChange(@DefHighlightChange);
|
SetAttributesOnChange(@DefHighlightChange);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user