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 'ini.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.0 |
9 | #kate author Jan Janssen (medhefgo@web.de) |
10 | #generated: Sun Feb 3 22:02:05 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::INI_Files; |
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 | 'Assignment' => 'Others', |
26 | 'Comment' => 'Comment', |
27 | 'Float' => 'Float', |
28 | 'Int' => 'DecVal', |
29 | 'Keyword' => 'Keyword', |
30 | 'Normal Text' => 'DataType', |
31 | 'Section' => 'Keyword', |
32 | 'Value' => 'String', |
33 | }); |
34 | $self->listAdd('keywords', |
35 | 'Default', |
36 | 'Defaults', |
37 | 'E_ALL', |
38 | 'E_COMPILE_ERROR', |
39 | 'E_COMPILE_WARNING', |
40 | 'E_CORE_ERROR', |
41 | 'E_CORE_WARNING', |
42 | 'E_ERROR', |
43 | 'E_NOTICE', |
44 | 'E_PARSE', |
45 | 'E_STRICT', |
46 | 'E_USER_ERROR', |
47 | 'E_USER_NOTICE', |
48 | 'E_USER_WARNING', |
49 | 'E_WARNING', |
50 | 'False', |
51 | 'Localhost', |
52 | 'No', |
53 | 'Normal', |
54 | 'Null', |
55 | 'Off', |
56 | 'On', |
57 | 'True', |
58 | 'Yes', |
59 | ); |
60 | $self->contextdata({ |
61 | 'Comment' => { |
62 | callback => \&parseComment, |
63 | attribute => 'Comment', |
64 | lineending => '#pop', |
65 | }, |
66 | 'Value' => { |
67 | callback => \&parseValue, |
68 | attribute => 'Value', |
69 | lineending => '#pop', |
70 | }, |
71 | 'ini' => { |
72 | callback => \&parseini, |
73 | attribute => 'Normal Text', |
74 | }, |
75 | }); |
76 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
77 | $self->basecontext('ini'); |
78 | $self->keywordscase(0); |
79 | $self->initialize; |
80 | bless ($self, $class); |
81 | return $self; |
82 | } |
83 | |
84 | sub language { |
85 | return 'INI Files'; |
86 | } |
87 | |
88 | sub parseComment { |
89 | my ($self, $text) = @_; |
90 | # type => 'DetectSpaces' |
91 | if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
92 | return 1 |
93 | } |
94 | # context => '##Alerts' |
95 | # type => 'IncludeRules' |
96 | if ($self->includePlugin('Alerts', $text)) { |
97 | return 1 |
98 | } |
99 | # type => 'DetectIdentifier' |
100 | if ($self->testDetectIdentifier($text, 0, undef, 0, '#stay', undef)) { |
101 | return 1 |
102 | } |
103 | return 0; |
104 | }; |
105 | |
106 | sub parseValue { |
107 | my ($self, $text) = @_; |
108 | # attribute => 'Float' |
109 | # type => 'Float' |
110 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
111 | return 1 |
112 | } |
113 | # attribute => 'Int' |
114 | # type => 'Int' |
115 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Int')) { |
116 | return 1 |
117 | } |
118 | # String => 'keywords' |
119 | # attribute => 'Keyword' |
120 | # type => 'keyword' |
121 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
122 | return 1 |
123 | } |
124 | # String => ';.*$' |
125 | # attribute => 'Comment' |
126 | # context => '#pop' |
127 | # type => 'RegExpr' |
128 | if ($self->testRegExpr($text, ';.*$', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
129 | return 1 |
130 | } |
131 | # String => '#.*$' |
132 | # attribute => 'Comment' |
133 | # context => '#pop' |
134 | # type => 'RegExpr' |
135 | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#pop', 'Comment')) { |
136 | return 1 |
137 | } |
138 | return 0; |
139 | }; |
140 | |
141 | sub parseini { |
142 | my ($self, $text) = @_; |
143 | # attribute => 'Section' |
144 | # beginRegion => 'Section' |
145 | # char => '[' |
146 | # char1 => ']' |
147 | # context => '#pop' |
148 | # endRegion => 'Section' |
149 | # type => 'RangeDetect' |
150 | if ($self->testRangeDetect($text, '[', ']', 0, 0, undef, 0, '#pop', 'Section')) { |
151 | return 1 |
152 | } |
153 | # attribute => 'Assignment' |
154 | # char => '=' |
155 | # context => 'Value' |
156 | # type => 'DetectChar' |
157 | if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, 'Value', 'Assignment')) { |
158 | return 1 |
159 | } |
160 | # attribute => 'Comment' |
161 | # char => ';' |
162 | # context => 'Comment' |
163 | # firstNonSpace => 'true' |
164 | # type => 'DetectChar' |
165 | if ($self->testDetectChar($text, ';', 0, 0, 0, undef, 1, 'Comment', 'Comment')) { |
166 | return 1 |
167 | } |
168 | # attribute => 'Comment' |
169 | # char => '#' |
170 | # context => 'Comment' |
171 | # firstNonSpace => 'true' |
172 | # type => 'DetectChar' |
173 | if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 1, 'Comment', 'Comment')) { |
174 | return 1 |
175 | } |
176 | return 0; |
177 | }; |
178 | |
179 | |
180 | 1; |
181 | |
182 | __END__ |
183 | |
184 | =head1 NAME |
185 | |
186 | Syntax::Highlight::Engine::Kate::INI_Files - a Plugin for INI Files syntax highlighting |
187 | |
188 | =head1 SYNOPSIS |
189 | |
190 | require Syntax::Highlight::Engine::Kate::INI_Files; |
191 | my $sh = new Syntax::Highlight::Engine::Kate::INI_Files([ |
192 | ]); |
193 | |
194 | =head1 DESCRIPTION |
195 | |
196 | Syntax::Highlight::Engine::Kate::INI_Files is a plugin module that provides syntax highlighting |
197 | for INI Files to the Syntax::Haghlight::Engine::Kate highlighting engine. |
198 | |
199 | This code is generated from the syntax definition files used |
200 | by the Kate project. |
201 | It works quite fine, but can use refinement and optimization. |
202 | |
203 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
204 | |
205 | =cut |
206 | |
207 | =head1 AUTHOR |
208 | |
209 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
210 | |
211 | =cut |
212 | |
213 | =head1 BUGS |
214 | |
215 | Unknown. If you find any, please contact the author |
216 | |
217 | =cut |
218 | |