| 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 'gettext.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 1.03 | ||||||||||||||||||||
| 9 | #kate version 2.4 | ||||||||||||||||||||
| 10 | #kate author Dominik Haumann (dhdev@gmx.de) | ||||||||||||||||||||
| 11 | #generated: Sun Feb 3 22:02:05 2008, localtime | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | package Syntax::Highlight::Engine::Kate::GNU_Gettext; | ||||||||||||||||||||
| 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 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 22 | 1 | my $proto = shift; | |||||||||||||||||||
| 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 | 'Automatic Comment' => 'Comment', | ||||||||||||||||||||
| 27 | 'Char' => 'Char', | ||||||||||||||||||||
| 28 | 'Flag' => 'Comment', | ||||||||||||||||||||
| 29 | 'Index' => 'DecVal', | ||||||||||||||||||||
| 30 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 31 | 'Normal Text' => 'Normal', | ||||||||||||||||||||
| 32 | 'Reference' => 'Comment', | ||||||||||||||||||||
| 33 | 'String' => 'String', | ||||||||||||||||||||
| 34 | 'Translator Comment' => 'Comment', | ||||||||||||||||||||
| 35 | }); | ||||||||||||||||||||
| 36 | 1 | $self->contextdata({ | |||||||||||||||||||
| 37 | 'Normal' => { | ||||||||||||||||||||
| 38 | callback => \&parseNormal, | ||||||||||||||||||||
| 39 | attribute => 'Normal Text', | ||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||
| 41 | 'String' => { | ||||||||||||||||||||
| 42 | callback => \&parseString, | ||||||||||||||||||||
| 43 | attribute => 'String', | ||||||||||||||||||||
| 44 | }, | ||||||||||||||||||||
| 45 | }); | ||||||||||||||||||||
| 46 | 1 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 47 | 1 | $self->basecontext('Normal'); | |||||||||||||||||||
| 48 | 1 | $self->keywordscase(0); | |||||||||||||||||||
| 49 | 1 | $self->initialize; | |||||||||||||||||||
| 50 | 1 | bless ($self, $class); | |||||||||||||||||||
| 51 | 1 | return $self; | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | |||||||||||||||||||||
| 54 | 0 | ▶ | sub language { | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 55 | 0 | return 'GNU Gettext'; | |||||||||||||||||||
| 56 | } | ||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | ▶ | sub parseNormal { | ||||||||||||||||||
|
Subroutine
parseNormal: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||
| 59 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 60 | # String => '^(msgid_plural|msgid|msgstr|msgctxt)' | ||||||||||||||||||||
| 61 | # attribute => 'Keyword' | ||||||||||||||||||||
| 62 | # context => '#stay' | ||||||||||||||||||||
| 63 | # type => 'RegExpr' | ||||||||||||||||||||
| 64 | 0 | ▶ | if ($self->testRegExpr($text, '^(msgid_plural|msgid|msgstr|msgctxt)', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 65 | 0 | return 1 | |||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | # String => '#\..*$' | ||||||||||||||||||||
| 68 | # attribute => 'Automatic Comment' | ||||||||||||||||||||
| 69 | # context => '#stay' | ||||||||||||||||||||
| 70 | # firstNonSpace => 'true' | ||||||||||||||||||||
| 71 | # type => 'RegExpr' | ||||||||||||||||||||
| 72 | 0 | ▶ | if ($self->testRegExpr($text, '#\\..*$', 0, 0, 0, undef, 1, '#stay', 'Automatic Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | 0 | return 1 | |||||||||||||||||||
| 74 | } | ||||||||||||||||||||
| 75 | # String => '#:.*$' | ||||||||||||||||||||
| 76 | # attribute => 'Reference' | ||||||||||||||||||||
| 77 | # context => '#stay' | ||||||||||||||||||||
| 78 | # firstNonSpace => 'true' | ||||||||||||||||||||
| 79 | # type => 'RegExpr' | ||||||||||||||||||||
| 80 | 0 | ▶ | if ($self->testRegExpr($text, '#:.*$', 0, 0, 0, undef, 1, '#stay', 'Reference')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | 0 | return 1 | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | # String => '#,.*$' | ||||||||||||||||||||
| 84 | # attribute => 'Flag' | ||||||||||||||||||||
| 85 | # context => '#stay' | ||||||||||||||||||||
| 86 | # firstNonSpace => 'true' | ||||||||||||||||||||
| 87 | # type => 'RegExpr' | ||||||||||||||||||||
| 88 | 0 | ▶ | if ($self->testRegExpr($text, '#,.*$', 0, 0, 0, undef, 1, '#stay', 'Flag')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 89 | 0 | return 1 | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | # String => '#.*$' | ||||||||||||||||||||
| 92 | # attribute => 'Translator Comment' | ||||||||||||||||||||
| 93 | # context => '#stay' | ||||||||||||||||||||
| 94 | # firstNonSpace => 'true' | ||||||||||||||||||||
| 95 | # type => 'RegExpr' | ||||||||||||||||||||
| 96 | 0 | ▶ | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 1, '#stay', 'Translator Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 97 | 0 | return 1 | |||||||||||||||||||
| 98 | } | ||||||||||||||||||||
| 99 | # String => '\\.' | ||||||||||||||||||||
| 100 | # attribute => 'Char' | ||||||||||||||||||||
| 101 | # context => '#stay' | ||||||||||||||||||||
| 102 | # type => 'RegExpr' | ||||||||||||||||||||
| 103 | 0 | ▶ | if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 104 | 0 | return 1 | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | # attribute => 'String' | ||||||||||||||||||||
| 107 | # char => '"' | ||||||||||||||||||||
| 108 | # context => 'String' | ||||||||||||||||||||
| 109 | # type => 'DetectChar' | ||||||||||||||||||||
| 110 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 111 | 0 | return 1 | |||||||||||||||||||
| 112 | } | ||||||||||||||||||||
| 113 | # String => '\[\d+\]' | ||||||||||||||||||||
| 114 | # attribute => 'Index' | ||||||||||||||||||||
| 115 | # context => '#stay' | ||||||||||||||||||||
| 116 | # type => 'RegExpr' | ||||||||||||||||||||
| 117 | 0 | ▶ | if ($self->testRegExpr($text, '\\[\\d+\\]', 0, 0, 0, undef, 0, '#stay', 'Index')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 118 | 0 | return 1 | |||||||||||||||||||
| 119 | } | ||||||||||||||||||||
| 120 | 0 | return 0; | |||||||||||||||||||
| 121 | }; | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | 0 | ▶ | sub parseString { | ||||||||||||||||||
|
Subroutine
parseString: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||
| 124 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 125 | # String => '\\.' | ||||||||||||||||||||
| 126 | # attribute => 'Char' | ||||||||||||||||||||
| 127 | # context => '#stay' | ||||||||||||||||||||
| 128 | # type => 'RegExpr' | ||||||||||||||||||||
| 129 | 0 | ▶ | if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 130 | 0 | return 1 | |||||||||||||||||||
| 131 | } | ||||||||||||||||||||
| 132 | # attribute => 'String' | ||||||||||||||||||||
| 133 | # char => '"' | ||||||||||||||||||||
| 134 | # context => '#pop' | ||||||||||||||||||||
| 135 | # type => 'DetectChar' | ||||||||||||||||||||
| 136 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 137 | 0 | return 1 | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | 0 | return 0; | |||||||||||||||||||
| 140 | }; | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | |||||||||||||||||||||
| 143 | 1 | 1; | |||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | __END__ | ||||||||||||||||||||