Kate/BibTeX.pm

filter: Statementstmt 89.8% 53 / 59 Branchbran 82.1% 23 / 28 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 5 totaltotal 80.0% 84 / 105 CC 16 SCAR 16.7
CC
16
Cov
86%
parseNormal
8.0
parseEntry
6.7
parseString
3.1
CRAP 5.3
« Kate/Yacc_Bison.pm ↑ Summary Kate/FourGL.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 'bibtex.xml' file of the syntax highlight
6 # engine of the kate text editor (http://www.kate-editor.org
7  
8 #kate xml version 1.13
9 #kate version 2.4
10 #kate author Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net)
11 #generated: Sun Feb 3 22:02:04 2008, localtime
12  
13 package Syntax::Highlight::Engine::Kate::BibTeX;
14  
15 1 our $VERSION = '0.16';
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 2 ▶sub new {
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
22 2 my $proto = shift;
23 2 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
24 2 my $self = $class->SUPER::new(@_);
25 2 $self->attributes({
26 'Char' => 'Char',
27 'Command' => 'Function',
28 'Entry' => 'Keyword',
29 'Field' => 'DataType',
30 'Normal Text' => 'Normal',
31 'Ref Key' => 'Others',
32 'String' => 'String',
33 });
34 2 $self->listAdd('kw_command',
35 '@comment',
36 '@preamble',
37 '@string',
38 );
39 2 $self->listAdd('kw_entry',
40 '@article',
41 '@book',
42 '@booklet',
43 '@collection',
44 '@conference',
45 '@inbook',
46 '@incollection',
47 '@inproceedings',
48 '@manual',
49 '@mastersthesis',
50 '@misc',
51 '@patent',
52 '@phdthesis',
53 '@proceedings',
54 '@techreport',
55 '@unpublished',
56 );
57 2 $self->contextdata({
58 'Entry' => {
59 callback => \&parseEntry,
60 attribute => 'Ref Key',
61 },
62 'Normal' => {
63 callback => \&parseNormal,
64 attribute => 'Normal Text',
65 },
66 'String' => {
67 callback => \&parseString,
68 attribute => 'String',
69 },
70 });
71 2 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
72 2 $self->basecontext('Normal');
73 2 $self->keywordscase(0);
74 2 $self->initialize;
75 2 bless ($self, $class);
76 2 return $self;
77 }
78  
79 0 ▶sub language {
Subroutine language: not called CC=1 SCAR=6.9
Pod undocumented
80 0 return 'BibTeX';
81 }
82  
83 46 ▶sub parseEntry {
Subroutine parseEntry: called CC=6 SCAR=19.1
Pod undocumented
84 46 my ($self, $text) = @_;
85 # attribute => 'Normal Text'
86 # char => ','
87 # context => '#pop'
88 # type => 'DetectChar'
89 46 ▶ if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, ",", 0, 0, 0, undef, 0, "#pop", "Normal Text")) 6 40 46
90 6 return 1
91 }
92 # attribute => 'Normal Text'
93 # beginRegion => 'block'
94 # char => '{'
95 # context => '#stay'
96 # type => 'DetectChar'
97 40 ▶ if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "{", 0, 0, 0, undef, 0, "#stay", "Normal Text")) 6 34 40
98 6 return 1
99 }
100 # attribute => 'Normal Text'
101 # char => '}'
102 # context => '#stay'
103 # endRegion => 'block'
104 # type => 'DetectChar'
105 34 ▶ if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "}", 0, 0, 0, undef, 0, "#stay", "Normal Text")) 0 34 34
106 0 return 1
107 }
108 # String => '\\([a-zA-Z]+|.)'
109 # attribute => 'Char'
110 # context => '#stay'
111 # type => 'RegExpr'
112 34 ▶ if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\([a-zA-Z]+|.)", 0, 0, 0, undef, 0, "#stay", "Char")) 0 34 34
113 0 return 1
114 }
115 # attribute => 'String'
116 # char => '"'
117 # context => '#pop'
118 # type => 'DetectChar'
119 34 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "#pop", "String")) 0 34 34
120 0 return 1
121 }
122 34 return 0;
123 };
124  
125 586 ▶sub parseNormal {
Subroutine parseNormal: called CC=8 SCAR=20.8
Pod undocumented
126 586 my ($self, $text) = @_;
127 # String => '([a-zA-Z]+)\s*='
128 # attribute => 'Field'
129 # context => '#stay'
130 # firstNonSpace => 'true'
131 # type => 'RegExpr'
132 586 ▶ if ($self->testRegExpr($text, '([a-zA-Z]+)\\s*=', 0, 0, 0, undef, 1, '#stay', 'Field')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "([a-zA-Z]+)\\s*=", 0, 0, 0, undef, 1, "#stay", "Field")) 24 562 586
133 24 return 1
134 }
135 # String => 'kw_entry'
136 # attribute => 'Entry'
137 # context => 'Entry'
138 # type => 'keyword'
139 562 ▶ if ($self->testKeyword($text, 'kw_entry', 0, undef, 0, 'Entry', 'Entry')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "kw_entry", 0, undef, 0, "Entry", "Entry")) 6 556 562
140 6 return 1
141 }
142 # String => 'kw_command'
143 # attribute => 'Command'
144 # context => '#stay'
145 # type => 'keyword'
146 556 ▶ if ($self->testKeyword($text, 'kw_command', 0, undef, 0, '#stay', 'Command')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testKeyword($text, "kw_command", 0, undef, 0, "#stay", "Command")) 2 554 556
147 2 return 1
148 }
149 # attribute => 'Normal Text'
150 # beginRegion => 'block'
151 # char => '{'
152 # context => '#stay'
153 # type => 'DetectChar'
154 554 ▶ if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "{", 0, 0, 0, undef, 0, "#stay", "Normal Text")) 18 536 554
155 18 return 1
156 }
157 # attribute => 'Normal Text'
158 # char => '}'
159 # context => '#stay'
160 # endRegion => 'block'
161 # type => 'DetectChar'
162 536 ▶ if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "}", 0, 0, 0, undef, 0, "#stay", "Normal Text")) 24 512 536
163 24 return 1
164 }
165 # String => '\\([a-zA-Z]+|.)'
166 # attribute => 'Char'
167 # context => '#stay'
168 # type => 'RegExpr'
169 512 ▶ if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\([a-zA-Z]+|.)", 0, 0, 0, undef, 0, "#stay", "Char")) 0 512 512
170 0 return 1
171 }
172 # attribute => 'String'
173 # char => '"'
174 # context => 'String'
175 # type => 'DetectChar'
176 512 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "String", "String")) 10 502 512
177 10 return 1
178 }
179 502 return 0;
180 };
181  
182 176 ▶sub parseString {
Subroutine parseString: called CC=3 SCAR=11.2
Pod undocumented
183 176 my ($self, $text) = @_;
184 # String => '\\([a-zA-Z]+|.)'
185 # attribute => 'Char'
186 # context => '#stay'
187 # type => 'RegExpr'
188 176 ▶ if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testRegExpr($text, "\\\\([a-zA-Z]+|.)", 0, 0, 0, undef, 0, "#stay", "Char")) 0 176 176
189 0 return 1
190 }
191 # attribute => 'String'
192 # char => '"'
193 # context => '#pop'
194 # type => 'DetectChar'
195 176 ▶ if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->testDetectChar($text, "\"", 0, 0, 0, undef, 0, "#pop", "String")) 10 166 176
196 10 return 1
197 }
198 166 return 0;
199 };
200  
201  
202 1 1;
203  
204 __END__
« Kate/Yacc_Bison.pm ↑ Summary Kate/FourGL.pm »