File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/GNU_Gettext.pm
Criterion Covered Total %
statement 20 45 44.4
branch 0 20 0.0
condition 1 3 33.3
subroutine 4 7 57.1
pod 0 4 0.0
total 25 79 31.6


line stmt bran cond sub pod time code
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             our $VERSION = '0.07';
16              
17 1     1   1062 use strict;
  1         2  
  1         48  
18 1     1   6 use warnings;
  1         3  
  1         34  
19 1     1   6 use base('Syntax::Highlight::Engine::Kate::Template');
  1         2  
  1         589  
20              
21             sub new {
22 1     1 0 572 my $proto = shift;
23 1   33     10 my $class = ref($proto) || $proto;
24 1         10 my $self = $class->SUPER::new(@_);
25 1         38 $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         16 $self->contextdata({
37             'Normal' => {
38             callback => \&parseNormal,
39             attribute => 'Normal Text',
40             },
41             'String' => {
42             callback => \&parseString,
43             attribute => 'String',
44             },
45             });
46 1         10 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
47 1         5 $self->basecontext('Normal');
48 1         8 $self->keywordscase(0);
49 1         4 $self->initialize;
50 1         4 bless ($self, $class);
51 1         3 return $self;
52             }
53              
54             sub language {
55 0     0 0   return 'GNU Gettext';
56             }
57              
58             sub parseNormal {
59 0     0 0   my ($self, $text) = @_;
60             # String => '^(msgid_plural|msgid|msgstr|msgctxt)'
61             # attribute => 'Keyword'
62             # context => '#stay'
63             # type => 'RegExpr'
64 0 0         if ($self->testRegExpr($text, '^(msgid_plural|msgid|msgstr|msgctxt)', 0, 0, 0, undef, 0, '#stay', 'Keyword')) {
65 0           return 1
66             }
67             # String => '#\..*$'
68             # attribute => 'Automatic Comment'
69             # context => '#stay'
70             # firstNonSpace => 'true'
71             # type => 'RegExpr'
72 0 0         if ($self->testRegExpr($text, '#\\..*$', 0, 0, 0, undef, 1, '#stay', 'Automatic Comment')) {
73 0           return 1
74             }
75             # String => '#:.*$'
76             # attribute => 'Reference'
77             # context => '#stay'
78             # firstNonSpace => 'true'
79             # type => 'RegExpr'
80 0 0         if ($self->testRegExpr($text, '#:.*$', 0, 0, 0, undef, 1, '#stay', 'Reference')) {
81 0           return 1
82             }
83             # String => '#,.*$'
84             # attribute => 'Flag'
85             # context => '#stay'
86             # firstNonSpace => 'true'
87             # type => 'RegExpr'
88 0 0         if ($self->testRegExpr($text, '#,.*$', 0, 0, 0, undef, 1, '#stay', 'Flag')) {
89 0           return 1
90             }
91             # String => '#.*$'
92             # attribute => 'Translator Comment'
93             # context => '#stay'
94             # firstNonSpace => 'true'
95             # type => 'RegExpr'
96 0 0         if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 1, '#stay', 'Translator Comment')) {
97 0           return 1
98             }
99             # String => '\\.'
100             # attribute => 'Char'
101             # context => '#stay'
102             # type => 'RegExpr'
103 0 0         if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
104 0           return 1
105             }
106             # attribute => 'String'
107             # char => '"'
108             # context => 'String'
109             # type => 'DetectChar'
110 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
111 0           return 1
112             }
113             # String => '\[\d+\]'
114             # attribute => 'Index'
115             # context => '#stay'
116             # type => 'RegExpr'
117 0 0         if ($self->testRegExpr($text, '\\[\\d+\\]', 0, 0, 0, undef, 0, '#stay', 'Index')) {
118 0           return 1
119             }
120 0           return 0;
121             };
122              
123             sub parseString {
124 0     0 0   my ($self, $text) = @_;
125             # String => '\\.'
126             # attribute => 'Char'
127             # context => '#stay'
128             # type => 'RegExpr'
129 0 0         if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) {
130 0           return 1
131             }
132             # attribute => 'String'
133             # char => '"'
134             # context => '#pop'
135             # type => 'DetectChar'
136 0 0         if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
137 0           return 1
138             }
139 0           return 0;
140             };
141              
142              
143             1;
144              
145             __END__