Commit | Line | Data |
3fea05b9 |
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 'rpmspec.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.1 |
9 | #kate version 2.4 |
10 | #generated: Sun Feb 3 22:02:06 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::RPM_Spec; |
13 | |
14 | our $VERSION = '0.06'; |
15 | |
16 | use strict; |
17 | use warnings; |
18 | use base('Syntax::Highlight::Engine::Kate::Template'); |
19 | |
20 | sub new { |
21 | my $proto = shift; |
22 | my $class = ref($proto) || $proto; |
23 | my $self = $class->SUPER::new(@_); |
24 | $self->attributes({ |
25 | 'Blue' => 'DecVal', |
26 | 'Comment' => 'Comment', |
27 | 'Data' => 'DataType', |
28 | 'Keyword' => 'Keyword', |
29 | 'Normal Text' => 'Normal', |
30 | 'Red' => 'String', |
31 | }); |
32 | $self->listAdd('keywords', |
33 | 'BuildArch', |
34 | 'BuildArchitectures', |
35 | 'BuildConflicts', |
36 | 'BuildRequires', |
37 | 'BuildRoot', |
38 | 'Conflicts', |
39 | 'Copyright', |
40 | 'Distribution', |
41 | 'Epoch', |
42 | 'ExcludeArch', |
43 | 'ExcludeOs', |
44 | 'ExclusiveArch', |
45 | 'ExclusiveOs', |
46 | 'Group', |
47 | 'License', |
48 | 'Name', |
49 | 'Obsoletes', |
50 | 'Packager', |
51 | 'PreReq', |
52 | 'Prefix', |
53 | 'Provides', |
54 | 'Release', |
55 | 'Requires', |
56 | 'Serial', |
57 | 'Source', |
58 | 'Summary', |
59 | 'URL', |
60 | 'Url', |
61 | 'Vendor', |
62 | 'Version', |
63 | ); |
64 | $self->listAdd('types', |
65 | 'Artistic', |
66 | 'GPL', |
67 | 'LGPL', |
68 | ); |
69 | $self->contextdata({ |
70 | 'Comment' => { |
71 | callback => \&parseComment, |
72 | attribute => 'Comment', |
73 | lineending => '#pop', |
74 | }, |
75 | 'Normal' => { |
76 | callback => \&parseNormal, |
77 | attribute => 'Normal Text', |
78 | }, |
79 | 'Some Context' => { |
80 | callback => \&parseSomeContext, |
81 | attribute => 'Keyword', |
82 | lineending => '#pop', |
83 | }, |
84 | 'Some Context2' => { |
85 | callback => \&parseSomeContext2, |
86 | attribute => 'Blue', |
87 | lineending => '#pop', |
88 | }, |
89 | }); |
90 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
91 | $self->basecontext('Normal'); |
92 | $self->keywordscase(0); |
93 | $self->initialize; |
94 | bless ($self, $class); |
95 | return $self; |
96 | } |
97 | |
98 | sub language { |
99 | return 'RPM Spec'; |
100 | } |
101 | |
102 | sub parseComment { |
103 | my ($self, $text) = @_; |
104 | return 0; |
105 | }; |
106 | |
107 | sub parseNormal { |
108 | my ($self, $text) = @_; |
109 | # String => 'keywords' |
110 | # attribute => 'Keyword' |
111 | # context => '#stay' |
112 | # type => 'keyword' |
113 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
114 | return 1 |
115 | } |
116 | # String => 'types' |
117 | # attribute => 'Data' |
118 | # context => '#stay' |
119 | # type => 'keyword' |
120 | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data')) { |
121 | return 1 |
122 | } |
123 | # String => '%\w*' |
124 | # attribute => 'Red' |
125 | # context => '#stay' |
126 | # type => 'RegExpr' |
127 | if ($self->testRegExpr($text, '%\\w*', 0, 0, 0, undef, 0, '#stay', 'Red')) { |
128 | return 1 |
129 | } |
130 | # attribute => 'Comment' |
131 | # char => '#' |
132 | # context => 'Comment' |
133 | # type => 'DetectChar' |
134 | if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
135 | return 1 |
136 | } |
137 | # String => '\{\w*' |
138 | # attribute => 'Keyword' |
139 | # context => 'Some Context' |
140 | # type => 'RegExpr' |
141 | if ($self->testRegExpr($text, '\\{\\w*', 0, 0, 0, undef, 0, 'Some Context', 'Keyword')) { |
142 | return 1 |
143 | } |
144 | # String => '<\s*[\w@\.]*' |
145 | # attribute => 'Blue' |
146 | # context => 'Some Context2' |
147 | # type => 'RegExpr' |
148 | if ($self->testRegExpr($text, '<\\s*[\\w@\\.]*', 0, 0, 0, undef, 0, 'Some Context2', 'Blue')) { |
149 | return 1 |
150 | } |
151 | # String => '\$\w*' |
152 | # attribute => 'Data' |
153 | # context => '#stay' |
154 | # type => 'RegExpr' |
155 | if ($self->testRegExpr($text, '\\$\\w*', 0, 0, 0, undef, 0, '#stay', 'Data')) { |
156 | return 1 |
157 | } |
158 | # String => '(Source|Patch)\d*' |
159 | # attribute => 'Keyword' |
160 | # context => '#stay' |
161 | # type => 'RegExpr' |
162 | if ($self->testRegExpr($text, '(Source|Patch)\\d*', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
163 | return 1 |
164 | } |
165 | # String => '\*.*' |
166 | # attribute => 'Keyword' |
167 | # context => '#stay' |
168 | # firstNonSpace => 'true' |
169 | # type => 'RegExpr' |
170 | if ($self->testRegExpr($text, '\\*.*', 0, 0, 0, undef, 1, '#stay', 'Keyword')) { |
171 | return 1 |
172 | } |
173 | # attribute => 'Blue' |
174 | # context => '#stay' |
175 | # type => 'Int' |
176 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Blue')) { |
177 | return 1 |
178 | } |
179 | return 0; |
180 | }; |
181 | |
182 | sub parseSomeContext { |
183 | my ($self, $text) = @_; |
184 | # attribute => 'Keyword' |
185 | # char => '}' |
186 | # context => '#pop' |
187 | # type => 'DetectChar' |
188 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
189 | return 1 |
190 | } |
191 | return 0; |
192 | }; |
193 | |
194 | sub parseSomeContext2 { |
195 | my ($self, $text) = @_; |
196 | # attribute => 'Blue' |
197 | # char => '>' |
198 | # context => '#pop' |
199 | # type => 'DetectChar' |
200 | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Blue')) { |
201 | return 1 |
202 | } |
203 | return 0; |
204 | }; |
205 | |
206 | |
207 | 1; |
208 | |
209 | __END__ |
210 | |
211 | =head1 NAME |
212 | |
213 | Syntax::Highlight::Engine::Kate::RPM_Spec - a Plugin for RPM Spec syntax highlighting |
214 | |
215 | =head1 SYNOPSIS |
216 | |
217 | require Syntax::Highlight::Engine::Kate::RPM_Spec; |
218 | my $sh = new Syntax::Highlight::Engine::Kate::RPM_Spec([ |
219 | ]); |
220 | |
221 | =head1 DESCRIPTION |
222 | |
223 | Syntax::Highlight::Engine::Kate::RPM_Spec is a plugin module that provides syntax highlighting |
224 | for RPM Spec to the Syntax::Haghlight::Engine::Kate highlighting engine. |
225 | |
226 | This code is generated from the syntax definition files used |
227 | by the Kate project. |
228 | It works quite fine, but can use refinement and optimization. |
229 | |
230 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
231 | |
232 | =cut |
233 | |
234 | =head1 AUTHOR |
235 | |
236 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
237 | |
238 | =cut |
239 | |
240 | =head1 BUGS |
241 | |
242 | Unknown. If you find any, please contact the author |
243 | |
244 | =cut |
245 | |