| 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 'sieve.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 1.05 | ||||||||||||||||||||
| 9 | #kate version 2.4 | ||||||||||||||||||||
| 10 | #kate author Petter E. Stokke | ||||||||||||||||||||
| 11 | #generated: Sun Feb 3 22:02:06 2008, localtime | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | package Syntax::Highlight::Engine::Kate::Sieve; | ||||||||||||||||||||
| 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 | 'Decimal' => 'DecVal', | ||||||||||||||||||||
| 28 | 'Function' => 'Function', | ||||||||||||||||||||
| 29 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 30 | 'Normal Text' => 'Normal', | ||||||||||||||||||||
| 31 | 'String' => 'String', | ||||||||||||||||||||
| 32 | 'String Char' => 'Char', | ||||||||||||||||||||
| 33 | 'Symbol' => 'Normal', | ||||||||||||||||||||
| 34 | 'Tagged Argument' => 'Others', | ||||||||||||||||||||
| 35 | }); | ||||||||||||||||||||
| 36 | 1 | $self->listAdd('keywords', | |||||||||||||||||||
| 37 | 'discard', | ||||||||||||||||||||
| 38 | 'else', | ||||||||||||||||||||
| 39 | 'elsif', | ||||||||||||||||||||
| 40 | 'fileinto', | ||||||||||||||||||||
| 41 | 'if', | ||||||||||||||||||||
| 42 | 'keep', | ||||||||||||||||||||
| 43 | 'redirect', | ||||||||||||||||||||
| 44 | 'reject', | ||||||||||||||||||||
| 45 | 'require', | ||||||||||||||||||||
| 46 | 'stop', | ||||||||||||||||||||
| 47 | ); | ||||||||||||||||||||
| 48 | 1 | $self->contextdata({ | |||||||||||||||||||
| 49 | 'Comment' => { | ||||||||||||||||||||
| 50 | callback => \&parseComment, | ||||||||||||||||||||
| 51 | attribute => 'Comment', | ||||||||||||||||||||
| 52 | }, | ||||||||||||||||||||
| 53 | 'Member' => { | ||||||||||||||||||||
| 54 | callback => \&parseMember, | ||||||||||||||||||||
| 55 | attribute => 'Normal Text', | ||||||||||||||||||||
| 56 | lineending => '#pop', | ||||||||||||||||||||
| 57 | fallthrough => '#pop', | ||||||||||||||||||||
| 58 | }, | ||||||||||||||||||||
| 59 | 'MultilineString' => { | ||||||||||||||||||||
| 60 | callback => \&parseMultilineString, | ||||||||||||||||||||
| 61 | attribute => 'String', | ||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||
| 63 | 'Normal' => { | ||||||||||||||||||||
| 64 | callback => \&parseNormal, | ||||||||||||||||||||
| 65 | attribute => 'Normal Text', | ||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||
| 67 | 'String' => { | ||||||||||||||||||||
| 68 | callback => \&parseString, | ||||||||||||||||||||
| 69 | attribute => 'String', | ||||||||||||||||||||
| 70 | lineending => '#pop', | ||||||||||||||||||||
| 71 | }, | ||||||||||||||||||||
| 72 | }); | ||||||||||||||||||||
| 73 | 1 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 74 | 1 | $self->basecontext('Normal'); | |||||||||||||||||||
| 75 | 1 | $self->keywordscase(0); | |||||||||||||||||||
| 76 | 1 | $self->initialize; | |||||||||||||||||||
| 77 | 1 | bless ($self, $class); | |||||||||||||||||||
| 78 | 1 | return $self; | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | sub language { | ||||||||||||||||||||
| 82 | 0 | ▶ | return 'Sieve'; | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | sub parseComment { | ||||||||||||||||||||
| 86 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseComment: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 87 | # attribute => 'Comment' | ||||||||||||||||||||
| 88 | # char => '*' | ||||||||||||||||||||
| 89 | # char1 => '/' | ||||||||||||||||||||
| 90 | # context => '#pop' | ||||||||||||||||||||
| 91 | # endRegion => 'Comment' | ||||||||||||||||||||
| 92 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 93 | 0 | ▶ | if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 94 | 0 | return 1 | |||||||||||||||||||
| 95 | } | ||||||||||||||||||||
| 96 | 0 | return 0; | |||||||||||||||||||
| 97 | }; | ||||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | sub parseMember { | ||||||||||||||||||||
| 100 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseMember: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 101 | # String => '\b[_a-zA-Z]\w*(?=[\s]*)' | ||||||||||||||||||||
| 102 | # attribute => 'Function' | ||||||||||||||||||||
| 103 | # context => '#pop' | ||||||||||||||||||||
| 104 | # type => 'RegExpr' | ||||||||||||||||||||
| 105 | 0 | ▶ | if ($self->testRegExpr($text, '\\b[_a-zA-Z]\\w*(?=[\\s]*)', 0, 0, 0, undef, 0, '#pop', 'Function')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 106 | 0 | return 1 | |||||||||||||||||||
| 107 | } | ||||||||||||||||||||
| 108 | 0 | return 0; | |||||||||||||||||||
| 109 | }; | ||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | sub parseMultilineString { | ||||||||||||||||||||
| 112 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseMultilineString: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 113 | # String => '\.$' | ||||||||||||||||||||
| 114 | # attribute => 'String' | ||||||||||||||||||||
| 115 | # column => '0' | ||||||||||||||||||||
| 116 | # context => '#pop' | ||||||||||||||||||||
| 117 | # type => 'RegExpr' | ||||||||||||||||||||
| 118 | 0 | ▶ | if ($self->testRegExpr($text, '\\.$', 0, 0, 0, 0, 0, '#pop', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 119 | 0 | return 1 | |||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | # attribute => 'String Char' | ||||||||||||||||||||
| 122 | # context => '#stay' | ||||||||||||||||||||
| 123 | # type => 'HlCStringChar' | ||||||||||||||||||||
| 124 | 0 | ▶ | if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 125 | 0 | return 1 | |||||||||||||||||||
| 126 | } | ||||||||||||||||||||
| 127 | 0 | return 0; | |||||||||||||||||||
| 128 | }; | ||||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | sub parseNormal { | ||||||||||||||||||||
| 131 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseNormal: not called CC=12 SCAR=50.5
Pod
undocumented
| |||||||||||||||||||||
| 132 | # String => 'keywords' | ||||||||||||||||||||
| 133 | # attribute => 'Keyword' | ||||||||||||||||||||
| 134 | # context => '#stay' | ||||||||||||||||||||
| 135 | # type => 'keyword' | ||||||||||||||||||||
| 136 | 0 | ▶ | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 137 | 0 | return 1 | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | # attribute => 'Symbol' | ||||||||||||||||||||
| 140 | # beginRegion => 'Brace1' | ||||||||||||||||||||
| 141 | # char => '{' | ||||||||||||||||||||
| 142 | # context => '#stay' | ||||||||||||||||||||
| 143 | # type => 'DetectChar' | ||||||||||||||||||||
| 144 | 0 | ▶ | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 145 | 0 | return 1 | |||||||||||||||||||
| 146 | } | ||||||||||||||||||||
| 147 | # attribute => 'Symbol' | ||||||||||||||||||||
| 148 | # char => '}' | ||||||||||||||||||||
| 149 | # context => '#stay' | ||||||||||||||||||||
| 150 | # endRegion => 'Brace1' | ||||||||||||||||||||
| 151 | # type => 'DetectChar' | ||||||||||||||||||||
| 152 | 0 | ▶ | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Symbol')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 153 | 0 | return 1 | |||||||||||||||||||
| 154 | } | ||||||||||||||||||||
| 155 | # String => '\d+[KMG]?' | ||||||||||||||||||||
| 156 | # attribute => 'Decimal' | ||||||||||||||||||||
| 157 | # context => '#stay' | ||||||||||||||||||||
| 158 | # type => 'RegExpr' | ||||||||||||||||||||
| 159 | 0 | ▶ | if ($self->testRegExpr($text, '\\d+[KMG]?', 0, 0, 0, undef, 0, '#stay', 'Decimal')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 160 | 0 | return 1 | |||||||||||||||||||
| 161 | } | ||||||||||||||||||||
| 162 | # attribute => 'String' | ||||||||||||||||||||
| 163 | # char => '"' | ||||||||||||||||||||
| 164 | # context => 'String' | ||||||||||||||||||||
| 165 | # type => 'DetectChar' | ||||||||||||||||||||
| 166 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 167 | 0 | return 1 | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | # String => 'text:$' | ||||||||||||||||||||
| 170 | # attribute => 'String' | ||||||||||||||||||||
| 171 | # beginRegion => 'String' | ||||||||||||||||||||
| 172 | # context => 'MultilineString' | ||||||||||||||||||||
| 173 | # type => 'RegExpr' | ||||||||||||||||||||
| 174 | 0 | ▶ | if ($self->testRegExpr($text, 'text:$', 0, 0, 0, undef, 0, 'MultilineString', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 175 | 0 | return 1 | |||||||||||||||||||
| 176 | } | ||||||||||||||||||||
| 177 | # attribute => 'Comment' | ||||||||||||||||||||
| 178 | # beginRegion => 'Comment' | ||||||||||||||||||||
| 179 | # char => '/' | ||||||||||||||||||||
| 180 | # char1 => '*' | ||||||||||||||||||||
| 181 | # context => 'Comment' | ||||||||||||||||||||
| 182 | # type => 'Detect2Chars' | ||||||||||||||||||||
| 183 | 0 | ▶ | if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 184 | 0 | return 1 | |||||||||||||||||||
| 185 | } | ||||||||||||||||||||
| 186 | # String => '#.*$' | ||||||||||||||||||||
| 187 | # attribute => 'Comment' | ||||||||||||||||||||
| 188 | # context => '#stay' | ||||||||||||||||||||
| 189 | # type => 'RegExpr' | ||||||||||||||||||||
| 190 | 0 | ▶ | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 191 | 0 | return 1 | |||||||||||||||||||
| 192 | } | ||||||||||||||||||||
| 193 | # String => ':\w+' | ||||||||||||||||||||
| 194 | # attribute => 'Tagged Argument' | ||||||||||||||||||||
| 195 | # context => '#stay' | ||||||||||||||||||||
| 196 | # type => 'RegExpr' | ||||||||||||||||||||
| 197 | 0 | ▶ | if ($self->testRegExpr($text, ':\\w+', 0, 0, 0, undef, 0, '#stay', 'Tagged Argument')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 198 | 0 | return 1 | |||||||||||||||||||
| 199 | } | ||||||||||||||||||||
| 200 | # String => '[.]{1,1}' | ||||||||||||||||||||
| 201 | # attribute => 'Symbol' | ||||||||||||||||||||
| 202 | # context => 'Member' | ||||||||||||||||||||
| 203 | # type => 'RegExpr' | ||||||||||||||||||||
| 204 | 0 | ▶ | if ($self->testRegExpr($text, '[.]{1,1}', 0, 0, 0, undef, 0, 'Member', 'Symbol')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 205 | 0 | return 1 | |||||||||||||||||||
| 206 | } | ||||||||||||||||||||
| 207 | # String => ':!%&()+,-/.*<=>?[]|~^;' | ||||||||||||||||||||
| 208 | # attribute => 'Symbol' | ||||||||||||||||||||
| 209 | # context => '#stay' | ||||||||||||||||||||
| 210 | # type => 'AnyChar' | ||||||||||||||||||||
| 211 | 0 | ▶ | if ($self->testAnyChar($text, ':!%&()+,-/.*<=>?[]|~^;', 0, 0, undef, 0, '#stay', 'Symbol')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 212 | 0 | return 1 | |||||||||||||||||||
| 213 | } | ||||||||||||||||||||
| 214 | 0 | return 0; | |||||||||||||||||||
| 215 | }; | ||||||||||||||||||||
| 216 | |||||||||||||||||||||
| 217 | sub parseString { | ||||||||||||||||||||
| 218 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseString: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 219 | # attribute => 'String' | ||||||||||||||||||||
| 220 | # context => '#stay' | ||||||||||||||||||||
| 221 | # type => 'LineContinue' | ||||||||||||||||||||
| 222 | 0 | ▶ | if ($self->testLineContinue($text, 0, undef, 0, '#stay', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 223 | 0 | return 1 | |||||||||||||||||||
| 224 | } | ||||||||||||||||||||
| 225 | # attribute => 'String Char' | ||||||||||||||||||||
| 226 | # context => '#stay' | ||||||||||||||||||||
| 227 | # type => 'HlCStringChar' | ||||||||||||||||||||
| 228 | 0 | ▶ | if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 229 | 0 | return 1 | |||||||||||||||||||
| 230 | } | ||||||||||||||||||||
| 231 | # attribute => 'String' | ||||||||||||||||||||
| 232 | # char => '"' | ||||||||||||||||||||
| 233 | # context => '#pop' | ||||||||||||||||||||
| 234 | # type => 'DetectChar' | ||||||||||||||||||||
| 235 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 236 | 0 | return 1 | |||||||||||||||||||
| 237 | } | ||||||||||||||||||||
| 238 | 0 | return 0; | |||||||||||||||||||
| 239 | }; | ||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | |||||||||||||||||||||
| 242 | 1 | 1; | |||||||||||||||||||
| 243 | |||||||||||||||||||||
| 244 | __END__ | ||||||||||||||||||||