File Coverage

blib/lib/Syntax/Highlight/Engine/Kate/Stata.pm
Criterion Covered Total %
statement 48 53 90.5
branch 20 22 90.9
condition 1 3 33.3
subroutine 7 9 77.7
pod 0 6 0.0
total 76 93 81.7


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 'stata.xml' file of the syntax highlight
6             # engine of the kate text editor (http://www.kate-editor.org
7              
8             #kate xml version 1.01
9             #kate version 2.1
10             #kate author Edwin Leuven (e.leuven@uva.nl)
11             #generated: Sun Feb 3 22:02:06 2008, localtime
12              
13             package Syntax::Highlight::Engine::Kate::Stata;
14              
15             our $VERSION = '0.14';
16              
17 1     1   699 use strict;
  1         3  
  1         31  
18 1     1   5 use warnings;
  1         2  
  1         35  
19 1     1   5 use base('Syntax::Highlight::Engine::Kate::Template');
  1         1  
  1         930  
20              
21             sub new {
22 2     2 0 565 my $proto = shift;
23 2   33     10 my $class = ref($proto) || $proto;
24 2         13 my $self = $class->SUPER::new(@_);
25 2         14 $self->attributes({
26             'Comment' => 'Comment',
27             'Data Type' => 'DataType',
28             'Keyword' => 'Keyword',
29             'Macro' => 'Others',
30             'Normal Text' => 'Normal',
31             'String' => 'String',
32             'String Char' => 'Char',
33             });
34 2         19 $self->listAdd('keywords',
35             '_pctile',
36             'about',
37             'adjust',
38             'ado',
39             'alpha',
40             'anova',
41             'anovadef',
42             'append',
43             'arch',
44             'areg',
45             'args',
46             'arima',
47             'assert',
48             'bar',
49             'binreg',
50             'biprobit',
51             'bitest',
52             'boxcox',
53             'break',
54             'brier',
55             'browse',
56             'bstrap',
57             'by',
58             'canon',
59             'cap',
60             'capture',
61             'cat',
62             'cd',
63             'centile',
64             'cf',
65             'checksum',
66             'ci',
67             'class',
68             'clavg',
69             'clcomp',
70             'clear',
71             'clgen',
72             'clist',
73             'clkmeans',
74             'clkmed',
75             'clnote',
76             'clogit',
77             'cloglog',
78             'clsing',
79             'cltree',
80             'cluster',
81             'clutil',
82             'cmdlog',
83             'cnreg',
84             'cnsreg',
85             'codebook',
86             'collapse',
87             'compare',
88             'compress',
89             'confirm',
90             'constraint',
91             'continue',
92             'contract',
93             'copy',
94             'copyright',
95             'corr',
96             'corr2data',
97             'correlate',
98             'corrgram',
99             'count',
100             'cox',
101             'creturn',
102             'cross',
103             'ct',
104             'ctset',
105             'cttost',
106             'cumsp',
107             'cumul',
108             'cusum',
109             'datatypes',
110             'decode',
111             'define',
112             'describe',
113             'destring',
114             'dfuller',
115             'di',
116             'diagplots',
117             'dir',
118             'discard',
119             'display',
120             'do',
121             'doedit',
122             'dotplot',
123             'drawnorm',
124             'drop',
125             'dstdize',
126             'edit',
127             'egen',
128             'eivreg',
129             'else',
130             'encode',
131             'end',
132             'epitab',
133             'erase',
134             'ereturn',
135             'exit',
136             'expand',
137             'export',
138             'factor',
139             'fdadescribe',
140             'fdasave',
141             'fdause',
142             'file',
143             'filefilter',
144             'fillin',
145             'flist',
146             'for',
147             'foreach',
148             'format',
149             'forv',
150             'forval',
151             'forvalues',
152             'fracpoly',
153             'g',
154             'gen',
155             'generate',
156             'gettoken',
157             'glm',
158             'glogit',
159             'gprefs',
160             'gr',
161             'gr7',
162             'graph',
163             'graph7',
164             'grmeanby',
165             'gsort',
166             'hadimvo',
167             'hausman',
168             'haver',
169             'heckman',
170             'heckprob',
171             'help',
172             'hetprob',
173             'hexdump',
174             'hilite',
175             'hist',
176             'hotel',
177             'icd9',
178             'if',
179             'impute',
180             'in',
181             'infile',
182             'infile1',
183             'infile2',
184             'infiling',
185             'infix',
186             'input',
187             'insheet',
188             'inspect',
189             'ipolate',
190             'ivreg',
191             'jknife',
192             'joinby',
193             'kappa',
194             'kdensity',
195             'keep',
196             'ksm',
197             'ksmirnov',
198             'kwallis',
199             'label',
200             'ladder',
201             'levels',
202             'lfit',
203             'limits',
204             'lincom',
205             'line',
206             'linktest',
207             'list',
208             'lnskew0',
209             'log',
210             'logistic',
211             'logit',
212             'loneway',
213             'lowess',
214             'lroc',
215             'lrtest',
216             'lsens',
217             'lstat',
218             'ltable',
219             'lv',
220             'manova',
221             'manovatest',
222             'mark',
223             'markin',
224             'markout',
225             'marksample',
226             'matsize',
227             'maximize',
228             'means',
229             'median',
230             'memory',
231             'merge',
232             'mfx',
233             'mkdir',
234             'mkspline',
235             'ml',
236             'mleval',
237             'mlmatbysum',
238             'mlmatsum',
239             'mlogit',
240             'mlsum',
241             'mlvecsum',
242             'more',
243             'move',
244             'mvencode',
245             'mvreg',
246             'nbreg',
247             'net',
248             'newey',
249             'news',
250             'nl',
251             'nlogit',
252             'nobreak',
253             'nois',
254             'noisily',
255             'notes',
256             'nptrend',
257             'numlist',
258             'obs',
259             'odbc',
260             'ologit',
261             'oneway',
262             'oprobit',
263             'order',
264             'orthog',
265             'outfile',
266             'outsheet',
267             'parse',
268             'pcorr',
269             'pctile',
270             'pergram',
271             'pk',
272             'pkcollapse',
273             'pkcross',
274             'pkequiv',
275             'pkexamine',
276             'pkshape',
277             'pksumm',
278             'plot',
279             'poisson',
280             'post',
281             'postclose',
282             'postfile',
283             'postutil',
284             'pperron',
285             'prais',
286             'predict',
287             'preserve',
288             'probit',
289             'program',
290             'prtest',
291             'pwcorr',
292             'qc',
293             'qreg',
294             'quadchk',
295             'query',
296             'qui',
297             'quietly',
298             'range',
299             'ranksum',
300             'recast',
301             'recode',
302             'reg',
303             'reg3',
304             'regdiag',
305             'regress',
306             'rename',
307             'replace',
308             'reshape',
309             'restore',
310             'return',
311             'roc',
312             'rocplot',
313             'rotate',
314             'rreg',
315             'run',
316             'runtest',
317             'sample',
318             'sampsi',
319             'save',
320             'scatter',
321             'scobit',
322             'score',
323             'sdtest',
324             'search',
325             'separate',
326             'serrbar',
327             'set',
328             'shell',
329             'signrank',
330             'signtest',
331             'simul',
332             'sktest',
333             'smooth',
334             'snapspan',
335             'sort',
336             'spearman',
337             'spikeplot',
338             'sreturn',
339             'st',
340             'stack',
341             'statsby',
342             'stb',
343             'stbase',
344             'stci',
345             'stcox',
346             'stdes',
347             'stem',
348             'stfill',
349             'stgen',
350             'stir',
351             'stphplot',
352             'stptime',
353             'strate',
354             'streg',
355             'sts',
356             'stset',
357             'stsplit',
358             'stsum',
359             'sttocc',
360             'sttoct',
361             'stvary',
362             'sum',
363             'summarize',
364             'sureg',
365             'svy',
366             'svydes',
367             'svylc',
368             'svymean',
369             'svyset',
370             'svytab',
371             'svytest',
372             'sw',
373             'swilk',
374             'symmetry',
375             'syntax',
376             'tab',
377             'tabdisp',
378             'table',
379             'tabstat',
380             'tabsum',
381             'tabulate',
382             'tempfile',
383             'tempname',
384             'tempvar',
385             'test',
386             'testnl',
387             'tobit',
388             'tokenize',
389             'translate',
390             'translator',
391             'transmap',
392             'treatreg',
393             'truncreg',
394             'tsreport',
395             'tsrevar',
396             'tsset',
397             'ttest',
398             'tutorials',
399             'twoway',
400             'type',
401             'unabbr',
402             'unabcmd',
403             'update',
404             'use',
405             'using',
406             'vce',
407             'version',
408             'view',
409             'vwls',
410             'weibull',
411             'whelp',
412             'which',
413             'while',
414             'wntestb',
415             'wntestq',
416             'xcorr',
417             'xi',
418             'xpose',
419             'xt',
420             'xtabond',
421             'xtclog',
422             'xtdata',
423             'xtdes',
424             'xtgee',
425             'xtgls',
426             'xtile',
427             'xtintreg',
428             'xtivreg',
429             'xtlogit',
430             'xtnbreg',
431             'xtpcse',
432             'xtpois',
433             'xtprobit',
434             'xtrchh',
435             'xtreg',
436             'xtregar',
437             'xtsum',
438             'xttab',
439             'xttobit',
440             'zip',
441             );
442 2         8 $self->listAdd('types',
443             'char',
444             'double',
445             'error',
446             'float',
447             'global',
448             'int',
449             'local',
450             'long',
451             'macro',
452             'mat',
453             'matrix',
454             'result',
455             'scalar',
456             'text',
457             'var',
458             'variable',
459             'varlist',
460             'varname',
461             );
462 2         23 $self->contextdata({
463             'Comment 1' => {
464             callback => \&parseComment1,
465             attribute => 'Comment',
466             lineending => '#pop',
467             },
468             'Comment 2' => {
469             callback => \&parseComment2,
470             attribute => 'Comment',
471             },
472             'Normal' => {
473             callback => \&parseNormal,
474             attribute => 'Normal Text',
475             },
476             'string' => {
477             callback => \&parsestring,
478             attribute => 'String',
479             lineending => '#pop',
480             },
481             });
482 2         9 $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\');
483 2         8 $self->basecontext('Normal');
484 2         8 $self->keywordscase(0);
485 2         6 $self->initialize;
486 2         3 bless ($self, $class);
487 2         10 return $self;
488             }
489              
490             sub language {
491 0     0 0 0 return 'Stata';
492             }
493              
494             sub parseComment1 {
495 0     0 0 0 my ($self, $text) = @_;
496 0         0 return 0;
497             };
498              
499             sub parseComment2 {
500 548     548 0 769 my ($self, $text) = @_;
501             # attribute => 'Comment'
502             # char => '*'
503             # char1 => '/'
504             # context => '#pop'
505             # endRegion => 'Comment'
506             # type => 'Detect2Chars'
507 548 100       1101 if ($self->testDetect2Chars($text, '*', '/', 0, 0, 0, undef, 0, '#pop', 'Comment')) {
508 14         33 return 1
509             }
510 534         857 return 0;
511             };
512              
513             sub parseNormal {
514 3678     3678 0 5959 my ($self, $text) = @_;
515             # String => 'keywords'
516             # attribute => 'Keyword'
517             # context => '#stay'
518             # type => 'keyword'
519 3678 100       8188 if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) {
520 132         311 return 1
521             }
522             # String => 'types'
523             # attribute => 'Data Type'
524             # context => '#stay'
525             # type => 'keyword'
526 3546 100       8668 if ($self->testKeyword($text, 'types', 0, undef, 0, '#stay', 'Data Type')) {
527 46         102 return 1
528             }
529             # attribute => 'String'
530             # char => '"'
531             # context => 'string'
532             # type => 'DetectChar'
533 3500 100       8127 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'string', 'String')) {
534 32         68 return 1
535             }
536             # attribute => 'Macro'
537             # char => '`'
538             # char1 => '''
539             # context => '#stay'
540             # type => 'RangeDetect'
541 3468 100       8549 if ($self->testRangeDetect($text, '`', '\'', 0, 0, undef, 0, '#stay', 'Macro')) {
542 122         271 return 1
543             }
544             # attribute => 'Comment'
545             # char => '/'
546             # char1 => '/'
547             # context => 'Comment 1'
548             # type => 'Detect2Chars'
549 3346 50       8703 if ($self->testDetect2Chars($text, '/', '/', 0, 0, 0, undef, 0, 'Comment 1', 'Comment')) {
550 0         0 return 1
551             }
552             # attribute => 'Comment'
553             # beginRegion => 'Comment'
554             # char => '/'
555             # char1 => '*'
556             # context => 'Comment 2'
557             # type => 'Detect2Chars'
558 3346 100       7041 if ($self->testDetect2Chars($text, '/', '*', 0, 0, 0, undef, 0, 'Comment 2', 'Comment')) {
559 14         41 return 1
560             }
561             # attribute => 'Normal Text'
562             # beginRegion => 'block'
563             # char => '{'
564             # context => '#stay'
565             # type => 'DetectChar'
566 3332 100       6559 if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
567 24         56 return 1
568             }
569             # attribute => 'Normal Text'
570             # char => '}'
571             # context => '#stay'
572             # endRegion => 'block'
573             # type => 'DetectChar'
574 3308 100       6954 if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) {
575 24         52 return 1
576             }
577 3284         5619 return 0;
578             };
579              
580             sub parsestring {
581 208     208 0 290 my ($self, $text) = @_;
582             # attribute => 'String Char'
583             # context => '#stay'
584             # type => 'HlCStringChar'
585 208 50       422 if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String Char')) {
586 0         0 return 1
587             }
588             # attribute => 'String'
589             # char => '"'
590             # context => '#pop'
591             # type => 'DetectChar'
592 208 100       415 if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) {
593 32         72 return 1
594             }
595 176         279 return 0;
596             };
597              
598              
599             1;
600              
601             __END__