Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / Kate_File_Template.pm
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 'katetemplate.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7
8 #kate xml version 1.00
9 #kate version 2.3
10 #kate author Anders Lund
11 #generated: Sun Feb  3 22:02:05 2008, localtime
12
13 package Syntax::Highlight::Engine::Kate::Kate_File_Template;
14
15 our $VERSION = '0.06';
16
17 use strict;
18 use warnings;
19 use base('Syntax::Highlight::Engine::Kate::Template');
20
21 sub new {
22    my $proto = shift;
23    my $class = ref($proto) || $proto;
24    my $self = $class->SUPER::new(@_);
25    $self->attributes({
26       'Comment' => 'Comment',
27       'Error' => 'Error',
28       'Escape' => 'Others',
29       'Header Keyword' => 'Operator',
30       'Header Text' => 'Normal',
31       'Keyword' => 'Keyword',
32       'Macro' => 'DataType',
33       'Normal Text' => 'Normal',
34       'Property' => 'DecVal',
35       'Property Value' => 'String',
36    });
37    $self->listAdd('macros',
38       'date',
39       'datetime',
40       'email',
41       'month',
42       'organisation',
43       'realname',
44       'time',
45       'username',
46       'year',
47    );
48    $self->listAdd('properties',
49       'author',
50       'description',
51       'documentname',
52       'group',
53       'highlight',
54       'icon',
55       'template',
56    );
57    $self->contextdata({
58       'Normal Text' => {
59          callback => \&parseNormalText,
60          attribute => 'Normal Text',
61          lineending => '#pop',
62       },
63       'escape' => {
64          callback => \&parseescape,
65          attribute => 'Escape',
66       },
67       'header' => {
68          callback => \&parseheader,
69          attribute => 'Comment',
70          lineending => '#pop',
71       },
72       'headervalue' => {
73          callback => \&parseheadervalue,
74          attribute => 'Property Value',
75          lineending => '#pop#pop',
76       },
77       'macros' => {
78          callback => \&parsemacros,
79          attribute => 'Error',
80          lineending => '#pop',
81       },
82    });
83    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
84    $self->basecontext('Normal Text');
85    $self->keywordscase(0);
86    $self->initialize;
87    bless ($self, $class);
88    return $self;
89 }
90
91 sub language {
92    return 'Kate File Template';
93 }
94
95 sub parseNormalText {
96    my ($self, $text) = @_;
97    # String => '^katetemplate:'
98    # attribute => 'Header Keyword'
99    # context => 'header'
100    # type => 'RegExpr'
101    if ($self->testRegExpr($text, '^katetemplate:', 0, 0, 0, undef, 0, 'header', 'Header Keyword')) {
102       return 1
103    }
104    # String => '\\[$%]\{[^}\s]+\}'
105    # attribute => 'Normal'
106    # context => 'escape'
107    # lookAhead => 'true'
108    # type => 'RegExpr'
109    if ($self->testRegExpr($text, '\\\\[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'escape', 'Normal')) {
110       return 1
111    }
112    # String => '[$%]\{[^}\s]+\}'
113    # attribute => 'Macro'
114    # context => 'macros'
115    # lookAhead => 'true'
116    # type => 'RegExpr'
117    if ($self->testRegExpr($text, '[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'macros', 'Macro')) {
118       return 1
119    }
120    # attribute => 'Escape'
121    # char => '\'
122    # char1 => '^'
123    # context => '#stay'
124    # type => 'Detect2Chars'
125    if ($self->testDetect2Chars($text, '\\', '^', 0, 0, 0, undef, 0, '#stay', 'Escape')) {
126       return 1
127    }
128    # attribute => 'Keyword'
129    # char => '^'
130    # context => '#stay'
131    # type => 'DetectChar'
132    if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
133       return 1
134    }
135    return 0;
136 };
137
138 sub parseescape {
139    my ($self, $text) = @_;
140    # attribute => 'Escape'
141    # char => '\'
142    # char1 => '$'
143    # context => '#pop'
144    # type => 'Detect2Chars'
145    if ($self->testDetect2Chars($text, '\\', '$', 0, 0, 0, undef, 0, '#pop', 'Escape')) {
146       return 1
147    }
148    return 0;
149 };
150
151 sub parseheader {
152    my ($self, $text) = @_;
153    # String => 'properties'
154    # attribute => 'Property'
155    # context => 'headervalue'
156    # type => 'keyword'
157    if ($self->testKeyword($text, 'properties', 0, undef, 0, 'headervalue', 'Property')) {
158       return 1
159    }
160    return 0;
161 };
162
163 sub parseheadervalue {
164    my ($self, $text) = @_;
165    # attribute => 'Header Text'
166    # char => '='
167    # context => '#stay'
168    # type => 'DetectChar'
169    if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#stay', 'Header Text')) {
170       return 1
171    }
172    # String => ' \w+\s*='
173    # context => '#pop'
174    # lookAhead => 'true'
175    # type => 'RegExpr'
176    if ($self->testRegExpr($text, ' \\w+\\s*=', 0, 0, 1, undef, 0, '#pop', undef)) {
177       return 1
178    }
179    return 0;
180 };
181
182 sub parsemacros {
183    my ($self, $text) = @_;
184    # attribute => 'Keyword'
185    # char => '$'
186    # char1 => '{'
187    # context => '#stay'
188    # type => 'Detect2Chars'
189    if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
190       return 1
191    }
192    # attribute => 'Keyword'
193    # char => '%'
194    # char1 => '{'
195    # context => '#stay'
196    # type => 'Detect2Chars'
197    if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
198       return 1
199    }
200    # attribute => 'Keyword'
201    # char => '}'
202    # context => '#pop'
203    # type => 'DetectChar'
204    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) {
205       return 1
206    }
207    # String => '[^}\s]+'
208    # attribute => 'Macro'
209    # context => '#stay'
210    # type => 'RegExpr'
211    if ($self->testRegExpr($text, '[^}\\s]+', 0, 0, 0, undef, 0, '#stay', 'Macro')) {
212       return 1
213    }
214    # String => 'macros'
215    # attribute => 'Keyword'
216    # context => '#stay'
217    # type => 'keyword'
218    if ($self->testKeyword($text, 'macros', 0, undef, 0, '#stay', 'Keyword')) {
219       return 1
220    }
221    return 0;
222 };
223
224
225 1;
226
227 __END__
228
229 =head1 NAME
230
231 Syntax::Highlight::Engine::Kate::Kate_File_Template - a Plugin for Kate File Template syntax highlighting
232
233 =head1 SYNOPSIS
234
235  require Syntax::Highlight::Engine::Kate::Kate_File_Template;
236  my $sh = new Syntax::Highlight::Engine::Kate::Kate_File_Template([
237  ]);
238
239 =head1 DESCRIPTION
240
241 Syntax::Highlight::Engine::Kate::Kate_File_Template is a  plugin module that provides syntax highlighting
242 for Kate File Template to the Syntax::Haghlight::Engine::Kate highlighting engine.
243
244 This code is generated from the syntax definition files used
245 by the Kate project.
246 It works quite fine, but can use refinement and optimization.
247
248 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
249
250 =cut
251
252 =head1 AUTHOR
253
254 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
255
256 =cut
257
258 =head1 BUGS
259
260 Unknown. If you find any, please contact the author
261
262 =cut
263