| 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 | 1 | our $VERSION = '0.14'; | |||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 1 | ▶ | use base('Syntax::Highlight::Engine::Kate::Template'); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | sub new { | ||||||||||||||||||||
| 22 | 1 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 1 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 24 | 1 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||
| 25 | 1 | $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 | 1 | $self->listAdd('macros', | |||||||||||||||||||
| 38 | 'date', | ||||||||||||||||||||
| 39 | 'datetime', | ||||||||||||||||||||
| 40 | 'email', | ||||||||||||||||||||
| 41 | 'month', | ||||||||||||||||||||
| 42 | 'organisation', | ||||||||||||||||||||
| 43 | 'realname', | ||||||||||||||||||||
| 44 | 'time', | ||||||||||||||||||||
| 45 | 'username', | ||||||||||||||||||||
| 46 | 'year', | ||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||
| 48 | 1 | $self->listAdd('properties', | |||||||||||||||||||
| 49 | 'author', | ||||||||||||||||||||
| 50 | 'description', | ||||||||||||||||||||
| 51 | 'documentname', | ||||||||||||||||||||
| 52 | 'group', | ||||||||||||||||||||
| 53 | 'highlight', | ||||||||||||||||||||
| 54 | 'icon', | ||||||||||||||||||||
| 55 | 'template', | ||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||
| 57 | 1 | $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 | 1 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 84 | 1 | $self->basecontext('Normal Text'); | |||||||||||||||||||
| 85 | 1 | $self->keywordscase(0); | |||||||||||||||||||
| 86 | 1 | $self->initialize; | |||||||||||||||||||
| 87 | 1 | bless ($self, $class); | |||||||||||||||||||
| 88 | 1 | return $self; | |||||||||||||||||||
| 89 | } | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | sub language { | ||||||||||||||||||||
| 92 | 0 | ▶ | return 'Kate File Template'; | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 93 | } | ||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | sub parseNormalText { | ||||||||||||||||||||
| 96 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseNormalText: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||
| 97 | # String => '^katetemplate:' | ||||||||||||||||||||
| 98 | # attribute => 'Header Keyword' | ||||||||||||||||||||
| 99 | # context => 'header' | ||||||||||||||||||||
| 100 | # type => 'RegExpr' | ||||||||||||||||||||
| 101 | 0 | ▶ | if ($self->testRegExpr($text, '^katetemplate:', 0, 0, 0, undef, 0, 'header', 'Header Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 102 | 0 | return 1 | |||||||||||||||||||
| 103 | } | ||||||||||||||||||||
| 104 | # String => '\\[$%]\{[^}\s]+\}' | ||||||||||||||||||||
| 105 | # attribute => 'Normal' | ||||||||||||||||||||
| 106 | # context => 'escape' | ||||||||||||||||||||
| 107 | # lookAhead => 'true' | ||||||||||||||||||||
| 108 | # type => 'RegExpr' | ||||||||||||||||||||
| 109 | 0 | ▶ | if ($self->testRegExpr($text, '\\\\[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'escape', 'Normal')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 110 | 0 | return 1 | |||||||||||||||||||
| 111 | } | ||||||||||||||||||||
| 112 | # String => '[$%]\{[^}\s]+\}' | ||||||||||||||||||||
| 113 | # attribute => 'Macro' | ||||||||||||||||||||
| 114 | # context => 'macros' | ||||||||||||||||||||
| 115 | # lookAhead => 'true' | ||||||||||||||||||||
| 116 | # type => 'RegExpr' | ||||||||||||||||||||
| 117 | 0 | ▶ | if ($self->testRegExpr($text, '[$%]\\{[^}\\s]+\\}', 0, 0, 1, undef, 0, 'macros', 'Macro')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 118 | 0 | return 1 | |||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | # attribute => 'Escape' | ||||||||||||||||||||
| 121 | # char => '\' | ||||||||||||||||||||
| 122 | # char1 => '^' | ||||||||||||||||||||
| 123 | # context => '#stay' | ||||||||||||||||||||
| 124 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 125 | 0 | ▶ | if ($self->testDetect2Chars($text, '\\', '^', 0, 0, 0, undef, 0, '#stay', 'Escape')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | 0 | return 1 | |||||||||||||||||||
| 127 | } | ||||||||||||||||||||
| 128 | # attribute => 'Keyword' | ||||||||||||||||||||
| 129 | # char => '^' | ||||||||||||||||||||
| 130 | # context => '#stay' | ||||||||||||||||||||
| 131 | # type => 'DetectChar' | ||||||||||||||||||||
| 132 | 0 | ▶ | if ($self->testDetectChar($text, '^', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 133 | 0 | return 1 | |||||||||||||||||||
| 134 | } | ||||||||||||||||||||
| 135 | 0 | return 0; | |||||||||||||||||||
| 136 | }; | ||||||||||||||||||||
| 137 | |||||||||||||||||||||
| 138 | sub parseescape { | ||||||||||||||||||||
| 139 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseescape: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 140 | # attribute => 'Escape' | ||||||||||||||||||||
| 141 | # char => '\' | ||||||||||||||||||||
| 142 | # char1 => '$' | ||||||||||||||||||||
| 143 | # context => '#pop' | ||||||||||||||||||||
| 144 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 145 | 0 | ▶ | if ($self->testDetect2Chars($text, '\\', '$', 0, 0, 0, undef, 0, '#pop', 'Escape')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 146 | 0 | return 1 | |||||||||||||||||||
| 147 | } | ||||||||||||||||||||
| 148 | 0 | return 0; | |||||||||||||||||||
| 149 | }; | ||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | sub parseheader { | ||||||||||||||||||||
| 152 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseheader: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 153 | # String => 'properties' | ||||||||||||||||||||
| 154 | # attribute => 'Property' | ||||||||||||||||||||
| 155 | # context => 'headervalue' | ||||||||||||||||||||
| 156 | # type => 'keyword' | ||||||||||||||||||||
| 157 | 0 | ▶ | if ($self->testKeyword($text, 'properties', 0, undef, 0, 'headervalue', 'Property')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 158 | 0 | return 1 | |||||||||||||||||||
| 159 | } | ||||||||||||||||||||
| 160 | 0 | return 0; | |||||||||||||||||||
| 161 | }; | ||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | sub parseheadervalue { | ||||||||||||||||||||
| 164 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseheadervalue: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 165 | # attribute => 'Header Text' | ||||||||||||||||||||
| 166 | # char => '=' | ||||||||||||||||||||
| 167 | # context => '#stay' | ||||||||||||||||||||
| 168 | # type => 'DetectChar' | ||||||||||||||||||||
| 169 | 0 | ▶ | if ($self->testDetectChar($text, '=', 0, 0, 0, undef, 0, '#stay', 'Header Text')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 170 | 0 | return 1 | |||||||||||||||||||
| 171 | } | ||||||||||||||||||||
| 172 | # String => ' \w+\s*=' | ||||||||||||||||||||
| 173 | # context => '#pop' | ||||||||||||||||||||
| 174 | # lookAhead => 'true' | ||||||||||||||||||||
| 175 | # type => 'RegExpr' | ||||||||||||||||||||
| 176 | 0 | ▶ | if ($self->testRegExpr($text, ' \\w+\\s*=', 0, 0, 1, undef, 0, '#pop', undef)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 177 | 0 | return 1 | |||||||||||||||||||
| 178 | } | ||||||||||||||||||||
| 179 | 0 | return 0; | |||||||||||||||||||
| 180 | }; | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | sub parsemacros { | ||||||||||||||||||||
| 183 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parsemacros: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||
| 184 | # attribute => 'Keyword' | ||||||||||||||||||||
| 185 | # char => '$' | ||||||||||||||||||||
| 186 | # char1 => '{' | ||||||||||||||||||||
| 187 | # context => '#stay' | ||||||||||||||||||||
| 188 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 189 | 0 | ▶ | if ($self->testDetect2Chars($text, '$', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 190 | 0 | return 1 | |||||||||||||||||||
| 191 | } | ||||||||||||||||||||
| 192 | # attribute => 'Keyword' | ||||||||||||||||||||
| 193 | # char => '%' | ||||||||||||||||||||
| 194 | # char1 => '{' | ||||||||||||||||||||
| 195 | # context => '#stay' | ||||||||||||||||||||
| 196 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 197 | 0 | ▶ | if ($self->testDetect2Chars($text, '%', '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 198 | 0 | return 1 | |||||||||||||||||||
| 199 | } | ||||||||||||||||||||
| 200 | # attribute => 'Keyword' | ||||||||||||||||||||
| 201 | # char => '}' | ||||||||||||||||||||
| 202 | # context => '#pop' | ||||||||||||||||||||
| 203 | # type => 'DetectChar' | ||||||||||||||||||||
| 204 | 0 | ▶ | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 205 | 0 | return 1 | |||||||||||||||||||
| 206 | } | ||||||||||||||||||||
| 207 | # String => '[^}\s]+' | ||||||||||||||||||||
| 208 | # attribute => 'Macro' | ||||||||||||||||||||
| 209 | # context => '#stay' | ||||||||||||||||||||
| 210 | # type => 'RegExpr' | ||||||||||||||||||||
| 211 | 0 | ▶ | if ($self->testRegExpr($text, '[^}\\s]+', 0, 0, 0, undef, 0, '#stay', 'Macro')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 212 | 0 | return 1 | |||||||||||||||||||
| 213 | } | ||||||||||||||||||||
| 214 | # String => 'macros' | ||||||||||||||||||||
| 215 | # attribute => 'Keyword' | ||||||||||||||||||||
| 216 | # context => '#stay' | ||||||||||||||||||||
| 217 | # type => 'keyword' | ||||||||||||||||||||
| 218 | 0 | ▶ | if ($self->testKeyword($text, 'macros', 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 219 | 0 | return 1 | |||||||||||||||||||
| 220 | } | ||||||||||||||||||||
| 221 | 0 | return 0; | |||||||||||||||||||
| 222 | }; | ||||||||||||||||||||
| 223 | |||||||||||||||||||||
| 224 | |||||||||||||||||||||
| 225 | 1 | 1; | |||||||||||||||||||
| 226 | |||||||||||||||||||||
| 227 | __END__ | ||||||||||||||||||||