| 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 'r.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 1.04 | ||||||||||||||||||||
| 9 | #kate version 2.1 | ||||||||||||||||||||
| 10 | #kate author E.L. Willighagen | ||||||||||||||||||||
| 11 | #generated: Sun Feb 3 22:02:06 2008, localtime | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | package Syntax::Highlight::Engine::Kate::R_Script; | ||||||||||||||||||||
| 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 | 1 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 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 | 'Comment' => 'Comment', | ||||||||||||||||||||
| 27 | 'Control Structure' => 'Normal', | ||||||||||||||||||||
| 28 | 'Infix' => 'Others', | ||||||||||||||||||||
| 29 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 30 | 'Normal Text' => 'Normal', | ||||||||||||||||||||
| 31 | 'Operators' => 'Operator', | ||||||||||||||||||||
| 32 | 'Reserved Words' => 'Reserved', | ||||||||||||||||||||
| 33 | 'String' => 'String', | ||||||||||||||||||||
| 34 | }); | ||||||||||||||||||||
| 35 | 1 | $self->listAdd('controls', | |||||||||||||||||||
| 36 | 'break', | ||||||||||||||||||||
| 37 | 'else', | ||||||||||||||||||||
| 38 | 'for', | ||||||||||||||||||||
| 39 | 'function', | ||||||||||||||||||||
| 40 | 'if', | ||||||||||||||||||||
| 41 | 'in', | ||||||||||||||||||||
| 42 | 'next', | ||||||||||||||||||||
| 43 | 'repeat', | ||||||||||||||||||||
| 44 | 'switch', | ||||||||||||||||||||
| 45 | 'while', | ||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||
| 47 | 1 | $self->listAdd('words', | |||||||||||||||||||
| 48 | 'FALSE', | ||||||||||||||||||||
| 49 | 'Inf', | ||||||||||||||||||||
| 50 | 'NA', | ||||||||||||||||||||
| 51 | 'NULL', | ||||||||||||||||||||
| 52 | 'NaN', | ||||||||||||||||||||
| 53 | 'TRUE', | ||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||
| 55 | 1 | $self->contextdata({ | |||||||||||||||||||
| 56 | 'ctx0' => { | ||||||||||||||||||||
| 57 | callback => \&parsectx0, | ||||||||||||||||||||
| 58 | attribute => 'Normal Text', | ||||||||||||||||||||
| 59 | }, | ||||||||||||||||||||
| 60 | 'ctx1' => { | ||||||||||||||||||||
| 61 | callback => \&parsectx1, | ||||||||||||||||||||
| 62 | attribute => 'String', | ||||||||||||||||||||
| 63 | }, | ||||||||||||||||||||
| 64 | }); | ||||||||||||||||||||
| 65 | 1 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 66 | 1 | $self->basecontext('ctx0'); | |||||||||||||||||||
| 67 | 1 | $self->keywordscase(0); | |||||||||||||||||||
| 68 | 1 | $self->initialize; | |||||||||||||||||||
| 69 | 1 | bless ($self, $class); | |||||||||||||||||||
| 70 | 1 | return $self; | |||||||||||||||||||
| 71 | } | ||||||||||||||||||||
| 72 | |||||||||||||||||||||
| 73 | sub language { | ||||||||||||||||||||
| 74 | 0 | ▶ | return 'R Script'; | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 75 | } | ||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | sub parsectx0 { | ||||||||||||||||||||
| 78 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parsectx0: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||
| 79 | # String => 'controls' | ||||||||||||||||||||
| 80 | # attribute => 'Control Structure' | ||||||||||||||||||||
| 81 | # context => '#stay' | ||||||||||||||||||||
| 82 | # type => 'keyword' | ||||||||||||||||||||
| 83 | 0 | ▶ | if ($self->testKeyword($text, 'controls', 0, undef, 0, '#stay', 'Control Structure')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 84 | 0 | return 1 | |||||||||||||||||||
| 85 | } | ||||||||||||||||||||
| 86 | # String => 'words' | ||||||||||||||||||||
| 87 | # attribute => 'Reserved Words' | ||||||||||||||||||||
| 88 | # context => '#stay' | ||||||||||||||||||||
| 89 | # type => 'keyword' | ||||||||||||||||||||
| 90 | 0 | ▶ | if ($self->testKeyword($text, 'words', 0, undef, 0, '#stay', 'Reserved Words')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 91 | 0 | return 1 | |||||||||||||||||||
| 92 | } | ||||||||||||||||||||
| 93 | # attribute => 'String' | ||||||||||||||||||||
| 94 | # char => '"' | ||||||||||||||||||||
| 95 | # context => 'ctx1' | ||||||||||||||||||||
| 96 | # type => 'DetectChar' | ||||||||||||||||||||
| 97 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'ctx1', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 98 | 0 | return 1 | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | # String => '[a-zA-Z_]+ *\(' | ||||||||||||||||||||
| 101 | # attribute => 'Keyword' | ||||||||||||||||||||
| 102 | # context => '#stay' | ||||||||||||||||||||
| 103 | # type => 'RegExpr' | ||||||||||||||||||||
| 104 | 0 | ▶ | if ($self->testRegExpr($text, '[a-zA-Z_]+ *\\(', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 105 | 0 | return 1 | |||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | # attribute => 'Keyword' | ||||||||||||||||||||
| 108 | # char => '(' | ||||||||||||||||||||
| 109 | # context => '#stay' | ||||||||||||||||||||
| 110 | # type => 'DetectChar' | ||||||||||||||||||||
| 111 | 0 | ▶ | if ($self->testDetectChar($text, '(', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 112 | 0 | return 1 | |||||||||||||||||||
| 113 | } | ||||||||||||||||||||
| 114 | # attribute => 'Keyword' | ||||||||||||||||||||
| 115 | # char => ')' | ||||||||||||||||||||
| 116 | # context => '#stay' | ||||||||||||||||||||
| 117 | # type => 'DetectChar' | ||||||||||||||||||||
| 118 | 0 | ▶ | if ($self->testDetectChar($text, ')', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 119 | 0 | return 1 | |||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | # String => '#.*$' | ||||||||||||||||||||
| 122 | # attribute => 'Comment' | ||||||||||||||||||||
| 123 | # context => '#stay' | ||||||||||||||||||||
| 124 | # type => 'RegExpr' | ||||||||||||||||||||
| 125 | 0 | ▶ | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | 0 | return 1 | |||||||||||||||||||
| 127 | } | ||||||||||||||||||||
| 128 | # String => '+-*/^:$~!&|=><@' | ||||||||||||||||||||
| 129 | # attribute => 'Operators' | ||||||||||||||||||||
| 130 | # context => '#stay' | ||||||||||||||||||||
| 131 | # type => 'AnyChar' | ||||||||||||||||||||
| 132 | 0 | ▶ | if ($self->testAnyChar($text, '+-*/^:$~!&|=><@', 0, 0, undef, 0, '#stay', 'Operators')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 133 | 0 | return 1 | |||||||||||||||||||
| 134 | } | ||||||||||||||||||||
| 135 | # String => '%[a-zA-Z_]*%' | ||||||||||||||||||||
| 136 | # attribute => 'Operators' | ||||||||||||||||||||
| 137 | # context => '#stay' | ||||||||||||||||||||
| 138 | # type => 'RegExpr' | ||||||||||||||||||||
| 139 | 0 | ▶ | if ($self->testRegExpr($text, '%[a-zA-Z_]*%', 0, 0, 0, undef, 0, '#stay', 'Operators')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 140 | 0 | return 1 | |||||||||||||||||||
| 141 | } | ||||||||||||||||||||
| 142 | 0 | return 0; | |||||||||||||||||||
| 143 | }; | ||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | sub parsectx1 { | ||||||||||||||||||||
| 146 | 0 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parsectx1: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 147 | # attribute => 'String' | ||||||||||||||||||||
| 148 | # char => '"' | ||||||||||||||||||||
| 149 | # context => '#pop' | ||||||||||||||||||||
| 150 | # type => 'DetectChar' | ||||||||||||||||||||
| 151 | 0 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 152 | 0 | return 1 | |||||||||||||||||||
| 153 | } | ||||||||||||||||||||
| 154 | 0 | return 0; | |||||||||||||||||||
| 155 | }; | ||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | |||||||||||||||||||||
| 158 | 1 | 1; | |||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | __END__ | ||||||||||||||||||||