Add built local::lib
[catagits/Gitalist.git] / local-lib5 / lib / perl5 / Syntax / Highlight / Engine / Kate / BibTeX.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 our $VERSION = '0.06';
16
17 use strict;
18 use warnings;
19 use base('Syntax::Highlight::Engine::Kate::Template');
20
21 sub new {
22    my $proto = shift;
23    my $class = ref($proto) || $proto;
24    my $self = $class->SUPER::new(@_);
25    $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    $self->listAdd('kw_command',
35       '@comment',
36       '@preamble',
37       '@string',
38    );
39    $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    $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    $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
72    $self->basecontext('Normal');
73    $self->keywordscase(0);
74    $self->initialize;
75    bless ($self, $class);
76    return $self;
77 }
78
79 sub language {
80    return 'BibTeX';
81 }
82
83 sub parseEntry {
84    my ($self, $text) = @_;
85    # attribute => 'Normal Text'
86    # char => ','
87    # context => '#pop'
88    # type => 'DetectChar'
89    if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) {
90       return 1
91    }
92    # attribute => 'Normal Text'
93    # beginRegion => 'block'
94    # char => '{'
95    # context => '#stay'
96    # type => 'DetectChar'
97    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
98       return 1
99    }
100    # attribute => 'Normal Text'
101    # char => '}'
102    # context => '#stay'
103    # endRegion => 'block'
104    # type => 'DetectChar'
105    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
106       return 1
107    }
108    # String => '\\([a-zA-Z]+|.)'
109    # attribute => 'Char'
110    # context => '#stay'
111    # type => 'RegExpr'
112    if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
113       return 1
114    }
115    # attribute => 'String'
116    # char => '"'
117    # context => '#pop'
118    # type => 'DetectChar'
119    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
120       return 1
121    }
122    return 0;
123 };
124
125 sub parseNormal {
126    my ($self, $text) = @_;
127    # String => '([a-zA-Z]+)\s*='
128    # attribute => 'Field'
129    # context => '#stay'
130    # firstNonSpace => 'true'
131    # type => 'RegExpr'
132    if ($self->testRegExpr($text, '([a-zA-Z]+)\\s*=', 0, 0, 0, undef, 1, '#stay', 'Field')) {
133       return 1
134    }
135    # String => 'kw_entry'
136    # attribute => 'Entry'
137    # context => 'Entry'
138    # type => 'keyword'
139    if ($self->testKeyword($text, 'kw_entry', 0, undef, 0, 'Entry', 'Entry')) {
140       return 1
141    }
142    # String => 'kw_command'
143    # attribute => 'Command'
144    # context => '#stay'
145    # type => 'keyword'
146    if ($self->testKeyword($text, 'kw_command', 0, undef, 0, '#stay', 'Command')) {
147       return 1
148    }
149    # attribute => 'Normal Text'
150    # beginRegion => 'block'
151    # char => '{'
152    # context => '#stay'
153    # type => 'DetectChar'
154    if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
155       return 1
156    }
157    # attribute => 'Normal Text'
158    # char => '}'
159    # context => '#stay'
160    # endRegion => 'block'
161    # type => 'DetectChar'
162    if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
163       return 1
164    }
165    # String => '\\([a-zA-Z]+|.)'
166    # attribute => 'Char'
167    # context => '#stay'
168    # type => 'RegExpr'
169    if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
170       return 1
171    }
172    # attribute => 'String'
173    # char => '"'
174    # context => 'String'
175    # type => 'DetectChar'
176    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) {
177       return 1
178    }
179    return 0;
180 };
181
182 sub parseString {
183    my ($self, $text) = @_;
184    # String => '\\([a-zA-Z]+|.)'
185    # attribute => 'Char'
186    # context => '#stay'
187    # type => 'RegExpr'
188    if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) {
189       return 1
190    }
191    # attribute => 'String'
192    # char => '"'
193    # context => '#pop'
194    # type => 'DetectChar'
195    if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
196       return 1
197    }
198    return 0;
199 };
200
201
202 1;
203
204 __END__
205
206 =head1 NAME
207
208 Syntax::Highlight::Engine::Kate::BibTeX - a Plugin for BibTeX syntax highlighting
209
210 =head1 SYNOPSIS
211
212  require Syntax::Highlight::Engine::Kate::BibTeX;
213  my $sh = new Syntax::Highlight::Engine::Kate::BibTeX([
214  ]);
215
216 =head1 DESCRIPTION
217
218 Syntax::Highlight::Engine::Kate::BibTeX is a  plugin module that provides syntax highlighting
219 for BibTeX to the Syntax::Haghlight::Engine::Kate highlighting engine.
220
221 This code is generated from the syntax definition files used
222 by the Kate project.
223 It works quite fine, but can use refinement and optimization.
224
225 It inherits Syntax::Higlight::Engine::Kate::Template. See also there.
226
227 =cut
228
229 =head1 AUTHOR
230
231 Hans Jeuken (haje <at> toneel <dot> demon <dot> nl)
232
233 =cut
234
235 =head1 BUGS
236
237 Unknown. If you find any, please contact the author
238
239 =cut
240