| 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 'matlab.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 1.20 | ||||||||||||||||||||
| 9 | #kate version 2.2 | ||||||||||||||||||||
| 10 | #generated: Sun Feb 3 22:02:05 2008, localtime | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | package Syntax::Highlight::Engine::Kate::Matlab; | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | our $VERSION = '0.16'; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 1 | ▶ | use base('Syntax::Highlight::Engine::Kate::Template'); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 21 | 2 | my $proto = shift; | |||||||||||||||||||
| 22 | 2 | ▶ | 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
| |||||||||||||||||||||
| 23 | 2 | my $self = $class->SUPER::new(@_); | |||||||||||||||||||
| 24 | 2 | $self->attributes({ | |||||||||||||||||||
| 25 | 'Comment' => 'Comment', | ||||||||||||||||||||
| 26 | 'Delimiter' => 'Normal', | ||||||||||||||||||||
| 27 | 'Incomplete String' => 'Char', | ||||||||||||||||||||
| 28 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 29 | 'Normal Text' => 'Normal', | ||||||||||||||||||||
| 30 | 'Number' => 'Float', | ||||||||||||||||||||
| 31 | 'Operator' => 'Normal', | ||||||||||||||||||||
| 32 | 'String' => 'String', | ||||||||||||||||||||
| 33 | 'System' => 'BaseN', | ||||||||||||||||||||
| 34 | 'Variable' => 'Variable', | ||||||||||||||||||||
| 35 | }); | ||||||||||||||||||||
| 36 | 2 | $self->listAdd('KeywordsList', | |||||||||||||||||||
| 37 | 'break', | ||||||||||||||||||||
| 38 | 'case', | ||||||||||||||||||||
| 39 | 'catch', | ||||||||||||||||||||
| 40 | 'continue', | ||||||||||||||||||||
| 41 | 'else', | ||||||||||||||||||||
| 42 | 'elseif', | ||||||||||||||||||||
| 43 | 'end', | ||||||||||||||||||||
| 44 | 'for', | ||||||||||||||||||||
| 45 | 'function', | ||||||||||||||||||||
| 46 | 'global', | ||||||||||||||||||||
| 47 | 'if', | ||||||||||||||||||||
| 48 | 'otherwise', | ||||||||||||||||||||
| 49 | 'persistent', | ||||||||||||||||||||
| 50 | 'return', | ||||||||||||||||||||
| 51 | 'switch', | ||||||||||||||||||||
| 52 | 'try', | ||||||||||||||||||||
| 53 | 'while', | ||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||
| 55 | 2 | $self->contextdata({ | |||||||||||||||||||
| 56 | '_adjoint' => { | ||||||||||||||||||||
| 57 | callback => \&parse_adjoint, | ||||||||||||||||||||
| 58 | attribute => 'Operator', | ||||||||||||||||||||
| 59 | lineending => '#pop', | ||||||||||||||||||||
| 60 | }, | ||||||||||||||||||||
| 61 | '_normal' => { | ||||||||||||||||||||
| 62 | callback => \&parse_normal, | ||||||||||||||||||||
| 63 | attribute => 'Normal Text', | ||||||||||||||||||||
| 64 | lineending => '#pop', | ||||||||||||||||||||
| 65 | }, | ||||||||||||||||||||
| 66 | }); | ||||||||||||||||||||
| 67 | 2 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 68 | 2 | $self->basecontext('_normal'); | |||||||||||||||||||
| 69 | 2 | $self->keywordscase(0); | |||||||||||||||||||
| 70 | 2 | $self->initialize; | |||||||||||||||||||
| 71 | 2 | bless ($self, $class); | |||||||||||||||||||
| 72 | 2 | return $self; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | |||||||||||||||||||||
| 75 | 0 | ▶ | sub language { | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 76 | 0 | return 'Matlab'; | |||||||||||||||||||
| 77 | } | ||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 0 | ▶ | sub parse_adjoint { | ||||||||||||||||||
|
Subroutine
parse_adjoint: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 80 | 0 | my ($self, $text) = @_; | |||||||||||||||||||
| 81 | # String => ''+' | ||||||||||||||||||||
| 82 | # attribute => 'Operator' | ||||||||||||||||||||
| 83 | # context => '#pop' | ||||||||||||||||||||
| 84 | # type => 'RegExpr' | ||||||||||||||||||||
| 85 | 0 | ▶ | if ($self->testRegExpr($text, '\'+', 0, 0, 0, undef, 0, '#pop', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 86 | 0 | return 1 | |||||||||||||||||||
| 87 | } | ||||||||||||||||||||
| 88 | 0 | return 0; | |||||||||||||||||||
| 89 | }; | ||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 58 | ▶ | sub parse_normal { | ||||||||||||||||||
|
Subroutine
parse_normal: called CC=25 SCAR=44.0
Pod
undocumented
| |||||||||||||||||||||
| 92 | 58 | my ($self, $text) = @_; | |||||||||||||||||||
| 93 | # String => '[a-zA-Z]\w*(?=')' | ||||||||||||||||||||
| 94 | # attribute => 'Variable' | ||||||||||||||||||||
| 95 | # context => '_adjoint' | ||||||||||||||||||||
| 96 | # type => 'RegExpr' | ||||||||||||||||||||
| 97 | 58 | ▶ | if ($self->testRegExpr($text, '[a-zA-Z]\\w*(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Variable')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 98 | 0 | return 1 | |||||||||||||||||||
| 99 | } | ||||||||||||||||||||
| 100 | # String => '(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?(?=')' | ||||||||||||||||||||
| 101 | # attribute => 'Number' | ||||||||||||||||||||
| 102 | # context => '_adjoint' | ||||||||||||||||||||
| 103 | # type => 'RegExpr' | ||||||||||||||||||||
| 104 | 58 | ▶ | if ($self->testRegExpr($text, '(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Number')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 105 | 0 | return 1 | |||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | # String => '[\)\]}](?=')' | ||||||||||||||||||||
| 108 | # attribute => 'Delimiter' | ||||||||||||||||||||
| 109 | # context => '_adjoint' | ||||||||||||||||||||
| 110 | # type => 'RegExpr' | ||||||||||||||||||||
| 111 | 58 | ▶ | if ($self->testRegExpr($text, '[\\)\\]}](?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Delimiter')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 112 | 0 | return 1 | |||||||||||||||||||
| 113 | } | ||||||||||||||||||||
| 114 | # String => '\.'(?=')' | ||||||||||||||||||||
| 115 | # attribute => 'Operator' | ||||||||||||||||||||
| 116 | # context => '_adjoint' | ||||||||||||||||||||
| 117 | # type => 'RegExpr' | ||||||||||||||||||||
| 118 | 58 | ▶ | if ($self->testRegExpr($text, '\\.\'(?=\')', 0, 0, 0, undef, 0, '_adjoint', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 119 | 0 | return 1 | |||||||||||||||||||
| 120 | } | ||||||||||||||||||||
| 121 | # String => ''[^']*(''[^']*)*'(?=[^']|$)' | ||||||||||||||||||||
| 122 | # attribute => 'String' | ||||||||||||||||||||
| 123 | # context => '#stay' | ||||||||||||||||||||
| 124 | # type => 'RegExpr' | ||||||||||||||||||||
| 125 | 58 | ▶ | if ($self->testRegExpr($text, '\'[^\']*(\'\'[^\']*)*\'(?=[^\']|$)', 0, 0, 0, undef, 0, '#stay', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | 0 | return 1 | |||||||||||||||||||
| 127 | } | ||||||||||||||||||||
| 128 | # String => ''[^']*(''[^']*)*' | ||||||||||||||||||||
| 129 | # attribute => 'Incomplete String' | ||||||||||||||||||||
| 130 | # context => '#stay' | ||||||||||||||||||||
| 131 | # type => 'RegExpr' | ||||||||||||||||||||
| 132 | 58 | ▶ | if ($self->testRegExpr($text, '\'[^\']*(\'\'[^\']*)*', 0, 0, 0, undef, 0, '#stay', 'Incomplete String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 133 | 0 | return 1 | |||||||||||||||||||
| 134 | } | ||||||||||||||||||||
| 135 | # String => 'KeywordsList' | ||||||||||||||||||||
| 136 | # attribute => 'Keyword' | ||||||||||||||||||||
| 137 | # context => '#stay' | ||||||||||||||||||||
| 138 | # type => 'keyword' | ||||||||||||||||||||
| 139 | 58 | ▶ | if ($self->testKeyword($text, 'KeywordsList', 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 140 | 0 | return 1 | |||||||||||||||||||
| 141 | } | ||||||||||||||||||||
| 142 | # String => '%.*$' | ||||||||||||||||||||
| 143 | # attribute => 'Comment' | ||||||||||||||||||||
| 144 | # context => '#stay' | ||||||||||||||||||||
| 145 | # type => 'RegExpr' | ||||||||||||||||||||
| 146 | 58 | ▶ | if ($self->testRegExpr($text, '%.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 147 | 0 | return 1 | |||||||||||||||||||
| 148 | } | ||||||||||||||||||||
| 149 | # String => '!.*$' | ||||||||||||||||||||
| 150 | # attribute => 'System' | ||||||||||||||||||||
| 151 | # context => '#stay' | ||||||||||||||||||||
| 152 | # type => 'RegExpr' | ||||||||||||||||||||
| 153 | 58 | ▶ | if ($self->testRegExpr($text, '!.*$', 0, 0, 0, undef, 0, '#stay', 'System')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 154 | 0 | return 1 | |||||||||||||||||||
| 155 | } | ||||||||||||||||||||
| 156 | # String => '[a-zA-Z]\w*' | ||||||||||||||||||||
| 157 | # attribute => 'Variable' | ||||||||||||||||||||
| 158 | # context => '#stay' | ||||||||||||||||||||
| 159 | # type => 'RegExpr' | ||||||||||||||||||||
| 160 | 58 | ▶ | if ($self->testRegExpr($text, '[a-zA-Z]\\w*', 0, 0, 0, undef, 0, '#stay', 'Variable')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 161 | 0 | return 1 | |||||||||||||||||||
| 162 | } | ||||||||||||||||||||
| 163 | # String => '(\d+(\.\d+)?|\.\d+)([eE][+-]?\d+)?[ij]?' | ||||||||||||||||||||
| 164 | # attribute => 'Number' | ||||||||||||||||||||
| 165 | # context => '#stay' | ||||||||||||||||||||
| 166 | # type => 'RegExpr' | ||||||||||||||||||||
| 167 | 58 | ▶ | if ($self->testRegExpr($text, '(\\d+(\\.\\d+)?|\\.\\d+)([eE][+-]?\\d+)?[ij]?', 0, 0, 0, undef, 0, '#stay', 'Number')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 168 | 0 | return 1 | |||||||||||||||||||
| 169 | } | ||||||||||||||||||||
| 170 | # String => '()[]{}' | ||||||||||||||||||||
| 171 | # attribute => 'Delimiter' | ||||||||||||||||||||
| 172 | # context => '#stay' | ||||||||||||||||||||
| 173 | # type => 'AnyChar' | ||||||||||||||||||||
| 174 | 58 | ▶ | if ($self->testAnyChar($text, '()[]{}', 0, 0, undef, 0, '#stay', 'Delimiter')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 175 | 0 | return 1 | |||||||||||||||||||
| 176 | } | ||||||||||||||||||||
| 177 | # String => '...' | ||||||||||||||||||||
| 178 | # attribute => 'Operator' | ||||||||||||||||||||
| 179 | # context => '#stay' | ||||||||||||||||||||
| 180 | # type => 'StringDetect' | ||||||||||||||||||||
| 181 | 58 | ▶ | if ($self->testStringDetect($text, '...', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 182 | 0 | return 1 | |||||||||||||||||||
| 183 | } | ||||||||||||||||||||
| 184 | # String => '==' | ||||||||||||||||||||
| 185 | # attribute => 'Operator' | ||||||||||||||||||||
| 186 | # context => '#stay' | ||||||||||||||||||||
| 187 | # type => 'StringDetect' | ||||||||||||||||||||
| 188 | 58 | ▶ | if ($self->testStringDetect($text, '==', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 189 | 52 | return 1 | |||||||||||||||||||
| 190 | } | ||||||||||||||||||||
| 191 | # String => '~=' | ||||||||||||||||||||
| 192 | # attribute => 'Operator' | ||||||||||||||||||||
| 193 | # context => '#stay' | ||||||||||||||||||||
| 194 | # type => 'StringDetect' | ||||||||||||||||||||
| 195 | 6 | ▶ | if ($self->testStringDetect($text, '~=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 196 | 0 | return 1 | |||||||||||||||||||
| 197 | } | ||||||||||||||||||||
| 198 | # String => '<=' | ||||||||||||||||||||
| 199 | # attribute => 'Operator' | ||||||||||||||||||||
| 200 | # context => '#stay' | ||||||||||||||||||||
| 201 | # type => 'StringDetect' | ||||||||||||||||||||
| 202 | 6 | ▶ | if ($self->testStringDetect($text, '<=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 203 | 0 | return 1 | |||||||||||||||||||
| 204 | } | ||||||||||||||||||||
| 205 | # String => '>=' | ||||||||||||||||||||
| 206 | # attribute => 'Operator' | ||||||||||||||||||||
| 207 | # context => '#stay' | ||||||||||||||||||||
| 208 | # type => 'StringDetect' | ||||||||||||||||||||
| 209 | 6 | ▶ | if ($self->testStringDetect($text, '>=', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 210 | 0 | return 1 | |||||||||||||||||||
| 211 | } | ||||||||||||||||||||
| 212 | # String => '&&' | ||||||||||||||||||||
| 213 | # attribute => 'Operator' | ||||||||||||||||||||
| 214 | # context => '#stay' | ||||||||||||||||||||
| 215 | # type => 'StringDetect' | ||||||||||||||||||||
| 216 | 6 | ▶ | if ($self->testStringDetect($text, '&&', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 217 | 0 | return 1 | |||||||||||||||||||
| 218 | } | ||||||||||||||||||||
| 219 | # String => '||' | ||||||||||||||||||||
| 220 | # attribute => 'Operator' | ||||||||||||||||||||
| 221 | # context => '#stay' | ||||||||||||||||||||
| 222 | # type => 'StringDetect' | ||||||||||||||||||||
| 223 | 6 | ▶ | if ($self->testStringDetect($text, '||', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 224 | 0 | return 1 | |||||||||||||||||||
| 225 | } | ||||||||||||||||||||
| 226 | # String => '.*' | ||||||||||||||||||||
| 227 | # attribute => 'Operator' | ||||||||||||||||||||
| 228 | # context => '#stay' | ||||||||||||||||||||
| 229 | # type => 'StringDetect' | ||||||||||||||||||||
| 230 | 6 | ▶ | if ($self->testStringDetect($text, '.*', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 231 | 0 | return 1 | |||||||||||||||||||
| 232 | } | ||||||||||||||||||||
| 233 | # String => '.^' | ||||||||||||||||||||
| 234 | # attribute => 'Operator' | ||||||||||||||||||||
| 235 | # context => '#stay' | ||||||||||||||||||||
| 236 | # type => 'StringDetect' | ||||||||||||||||||||
| 237 | 6 | ▶ | if ($self->testStringDetect($text, '.^', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 238 | 0 | return 1 | |||||||||||||||||||
| 239 | } | ||||||||||||||||||||
| 240 | # String => './' | ||||||||||||||||||||
| 241 | # attribute => 'Operator' | ||||||||||||||||||||
| 242 | # context => '#stay' | ||||||||||||||||||||
| 243 | # type => 'StringDetect' | ||||||||||||||||||||
| 244 | 6 | ▶ | if ($self->testStringDetect($text, './', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 245 | 0 | return 1 | |||||||||||||||||||
| 246 | } | ||||||||||||||||||||
| 247 | # String => '.'' | ||||||||||||||||||||
| 248 | # attribute => 'Operator' | ||||||||||||||||||||
| 249 | # context => '#stay' | ||||||||||||||||||||
| 250 | # type => 'StringDetect' | ||||||||||||||||||||
| 251 | 6 | ▶ | if ($self->testStringDetect($text, '.\'', 0, 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 252 | 0 | return 1 | |||||||||||||||||||
| 253 | } | ||||||||||||||||||||
| 254 | # String => '*+-/\&|<>~^=,;:@' | ||||||||||||||||||||
| 255 | # attribute => 'Operator' | ||||||||||||||||||||
| 256 | # context => '#stay' | ||||||||||||||||||||
| 257 | # type => 'AnyChar' | ||||||||||||||||||||
| 258 | 6 | ▶ | if ($self->testAnyChar($text, '*+-/\\&|<>~^=,;:@', 0, 0, undef, 0, '#stay', 'Operator')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 259 | 2 | return 1 | |||||||||||||||||||
| 260 | } | ||||||||||||||||||||
| 261 | 4 | return 0; | |||||||||||||||||||
| 262 | }; | ||||||||||||||||||||
| 263 | |||||||||||||||||||||
| 264 | |||||||||||||||||||||
| 265 | 1 | 1; | |||||||||||||||||||
| 266 | |||||||||||||||||||||
| 267 | __END__ | ||||||||||||||||||||