line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. |
2
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
3
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This file was generated from the 'kbasic.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.02 |
9
|
|
|
|
|
|
|
#kate version 2.1 |
10
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::KBasic; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
546
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
17
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
18
|
1
|
|
|
1
|
|
6
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
456
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
0
|
553
|
my $proto = shift; |
22
|
1
|
|
33
|
|
|
7
|
my $class = ref($proto) || $proto; |
23
|
1
|
|
|
|
|
7
|
my $self = $class->SUPER::new(@_); |
24
|
1
|
|
|
|
|
9
|
$self->attributes({ |
25
|
|
|
|
|
|
|
'Comment' => 'Comment', |
26
|
|
|
|
|
|
|
'Identifier' => 'Others', |
27
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
28
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
29
|
|
|
|
|
|
|
'String' => 'String', |
30
|
|
|
|
|
|
|
'Types' => 'DataType', |
31
|
|
|
|
|
|
|
}); |
32
|
1
|
|
|
|
|
5
|
$self->listAdd('keywords', |
33
|
|
|
|
|
|
|
'And', |
34
|
|
|
|
|
|
|
'As', |
35
|
|
|
|
|
|
|
'Close', |
36
|
|
|
|
|
|
|
'Declare', |
37
|
|
|
|
|
|
|
'Dim', |
38
|
|
|
|
|
|
|
'Do', |
39
|
|
|
|
|
|
|
'Else', |
40
|
|
|
|
|
|
|
'End', |
41
|
|
|
|
|
|
|
'Exit', |
42
|
|
|
|
|
|
|
'Explicit', |
43
|
|
|
|
|
|
|
'False', |
44
|
|
|
|
|
|
|
'For', |
45
|
|
|
|
|
|
|
'Function', |
46
|
|
|
|
|
|
|
'Get', |
47
|
|
|
|
|
|
|
'Global', |
48
|
|
|
|
|
|
|
'Goto', |
49
|
|
|
|
|
|
|
'If', |
50
|
|
|
|
|
|
|
'Implements', |
51
|
|
|
|
|
|
|
'In', |
52
|
|
|
|
|
|
|
'Input', |
53
|
|
|
|
|
|
|
'Let', |
54
|
|
|
|
|
|
|
'Load', |
55
|
|
|
|
|
|
|
'Loop', |
56
|
|
|
|
|
|
|
'Next', |
57
|
|
|
|
|
|
|
'Not', |
58
|
|
|
|
|
|
|
'Open', |
59
|
|
|
|
|
|
|
'Option', |
60
|
|
|
|
|
|
|
'Or', |
61
|
|
|
|
|
|
|
'Output', |
62
|
|
|
|
|
|
|
'Print', |
63
|
|
|
|
|
|
|
'Private', |
64
|
|
|
|
|
|
|
'Property', |
65
|
|
|
|
|
|
|
'Public', |
66
|
|
|
|
|
|
|
'Put', |
67
|
|
|
|
|
|
|
'Repeat', |
68
|
|
|
|
|
|
|
'Seek', |
69
|
|
|
|
|
|
|
'Set', |
70
|
|
|
|
|
|
|
'Sub', |
71
|
|
|
|
|
|
|
'Sub', |
72
|
|
|
|
|
|
|
'Then', |
73
|
|
|
|
|
|
|
'To', |
74
|
|
|
|
|
|
|
'True', |
75
|
|
|
|
|
|
|
'Unload', |
76
|
|
|
|
|
|
|
'Until', |
77
|
|
|
|
|
|
|
'Wend', |
78
|
|
|
|
|
|
|
'While', |
79
|
|
|
|
|
|
|
'Xor', |
80
|
|
|
|
|
|
|
); |
81
|
1
|
|
|
|
|
4
|
$self->listAdd('types', |
82
|
|
|
|
|
|
|
'Boolean', |
83
|
|
|
|
|
|
|
'Byte', |
84
|
|
|
|
|
|
|
'Control', |
85
|
|
|
|
|
|
|
'Currency', |
86
|
|
|
|
|
|
|
'Double', |
87
|
|
|
|
|
|
|
'Integer', |
88
|
|
|
|
|
|
|
'Long', |
89
|
|
|
|
|
|
|
'Object', |
90
|
|
|
|
|
|
|
'Single', |
91
|
|
|
|
|
|
|
'String', |
92
|
|
|
|
|
|
|
'Variant', |
93
|
|
|
|
|
|
|
); |
94
|
1
|
|
|
|
|
11
|
$self->contextdata({ |
95
|
|
|
|
|
|
|
'Comment' => { |
96
|
|
|
|
|
|
|
callback => \&parseComment, |
97
|
|
|
|
|
|
|
attribute => 'Comment', |
98
|
|
|
|
|
|
|
lineending => '#pop', |
99
|
|
|
|
|
|
|
}, |
100
|
|
|
|
|
|
|
'Normal' => { |
101
|
|
|
|
|
|
|
callback => \&parseNormal, |
102
|
|
|
|
|
|
|
attribute => 'Normal Text', |
103
|
|
|
|
|
|
|
}, |
104
|
|
|
|
|
|
|
'String' => { |
105
|
|
|
|
|
|
|
callback => \&parseString, |
106
|
|
|
|
|
|
|
attribute => 'String', |
107
|
|
|
|
|
|
|
lineending => '#pop', |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
}); |
110
|
1
|
|
|
|
|
5
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
111
|
1
|
|
|
|
|
4
|
$self->basecontext('Normal'); |
112
|
1
|
|
|
|
|
5
|
$self->keywordscase(0); |
113
|
1
|
|
|
|
|
4
|
$self->initialize; |
114
|
1
|
|
|
|
|
2
|
bless ($self, $class); |
115
|
1
|
|
|
|
|
3
|
return $self; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
sub language { |
119
|
0
|
|
|
0
|
0
|
|
return 'KBasic'; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub parseComment { |
123
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
124
|
0
|
|
|
|
|
|
return 0; |
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub parseNormal { |
128
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
129
|
|
|
|
|
|
|
# String => 'keywords' |
130
|
|
|
|
|
|
|
# attribute => 'Keyword' |
131
|
|
|
|
|
|
|
# context => '#stay' |
132
|
|
|
|
|
|
|
# type => 'keyword' |
133
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
134
|
0
|
|
|
|
|
|
return 1 |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
# String => 'types' |
137
|
|
|
|
|
|
|
# attribute => 'Identifier' |
138
|
|
|
|
|
|
|
# context => '#stay' |
139
|
|
|
|
|
|
|
# type => 'keyword' |
140
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Identifier')) { |
141
|
0
|
|
|
|
|
|
return 1 |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
# attribute => 'String' |
144
|
|
|
|
|
|
|
# context => '#stay' |
145
|
|
|
|
|
|
|
# type => 'Float' |
146
|
0
|
0
|
|
|
|
|
if ($self->testFloat($text, 0, undef, 0, '#stay', 'String')) { |
147
|
0
|
|
|
|
|
|
return 1 |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
# attribute => 'Types' |
150
|
|
|
|
|
|
|
# context => '#stay' |
151
|
|
|
|
|
|
|
# type => 'Int' |
152
|
0
|
0
|
|
|
|
|
if ($self->testInt($text, 0, undef, 0, '#stay', 'Types')) { |
153
|
0
|
|
|
|
|
|
return 1 |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
# attribute => 'String' |
156
|
|
|
|
|
|
|
# char => '"' |
157
|
|
|
|
|
|
|
# context => 'String' |
158
|
|
|
|
|
|
|
# type => 'DetectChar' |
159
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
160
|
0
|
|
|
|
|
|
return 1 |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
# attribute => 'Comment' |
163
|
|
|
|
|
|
|
# char => ''' |
164
|
|
|
|
|
|
|
# context => 'Comment' |
165
|
|
|
|
|
|
|
# type => 'DetectChar' |
166
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
167
|
0
|
|
|
|
|
|
return 1 |
168
|
|
|
|
|
|
|
} |
169
|
0
|
|
|
|
|
|
return 0; |
170
|
|
|
|
|
|
|
}; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub parseString { |
173
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
174
|
|
|
|
|
|
|
# attribute => 'String' |
175
|
|
|
|
|
|
|
# char => ''' |
176
|
|
|
|
|
|
|
# context => '#pop' |
177
|
|
|
|
|
|
|
# type => 'DetectChar' |
178
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '\'', 0, 0, 0, undef, 0, '#pop', 'String')) { |
179
|
0
|
|
|
|
|
|
return 1 |
180
|
|
|
|
|
|
|
} |
181
|
0
|
|
|
|
|
|
return 0; |
182
|
|
|
|
|
|
|
}; |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
1; |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
__END__ |