| 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 'awk.xml' file of the syntax highlight | ||||||||||||||||||||
| 6 | # engine of the kate text editor (http://www.kate-editor.org | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | #kate xml version 0.90 | ||||||||||||||||||||
| 9 | #kate version 2.3 | ||||||||||||||||||||
| 10 | #generated: Sun Feb 3 22:02:04 2008, localtime | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | package Syntax::Highlight::Engine::Kate::AWK; | ||||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 1 | our $VERSION = '0.14'; | |||||||||||||||||||
| 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 | sub new { | ||||||||||||||||||||
| 21 | 2 | ▶ | my $proto = shift; | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||
| 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 | 'Builtin' => 'DataType', | ||||||||||||||||||||
| 26 | 'Comment' => 'Comment', | ||||||||||||||||||||
| 27 | 'Decimal' => 'DecVal', | ||||||||||||||||||||
| 28 | 'Field' => 'Others', | ||||||||||||||||||||
| 29 | 'Float' => 'Float', | ||||||||||||||||||||
| 30 | 'Function' => 'Function', | ||||||||||||||||||||
| 31 | 'Keyword' => 'Keyword', | ||||||||||||||||||||
| 32 | 'Normal' => 'Normal', | ||||||||||||||||||||
| 33 | 'Pattern' => 'String', | ||||||||||||||||||||
| 34 | 'String' => 'String', | ||||||||||||||||||||
| 35 | }); | ||||||||||||||||||||
| 36 | 2 | $self->listAdd('builtins', | |||||||||||||||||||
| 37 | 'ARGC', | ||||||||||||||||||||
| 38 | 'ARGV', | ||||||||||||||||||||
| 39 | 'CONVFMT', | ||||||||||||||||||||
| 40 | 'ENVIRON', | ||||||||||||||||||||
| 41 | 'FILENAME', | ||||||||||||||||||||
| 42 | 'FNR', | ||||||||||||||||||||
| 43 | 'FS', | ||||||||||||||||||||
| 44 | 'NF', | ||||||||||||||||||||
| 45 | 'NR', | ||||||||||||||||||||
| 46 | 'OFMT', | ||||||||||||||||||||
| 47 | 'OFS', | ||||||||||||||||||||
| 48 | 'ORS', | ||||||||||||||||||||
| 49 | 'RLENGTH', | ||||||||||||||||||||
| 50 | 'RS', | ||||||||||||||||||||
| 51 | 'RSTART', | ||||||||||||||||||||
| 52 | 'SUBSEP', | ||||||||||||||||||||
| 53 | ); | ||||||||||||||||||||
| 54 | 2 | $self->listAdd('functions', | |||||||||||||||||||
| 55 | 'atan2', | ||||||||||||||||||||
| 56 | 'close', | ||||||||||||||||||||
| 57 | 'cos', | ||||||||||||||||||||
| 58 | 'exp', | ||||||||||||||||||||
| 59 | 'fflush', | ||||||||||||||||||||
| 60 | 'gensub', | ||||||||||||||||||||
| 61 | 'gsub', | ||||||||||||||||||||
| 62 | 'index', | ||||||||||||||||||||
| 63 | 'int', | ||||||||||||||||||||
| 64 | 'length', | ||||||||||||||||||||
| 65 | 'log', | ||||||||||||||||||||
| 66 | 'match', | ||||||||||||||||||||
| 67 | 'rand', | ||||||||||||||||||||
| 68 | 'sin', | ||||||||||||||||||||
| 69 | 'split', | ||||||||||||||||||||
| 70 | 'sprintf', | ||||||||||||||||||||
| 71 | 'sqrt', | ||||||||||||||||||||
| 72 | 'srand', | ||||||||||||||||||||
| 73 | 'sub', | ||||||||||||||||||||
| 74 | 'substr', | ||||||||||||||||||||
| 75 | 'system', | ||||||||||||||||||||
| 76 | 'tolower', | ||||||||||||||||||||
| 77 | 'toupper', | ||||||||||||||||||||
| 78 | ); | ||||||||||||||||||||
| 79 | 2 | $self->listAdd('keywords', | |||||||||||||||||||
| 80 | 'break', | ||||||||||||||||||||
| 81 | 'continue', | ||||||||||||||||||||
| 82 | 'do', | ||||||||||||||||||||
| 83 | 'else', | ||||||||||||||||||||
| 84 | 'exit', | ||||||||||||||||||||
| 85 | 'for', | ||||||||||||||||||||
| 86 | 'function', | ||||||||||||||||||||
| 87 | 'getline', | ||||||||||||||||||||
| 88 | 'if', | ||||||||||||||||||||
| 89 | 'in', | ||||||||||||||||||||
| 90 | 'next', | ||||||||||||||||||||
| 91 | 'print', | ||||||||||||||||||||
| 92 | 'printf', | ||||||||||||||||||||
| 93 | 'return', | ||||||||||||||||||||
| 94 | 'while', | ||||||||||||||||||||
| 95 | ); | ||||||||||||||||||||
| 96 | 2 | $self->contextdata({ | |||||||||||||||||||
| 97 | 'Base' => { | ||||||||||||||||||||
| 98 | callback => \&parseBase, | ||||||||||||||||||||
| 99 | attribute => 'Normal', | ||||||||||||||||||||
| 100 | }, | ||||||||||||||||||||
| 101 | 'Comment' => { | ||||||||||||||||||||
| 102 | callback => \&parseComment, | ||||||||||||||||||||
| 103 | attribute => 'Comment', | ||||||||||||||||||||
| 104 | lineending => '#pop', | ||||||||||||||||||||
| 105 | }, | ||||||||||||||||||||
| 106 | 'String' => { | ||||||||||||||||||||
| 107 | callback => \&parseString, | ||||||||||||||||||||
| 108 | attribute => 'String', | ||||||||||||||||||||
| 109 | }, | ||||||||||||||||||||
| 110 | }); | ||||||||||||||||||||
| 111 | 2 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); | |||||||||||||||||||
| 112 | 2 | $self->basecontext('Base'); | |||||||||||||||||||
| 113 | 2 | $self->keywordscase(0); | |||||||||||||||||||
| 114 | 2 | $self->initialize; | |||||||||||||||||||
| 115 | 2 | bless ($self, $class); | |||||||||||||||||||
| 116 | 2 | return $self; | |||||||||||||||||||
| 117 | } | ||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | sub language { | ||||||||||||||||||||
| 120 | 0 | ▶ | return 'AWK'; | ||||||||||||||||||
|
Subroutine
language: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 121 | } | ||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | sub parseBase { | ||||||||||||||||||||
| 124 | 136 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseBase: called CC=13 SCAR=25.9
Pod
undocumented
| |||||||||||||||||||||
| 125 | # String => '\b(BEGIN|END)\b' | ||||||||||||||||||||
| 126 | # attribute => 'Pattern' | ||||||||||||||||||||
| 127 | # context => '#stay' | ||||||||||||||||||||
| 128 | # type => 'RegExpr' | ||||||||||||||||||||
| 129 | 136 | ▶ | if ($self->testRegExpr($text, '\\b(BEGIN|END)\\b', 0, 0, 0, undef, 0, '#stay', 'Pattern')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 130 | 4 | return 1 | |||||||||||||||||||
| 131 | } | ||||||||||||||||||||
| 132 | # String => '/([^\/[]|\\.|\[\]?(\[[^]]+\]|.)+\])+/' | ||||||||||||||||||||
| 133 | # attribute => 'Pattern' | ||||||||||||||||||||
| 134 | # context => '#stay' | ||||||||||||||||||||
| 135 | # type => 'RegExpr' | ||||||||||||||||||||
| 136 | 132 | ▶ | if ($self->testRegExpr($text, '/([^\\/[]|\\\\.|\\[\\]?(\\[[^]]+\\]|.)+\\])+/', 0, 0, 0, undef, 0, '#stay', 'Pattern')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 137 | 10 | return 1 | |||||||||||||||||||
| 138 | } | ||||||||||||||||||||
| 139 | # attribute => 'Keyword' | ||||||||||||||||||||
| 140 | # beginRegion => 'block' | ||||||||||||||||||||
| 141 | # char => '{' | ||||||||||||||||||||
| 142 | # context => '#stay' | ||||||||||||||||||||
| 143 | # type => 'DetectChar' | ||||||||||||||||||||
| 144 | 122 | ▶ | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 145 | 8 | return 1 | |||||||||||||||||||
| 146 | } | ||||||||||||||||||||
| 147 | # attribute => 'Keyword' | ||||||||||||||||||||
| 148 | # char => '}' | ||||||||||||||||||||
| 149 | # context => '#stay' | ||||||||||||||||||||
| 150 | # endRegion => 'block' | ||||||||||||||||||||
| 151 | # type => 'DetectChar' | ||||||||||||||||||||
| 152 | 114 | ▶ | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 153 | 8 | return 1 | |||||||||||||||||||
| 154 | } | ||||||||||||||||||||
| 155 | # attribute => 'Comment' | ||||||||||||||||||||
| 156 | # char => '#' | ||||||||||||||||||||
| 157 | # context => 'Comment' | ||||||||||||||||||||
| 158 | # type => 'DetectChar' | ||||||||||||||||||||
| 159 | 106 | ▶ | if ($self->testDetectChar($text, '#', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 160 | 10 | return 1 | |||||||||||||||||||
| 161 | } | ||||||||||||||||||||
| 162 | # attribute => 'String' | ||||||||||||||||||||
| 163 | # char => '"' | ||||||||||||||||||||
| 164 | # context => 'String' | ||||||||||||||||||||
| 165 | # type => 'DetectChar' | ||||||||||||||||||||
| 166 | 96 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 167 | 2 | return 1 | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | # String => 'keywords' | ||||||||||||||||||||
| 170 | # attribute => 'Keyword' | ||||||||||||||||||||
| 171 | # context => '#stay' | ||||||||||||||||||||
| 172 | # type => 'keyword' | ||||||||||||||||||||
| 173 | 94 | ▶ | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 174 | 4 | return 1 | |||||||||||||||||||
| 175 | } | ||||||||||||||||||||
| 176 | # String => 'builtins' | ||||||||||||||||||||
| 177 | # attribute => 'Builtin' | ||||||||||||||||||||
| 178 | # context => '#stay' | ||||||||||||||||||||
| 179 | # type => 'keyword' | ||||||||||||||||||||
| 180 | 90 | ▶ | if ($self->testKeyword($text, 'builtins', 0, undef, 0, '#stay', 'Builtin')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 181 | 0 | return 1 | |||||||||||||||||||
| 182 | } | ||||||||||||||||||||
| 183 | # String => 'functions' | ||||||||||||||||||||
| 184 | # attribute => 'Function' | ||||||||||||||||||||
| 185 | # context => '#stay' | ||||||||||||||||||||
| 186 | # type => 'keyword' | ||||||||||||||||||||
| 187 | 90 | ▶ | if ($self->testKeyword($text, 'functions', 0, undef, 0, '#stay', 'Function')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 188 | 0 | return 1 | |||||||||||||||||||
| 189 | } | ||||||||||||||||||||
| 190 | # attribute => 'Float' | ||||||||||||||||||||
| 191 | # context => '#stay' | ||||||||||||||||||||
| 192 | # type => 'Float' | ||||||||||||||||||||
| 193 | 90 | ▶ | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 194 | 4 | return 1 | |||||||||||||||||||
| 195 | } | ||||||||||||||||||||
| 196 | # attribute => 'Decimal' | ||||||||||||||||||||
| 197 | # context => '#stay' | ||||||||||||||||||||
| 198 | # type => 'Int' | ||||||||||||||||||||
| 199 | 86 | ▶ | if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 200 | 0 | return 1 | |||||||||||||||||||
| 201 | } | ||||||||||||||||||||
| 202 | # String => '\$[A-Za-z0-9_]+' | ||||||||||||||||||||
| 203 | # attribute => 'Field' | ||||||||||||||||||||
| 204 | # context => '#stay' | ||||||||||||||||||||
| 205 | # type => 'RegExpr' | ||||||||||||||||||||
| 206 | 86 | ▶ | if ($self->testRegExpr($text, '\\$[A-Za-z0-9_]+', 0, 0, 0, undef, 0, '#stay', 'Field')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 207 | 2 | return 1 | |||||||||||||||||||
| 208 | } | ||||||||||||||||||||
| 209 | 84 | return 0; | |||||||||||||||||||
| 210 | }; | ||||||||||||||||||||
| 211 | |||||||||||||||||||||
| 212 | sub parseComment { | ||||||||||||||||||||
| 213 | 352 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseComment: called CC=2 SCAR=7.6
Pod
undocumented
| |||||||||||||||||||||
| 214 | # context => '##Alerts' | ||||||||||||||||||||
| 215 | # type => 'IncludeRules' | ||||||||||||||||||||
| 216 | 352 | ▶ | if ($self->includePlugin('Alerts', $text)) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 217 | 0 | return 1 | |||||||||||||||||||
| 218 | } | ||||||||||||||||||||
| 219 | 352 | return 0; | |||||||||||||||||||
| 220 | }; | ||||||||||||||||||||
| 221 | |||||||||||||||||||||
| 222 | sub parseString { | ||||||||||||||||||||
| 223 | 22 | ▶ | my ($self, $text) = @_; | ||||||||||||||||||
|
Subroutine
parseString: called CC=3 SCAR=11.2
Pod
undocumented
| |||||||||||||||||||||
| 224 | # attribute => 'String' | ||||||||||||||||||||
| 225 | # char => '"' | ||||||||||||||||||||
| 226 | # context => '#pop' | ||||||||||||||||||||
| 227 | # type => 'DetectChar' | ||||||||||||||||||||
| 228 | 22 | ▶ | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 229 | 2 | return 1 | |||||||||||||||||||
| 230 | } | ||||||||||||||||||||
| 231 | # attribute => 'String' | ||||||||||||||||||||
| 232 | # context => '#stay' | ||||||||||||||||||||
| 233 | # type => 'HlCStringChar' | ||||||||||||||||||||
| 234 | 20 | ▶ | if ($self->testHlCStringChar($text, 0, undef, 0, '#stay', 'String')) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 235 | 0 | return 1 | |||||||||||||||||||
| 236 | } | ||||||||||||||||||||
| 237 | 20 | return 0; | |||||||||||||||||||
| 238 | }; | ||||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | |||||||||||||||||||||
| 241 | 1 | 1; | |||||||||||||||||||
| 242 | |||||||||||||||||||||
| 243 | __END__ | ||||||||||||||||||||