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 'r.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.04 |
9
|
|
|
|
|
|
|
#kate version 2.1 |
10
|
|
|
|
|
|
|
#kate author E.L. Willighagen |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::R_Script; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1266
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
50
|
|
18
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
19
|
1
|
|
|
1
|
|
7
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
724
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
0
|
758
|
my $proto = shift; |
23
|
1
|
|
33
|
|
|
12
|
my $class = ref($proto) || $proto; |
24
|
1
|
|
|
|
|
13
|
my $self = $class->SUPER::new(@_); |
25
|
1
|
|
|
|
|
18
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
27
|
|
|
|
|
|
|
'Control Structure' => 'Normal', |
28
|
|
|
|
|
|
|
'Infix' => 'Others', |
29
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
30
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
31
|
|
|
|
|
|
|
'Operators' => 'Operator', |
32
|
|
|
|
|
|
|
'Reserved Words' => 'Reserved', |
33
|
|
|
|
|
|
|
'String' => 'String', |
34
|
|
|
|
|
|
|
}); |
35
|
1
|
|
|
|
|
10
|
$self->listAdd('controls', |
36
|
|
|
|
|
|
|
'break', |
37
|
|
|
|
|
|
|
'else', |
38
|
|
|
|
|
|
|
'for', |
39
|
|
|
|
|
|
|
'function', |
40
|
|
|
|
|
|
|
'if', |
41
|
|
|
|
|
|
|
'in', |
42
|
|
|
|
|
|
|
'next', |
43
|
|
|
|
|
|
|
'repeat', |
44
|
|
|
|
|
|
|
'switch', |
45
|
|
|
|
|
|
|
'while', |
46
|
|
|
|
|
|
|
); |
47
|
1
|
|
|
|
|
5
|
$self->listAdd('words', |
48
|
|
|
|
|
|
|
'FALSE', |
49
|
|
|
|
|
|
|
'Inf', |
50
|
|
|
|
|
|
|
'NA', |
51
|
|
|
|
|
|
|
'NULL', |
52
|
|
|
|
|
|
|
'NaN', |
53
|
|
|
|
|
|
|
'TRUE', |
54
|
|
|
|
|
|
|
); |
55
|
1
|
|
|
|
|
17
|
$self->contextdata({ |
56
|
|
|
|
|
|
|
'ctx0' => { |
57
|
|
|
|
|
|
|
callback => \&parsectx0, |
58
|
|
|
|
|
|
|
attribute => 'Normal Text', |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
'ctx1' => { |
61
|
|
|
|
|
|
|
callback => \&parsectx1, |
62
|
|
|
|
|
|
|
attribute => 'String', |
63
|
|
|
|
|
|
|
}, |
64
|
|
|
|
|
|
|
}); |
65
|
1
|
|
|
|
|
10
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
66
|
1
|
|
|
|
|
4
|
$self->basecontext('ctx0'); |
67
|
1
|
|
|
|
|
9
|
$self->keywordscase(0); |
68
|
1
|
|
|
|
|
4
|
$self->initialize; |
69
|
1
|
|
|
|
|
3
|
bless ($self, $class); |
70
|
1
|
|
|
|
|
4
|
return $self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub language { |
74
|
0
|
|
|
0
|
0
|
|
return 'R Script'; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub parsectx0 { |
78
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
79
|
|
|
|
|
|
|
# String => 'controls' |
80
|
|
|
|
|
|
|
# attribute => 'Control Structure' |
81
|
|
|
|
|
|
|
# context => '#stay' |
82
|
|
|
|
|
|
|
# type => 'keyword' |
83
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'controls', 0, undef, 0, '#stay', 'Control Structure')) { |
84
|
0
|
|
|
|
|
|
return 1 |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
# String => 'words' |
87
|
|
|
|
|
|
|
# attribute => 'Reserved Words' |
88
|
|
|
|
|
|
|
# context => '#stay' |
89
|
|
|
|
|
|
|
# type => 'keyword' |
90
|
0
|
0
|
|
|
|
|
if ($self->testKeyword($text, 'words', 0, undef, 0, '#stay', 'Reserved Words')) { |
91
|
0
|
|
|
|
|
|
return 1 |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
# attribute => 'String' |
94
|
|
|
|
|
|
|
# char => '"' |
95
|
|
|
|
|
|
|
# context => 'ctx1' |
96
|
|
|
|
|
|
|
# type => 'DetectChar' |
97
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'ctx1', 'String')) { |
98
|
0
|
|
|
|
|
|
return 1 |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
# String => '[a-zA-Z_]+ *\(' |
101
|
|
|
|
|
|
|
# attribute => 'Keyword' |
102
|
|
|
|
|
|
|
# context => '#stay' |
103
|
|
|
|
|
|
|
# type => 'RegExpr' |
104
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '[a-zA-Z_]+ *\\(', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
105
|
0
|
|
|
|
|
|
return 1 |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
# attribute => 'Keyword' |
108
|
|
|
|
|
|
|
# char => '(' |
109
|
|
|
|
|
|
|
# context => '#stay' |
110
|
|
|
|
|
|
|
# type => 'DetectChar' |
111
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
112
|
0
|
|
|
|
|
|
return 1 |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
# attribute => 'Keyword' |
115
|
|
|
|
|
|
|
# char => ')' |
116
|
|
|
|
|
|
|
# context => '#stay' |
117
|
|
|
|
|
|
|
# type => 'DetectChar' |
118
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
119
|
0
|
|
|
|
|
|
return 1 |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
# String => '#.*$' |
122
|
|
|
|
|
|
|
# attribute => 'Comment' |
123
|
|
|
|
|
|
|
# context => '#stay' |
124
|
|
|
|
|
|
|
# type => 'RegExpr' |
125
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { |
126
|
0
|
|
|
|
|
|
return 1 |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
# String => '+-*/^:$~!&|=><@' |
129
|
|
|
|
|
|
|
# attribute => 'Operators' |
130
|
|
|
|
|
|
|
# context => '#stay' |
131
|
|
|
|
|
|
|
# type => 'AnyChar' |
132
|
0
|
0
|
|
|
|
|
if ($self->testAnyChar($text, '+-*/^:$~!&|=><@', 0, 0, undef, 0, '#stay', 'Operators')) { |
133
|
0
|
|
|
|
|
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
# String => '%[a-zA-Z_]*%' |
136
|
|
|
|
|
|
|
# attribute => 'Operators' |
137
|
|
|
|
|
|
|
# context => '#stay' |
138
|
|
|
|
|
|
|
# type => 'RegExpr' |
139
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '%[a-zA-Z_]*%', 0, 0, 0, undef, 0, '#stay', 'Operators')) { |
140
|
0
|
|
|
|
|
|
return 1 |
141
|
|
|
|
|
|
|
} |
142
|
0
|
|
|
|
|
|
return 0; |
143
|
|
|
|
|
|
|
}; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub parsectx1 { |
146
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
147
|
|
|
|
|
|
|
# attribute => 'String' |
148
|
|
|
|
|
|
|
# char => '"' |
149
|
|
|
|
|
|
|
# context => '#pop' |
150
|
|
|
|
|
|
|
# type => 'DetectChar' |
151
|
0
|
0
|
|
|
|
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
152
|
0
|
|
|
|
|
|
return 1 |
153
|
|
|
|
|
|
|
} |
154
|
0
|
|
|
|
|
|
return 0; |
155
|
|
|
|
|
|
|
}; |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
1; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
__END__ |