| 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 'rpmspec.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 1.1 | ||||||||||||||||||||
| 9 | #kate version 2.4 | ||||||||||||||||||||
| 10 | #generated: Sun Feb 3 22:02:06 2008, localtime | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | package Syntax::Highlight::Engine::Kate::RPM_Spec; | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | our $VERSION = '0.16'; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 1 | ▶ | use base('Syntax::Highlight::Engine::Kate::Template'); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 21 | 1 | my $proto = shift; | |||||||||||||||||||
| 22 | 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
| |||||||||||||||||||||
| 23 | 1 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||
| 24 | 1 | $self->attributes({ | |||||||||||||||||||
| 25 | 'Blue' => 'DecVal', | ||||||||||||||||||||
| 26 | 'Comment' => 'Comment', | ||||||||||||||||||||
| 27 | 'Data' => 'DataType', | ||||||||||||||||||||
| 28 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 29 | 'Normal Text' => 'Normal', | ||||||||||||||||||||
| 30 | 'Red' => 'String', | ||||||||||||||||||||
| 31 | }); | ||||||||||||||||||||
| 32 | 1 | $self->listAdd('keywords', | |||||||||||||||||||
| 33 | 'BuildArch', | ||||||||||||||||||||
| 34 | 'BuildArchitectures', | ||||||||||||||||||||
| 35 | 'BuildConflicts', | ||||||||||||||||||||
| 36 | 'BuildRequires', | ||||||||||||||||||||
| 37 | 'BuildRoot', | ||||||||||||||||||||
| 38 | 'Conflicts', | ||||||||||||||||||||
| 39 | 'Copyright', | ||||||||||||||||||||
| 40 | 'Distribution', | ||||||||||||||||||||
| 41 | 'Epoch', | ||||||||||||||||||||
| 42 | 'ExcludeArch', | ||||||||||||||||||||
| 43 | 'ExcludeOs', | ||||||||||||||||||||
| 44 | 'ExclusiveArch', | ||||||||||||||||||||
| 45 | 'ExclusiveOs', | ||||||||||||||||||||
| 46 | 'Group', | ||||||||||||||||||||
| 47 | 'License', | ||||||||||||||||||||
| 48 | 'Name', | ||||||||||||||||||||
| 49 | 'Obsoletes', | ||||||||||||||||||||
| 50 | 'Packager', | ||||||||||||||||||||
| 51 | 'PreReq', | ||||||||||||||||||||
| 52 | 'Prefix', | ||||||||||||||||||||
| 53 | 'Provides', | ||||||||||||||||||||
| 54 | 'Release', | ||||||||||||||||||||
| 55 | 'Requires', | ||||||||||||||||||||
| 56 | 'Serial', | ||||||||||||||||||||
| 57 | 'Source', | ||||||||||||||||||||
| 58 | 'Summary', | ||||||||||||||||||||
| 59 | 'URL', | ||||||||||||||||||||
| 60 | 'Url', | ||||||||||||||||||||
| 61 | 'Vendor', | ||||||||||||||||||||
| 62 | 'Version', | ||||||||||||||||||||
| 63 | ); | ||||||||||||||||||||
| 64 | 1 | $self->listAdd('types', | |||||||||||||||||||
| 65 | 'Artistic', | ||||||||||||||||||||
| 66 | 'GPL', | ||||||||||||||||||||
| 67 | 'LGPL', | ||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||
| 69 | 1 | $self->contextdata({ | |||||||||||||||||||
| 70 | 'Comment' => { | ||||||||||||||||||||
| 71 | callback => \&parseComment, | ||||||||||||||||||||
| 72 | attribute => 'Comment', | ||||||||||||||||||||
| 73 | lineending => '#pop', | ||||||||||||||||||||
| 74 | }, | ||||||||||||||||||||
| 75 | 'Normal' => { | ||||||||||||||||||||
| 76 | callback => \&parseNormal, | ||||||||||||||||||||
| 77 | attribute => 'Normal Text', | ||||||||||||||||||||
| 78 | }, | ||||||||||||||||||||
| 79 | 'Some Context' => { | ||||||||||||||||||||
| 80 | callback => \&parseSomeContext, | ||||||||||||||||||||
| 81 | attribute => 'Keyword', | ||||||||||||||||||||
| 82 | lineending => '#pop', | ||||||||||||||||||||
| 83 | }, | ||||||||||||||||||||
| 84 | 'Some Context2' => { | ||||||||||||||||||||
| 85 | callback => \&parseSomeContext2, | ||||||||||||||||||||
| 86 | attribute => 'Blue', | ||||||||||||||||||||
| 87 | lineending => '#pop', | ||||||||||||||||||||
| 88 | }, | ||||||||||||||||||||
| 89 | }); | ||||||||||||||||||||
| 90 | 1 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 91 | 1 | $self->basecontext('Normal'); | |||||||||||||||||||
| 92 | 1 | $self->keywordscase(0); | |||||||||||||||||||
| 93 | 1 | $self->initialize; | |||||||||||||||||||
| 94 | 1 | bless ($self, $class); | |||||||||||||||||||
| 95 | 1 | return $self; | |||||||||||||||||||
| 96 | } | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | 0 | ▶ | sub language { | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 99 | 0 | return 'RPM Spec'; | |||||||||||||||||||
| 100 | } | ||||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | 0 | ▶ | sub parseComment { | ||||||||||||||||||
|
Subroutine
parseComment: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 103 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 104 | 0 | return 0; | |||||||||||||||||||
| 105 | }; | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | 0 | ▶ | sub parseNormal { | ||||||||||||||||||
|
Subroutine
parseNormal: not called CC=11 SCAR=48.8
Pod
undocumented
| |||||||||||||||||||||
| 108 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 109 | # String => 'keywords' | ||||||||||||||||||||
| 110 | # attribute => 'Keyword' | ||||||||||||||||||||
| 111 | # context => '#stay' | ||||||||||||||||||||
| 112 | # type => 'keyword' | ||||||||||||||||||||
| 113 | 0 | ▶ | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 114 | 0 | return 1 | |||||||||||||||||||
| 115 | } | ||||||||||||||||||||
| 116 | # String => 'types' | ||||||||||||||||||||
| 117 | # attribute => 'Data' | ||||||||||||||||||||
| 118 | # context => '#stay' | ||||||||||||||||||||
| 119 | # type => 'keyword' | ||||||||||||||||||||
| 120 | 0 | ▶ | if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 121 | 0 | return 1 | |||||||||||||||||||
| 122 | } | ||||||||||||||||||||
| 123 | # String => '%\w*' | ||||||||||||||||||||
| 124 | # attribute => 'Red' | ||||||||||||||||||||
| 125 | # context => '#stay' | ||||||||||||||||||||
| 126 | # type => 'RegExpr' | ||||||||||||||||||||
| 127 | 0 | ▶ | if ($self->testRegExpr($text, '%\\w*', 0, 0, 0, undef, 0, '#stay', 'Red')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 128 | 0 | return 1 | |||||||||||||||||||
| 129 | } | ||||||||||||||||||||
| 130 | # attribute => 'Comment' | ||||||||||||||||||||
| 131 | # char => '#' | ||||||||||||||||||||
| 132 | # context => 'Comment' | ||||||||||||||||||||
| 133 | # type => 'DetectChar' | ||||||||||||||||||||
| 134 | 0 | ▶ | if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 135 | 0 | return 1 | |||||||||||||||||||
| 136 | } | ||||||||||||||||||||
| 137 | # String => '\{\w*' | ||||||||||||||||||||
| 138 | # attribute => 'Keyword' | ||||||||||||||||||||
| 139 | # context => 'Some Context' | ||||||||||||||||||||
| 140 | # type => 'RegExpr' | ||||||||||||||||||||
| 141 | 0 | ▶ | if ($self->testRegExpr($text, '\\{\\w*', 0, 0, 0, undef, 0, 'Some Context', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 142 | 0 | return 1 | |||||||||||||||||||
| 143 | } | ||||||||||||||||||||
| 144 | # String => '<\s*[\w@\.]*' | ||||||||||||||||||||
| 145 | # attribute => 'Blue' | ||||||||||||||||||||
| 146 | # context => 'Some Context2' | ||||||||||||||||||||
| 147 | # type => 'RegExpr' | ||||||||||||||||||||
| 148 | 0 | ▶ | if ($self->testRegExpr($text, '<\\s*[\\w@\\.]*', 0, 0, 0, undef, 0, 'Some Context2', 'Blue')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 149 | 0 | return 1 | |||||||||||||||||||
| 150 | } | ||||||||||||||||||||
| 151 | # String => '\$\w*' | ||||||||||||||||||||
| 152 | # attribute => 'Data' | ||||||||||||||||||||
| 153 | # context => '#stay' | ||||||||||||||||||||
| 154 | # type => 'RegExpr' | ||||||||||||||||||||
| 155 | 0 | ▶ | if ($self->testRegExpr($text, '\\$\\w*', 0, 0, 0, undef, 0, '#stay', 'Data')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 156 | 0 | return 1 | |||||||||||||||||||
| 157 | } | ||||||||||||||||||||
| 158 | # String => '(Source|Patch)\d*' | ||||||||||||||||||||
| 159 | # attribute => 'Keyword' | ||||||||||||||||||||
| 160 | # context => '#stay' | ||||||||||||||||||||
| 161 | # type => 'RegExpr' | ||||||||||||||||||||
| 162 | 0 | ▶ | if ($self->testRegExpr($text, '(Source|Patch)\\d*', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 163 | 0 | return 1 | |||||||||||||||||||
| 164 | } | ||||||||||||||||||||
| 165 | # String => '\*.*' | ||||||||||||||||||||
| 166 | # attribute => 'Keyword' | ||||||||||||||||||||
| 167 | # context => '#stay' | ||||||||||||||||||||
| 168 | # firstNonSpace => 'true' | ||||||||||||||||||||
| 169 | # type => 'RegExpr' | ||||||||||||||||||||
| 170 | 0 | ▶ | if ($self->testRegExpr($text, '\\*.*', 0, 0, 0, undef, 1, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 171 | 0 | return 1 | |||||||||||||||||||
| 172 | } | ||||||||||||||||||||
| 173 | # attribute => 'Blue' | ||||||||||||||||||||
| 174 | # context => '#stay' | ||||||||||||||||||||
| 175 | # type => 'Int' | ||||||||||||||||||||
| 176 | 0 | ▶ | if ($self->testInt($text, 0, undef, 0, '#stay', 'Blue')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 177 | 0 | return 1 | |||||||||||||||||||
| 178 | } | ||||||||||||||||||||
| 179 | 0 | return 0; | |||||||||||||||||||
| 180 | }; | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | 0 | ▶ | sub parseSomeContext { | ||||||||||||||||||
|
Subroutine
parseSomeContext: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 183 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 184 | # attribute => 'Keyword' | ||||||||||||||||||||
| 185 | # char => '}' | ||||||||||||||||||||
| 186 | # context => '#pop' | ||||||||||||||||||||
| 187 | # type => 'DetectChar' | ||||||||||||||||||||
| 188 | 0 | ▶ | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 189 | 0 | return 1 | |||||||||||||||||||
| 190 | } | ||||||||||||||||||||
| 191 | 0 | return 0; | |||||||||||||||||||
| 192 | }; | ||||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | 0 | ▶ | sub parseSomeContext2 { | ||||||||||||||||||
|
Subroutine
parseSomeContext2: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 195 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 196 | # attribute => 'Blue' | ||||||||||||||||||||
| 197 | # char => '>' | ||||||||||||||||||||
| 198 | # context => '#pop' | ||||||||||||||||||||
| 199 | # type => 'DetectChar' | ||||||||||||||||||||
| 200 | 0 | ▶ | if ($self->testDetectChar($text, '>', 0, 0, 0, undef, 0, '#pop', 'Blue')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 201 | 0 | return 1 | |||||||||||||||||||
| 202 | } | ||||||||||||||||||||
| 203 | 0 | return 0; | |||||||||||||||||||
| 204 | }; | ||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | 1 | 1; | |||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | __END__ | ||||||||||||||||||||