-
Notifications
You must be signed in to change notification settings - Fork 2
/
xcsynhighlighter.pas
69 lines (56 loc) · 1.56 KB
/
xcsynhighlighter.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
unit XCSynHighlighter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, SynFacilHighlighter, Graphics;
type
TXCSynHighlighter = class(TSynFacilSyn)
private
{ private declarations }
public
{ public declarations }
constructor Create(AOwner: TComponent); overload;
// destructor Destroy; overload;
end;
const
arrKeyWords : array[0..68] of string = (
'abs', 'asm', 'atn',
'cast', 'call', 'charat', 'const', 'cos', 'curpos',
'data', 'dec', 'deek', 'dim', 'disableirq', 'doke',
'enableirq', 'else', 'end', 'endif', 'endproc', 'endwhile',
'ferr', 'for',
'gosub', 'goto',
'if', 'inc', 'incbin', 'include', 'inkey', 'input',
'let', 'load', 'lshift',
'memcpy', 'memset', 'memshift',
'next',
'on', 'origin',
'peek', 'poke', 'pragma', 'print', 'proc',
'repeat', 'return', 'rnd', 'rshift',
'save', 'sgn', 'sin', 'sqr', 'strcmp', 'strcpy', 'strlen', 'strncpy', 'strpos', 'sys',
'tan', 'textat', 'then', 'to',
'until', 'usr',
'val',
'wait', 'watch', 'while'
);
implementation
constructor TXCSynHighlighter.Create(AOwner: TComponent);
var
i: Integer;
begin
inherited Create(AOwner);
with self do begin
ClearSpecials;
CreateAttributes;
ClearMethodTables;
DefTokIdentif('[A-Za-z$%i]','[A-Za-z0-9]*');
// DefTokContent('[0..9.]','[0-9xabcdefXABCDEF]*','', tkNumber);
for i := 0 to Length(arrKeyWords)-1 do begin
self.AddKeyword(arrKeyWords[i])
end;
tkKeyword.Foreground := clBlack;
tkKeyword.Style := [fsBold];
Rebuild;
end
end;
end.