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.
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
10 #kate author Anders Lund
11 #generated: Sun Feb 3 22:02:05 2008, localtime
13 package Syntax::Highlight::Engine::Kate::Kate_File_Template;
15 our $VERSION = '0.06';
19 use base('Syntax::Highlight::Engine::Kate::Template');
23 my $class = ref($proto) || $proto;
24 my $self = $class->SUPER::new(@_);
26 'Comment' => 'Comment',
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',
37 $self->listAdd('macros',
48 $self->listAdd('properties',
59 callback => \&parseNormalText,
60 attribute => 'Normal Text',
64 callback => \&parseescape,
65 attribute => 'Escape',
68 callback => \&parseheader,
69 attribute => 'Comment',
73 callback => \&parseheadervalue,
74 attribute => 'Property Value',
75 lineending => '#pop#pop',
78 callback => \&parsemacros,
83 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
84 $self->basecontext('Normal Text');
85 $self->keywordscase(0);
87 bless ($self, $class);
92 return 'Kate File Template';
96 my ($self, $text) = @_;
97 # String => '^katetemplate:'
98 # attribute => 'Header Keyword'
101 if ($self->testRegExpr($text, '^katetemplate:', 0, 0, 0, undef, 0, 'header', 'Header Keyword')) {
104 # String => '\\[$%]\{[^}\s]+\}'
105 # attribute => 'Normal'
106 # context => 'escape'
107 # lookAhead => 'true'
109 if ($self->testRegExpr($text, '\\\\[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'escape', 'Normal')) {
112 # String => '[$%]\{[^}\s]+\}'
113 # attribute => 'Macro'
114 # context => 'macros'
115 # lookAhead => 'true'
117 if ($self->testRegExpr($text, '[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'macros', 'Macro')) {
120 # attribute => 'Escape'
124 # type => 'Detect2Chars'
125 if ($self->testDetect2Chars($text, '\\', '^', 0, 0, 0, undef, 0, '#stay', 'Escape')) {
128 # attribute => 'Keyword'
131 # type => 'DetectChar'
132 if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
139 my ($self, $text) = @_;
140 # attribute => 'Escape'
144 # type => 'Detect2Chars'
145 if ($self->testDetect2Chars($text, '\\', '$', 0, 0, 0, undef, 0, '#pop', 'Escape')) {
152 my ($self, $text) = @_;
153 # String => 'properties'
154 # attribute => 'Property'
155 # context => 'headervalue'
157 if ($self->testKeyword($text, 'properties', 0, undef, 0, 'headervalue', 'Property')) {
163 sub parseheadervalue {
164 my ($self, $text) = @_;
165 # attribute => 'Header Text'
168 # type => 'DetectChar'
169 if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#stay', 'Header Text')) {
172 # String => ' \w+\s*='
174 # lookAhead => 'true'
176 if ($self->testRegExpr($text, ' \\w+\\s*=', 0, 0, 1, undef, 0, '#pop', undef)) {
183 my ($self, $text) = @_;
184 # attribute => 'Keyword'
188 # type => 'Detect2Chars'
189 if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
192 # attribute => 'Keyword'
196 # type => 'Detect2Chars'
197 if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
200 # attribute => 'Keyword'
203 # type => 'DetectChar'
204 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) {
207 # String => '[^}\s]+'
208 # attribute => 'Macro'
211 if ($self->testRegExpr($text, '[^}\\s]+', 0, 0, 0, undef, 0, '#stay', 'Macro')) {
215 # attribute => 'Keyword'
218 if ($self->testKeyword($text, 'macros', 0, undef, 0, '#stay', 'Keyword')) {
231 Syntax::Highlight::Engine::Kate::Kate_File_Template - a Plugin for Kate File Template syntax highlighting
235 require Syntax::Highlight::Engine::Kate::Kate_File_Template;
236 my $sh = new Syntax::Highlight::Engine::Kate::Kate_File_Template([
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.
244 This code is generated from the syntax definition files used
246 It works quite fine, but can use refinement and optimization.
248 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
254 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
260 Unknown. If you find any, please contact the author