| 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.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 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 23 | 2 | ▶ | 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 | 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 | sub language { | ||||||||||||||||||||
| 80 | 0 | ▶ | return 'BibTeX'; | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 81 | } | ||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | sub parseEntry { | ||||||||||||||||||||
| 84 | 46 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseEntry: called CC=6 SCAR=19.1
Pod
undocumented
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 120 | 0 | return 1 | |||||||||||||||||||
| 121 | } | ||||||||||||||||||||
| 122 | 34 | return 0; | |||||||||||||||||||
| 123 | }; | ||||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | sub parseNormal { | ||||||||||||||||||||
| 126 | 586 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseNormal: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 177 | 10 | return 1 | |||||||||||||||||||
| 178 | } | ||||||||||||||||||||
| 179 | 502 | return 0; | |||||||||||||||||||
| 180 | }; | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | sub parseString { | ||||||||||||||||||||
| 183 | 176 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseString: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 196 | 10 | return 1 | |||||||||||||||||||
| 197 | } | ||||||||||||||||||||
| 198 | 166 | return 0; | |||||||||||||||||||
| 199 | }; | ||||||||||||||||||||
| 200 | |||||||||||||||||||||
| 201 | |||||||||||||||||||||
| 202 | 1 | 1; | |||||||||||||||||||
| 203 | |||||||||||||||||||||
| 204 | __END__ | ||||||||||||||||||||