Commit | Line | Data |
3fea05b9 |
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 'tcl.xml' file of the syntax highlight |
6 | # engine of the kate text editor (http://www.kate-editor.org |
7 | |
8 | #kate xml version 1.08 |
9 | #kate version 2.4 |
10 | #generated: Sun Feb 3 22:02:06 2008, localtime |
11 | |
12 | package Syntax::Highlight::Engine::Kate::Tcl_Tk; |
13 | |
14 | our $VERSION = '0.06'; |
15 | |
16 | use strict; |
17 | use warnings; |
18 | use base('Syntax::Highlight::Engine::Kate::Template'); |
19 | |
20 | sub new { |
21 | my $proto = shift; |
22 | my $class = ref($proto) || $proto; |
23 | my $self = $class->SUPER::new(@_); |
24 | $self->attributes({ |
25 | 'Char' => 'Char', |
26 | 'Comment' => 'Comment', |
27 | 'Decimal' => 'DecVal', |
28 | 'Float' => 'Float', |
29 | 'Keyword' => 'Keyword', |
30 | 'Normal Text' => 'Normal', |
31 | 'Parameter' => 'Others', |
32 | 'Region Marker' => 'RegionMarker', |
33 | 'String' => 'String', |
34 | 'Variable' => 'DataType', |
35 | }); |
36 | $self->listAdd('keywords', |
37 | 'AppleScript', |
38 | 'OptProc', |
39 | 'after', |
40 | 'append', |
41 | 'argc', |
42 | 'argv', |
43 | 'array', |
44 | 'auto_execk', |
45 | 'auto_load', |
46 | 'auto_mkindex', |
47 | 'auto_path', |
48 | 'auto_reset', |
49 | 'beep', |
50 | 'bell', |
51 | 'bgerror', |
52 | 'binary', |
53 | 'bind', |
54 | 'bindtags', |
55 | 'break', |
56 | 'button', |
57 | 'canvas', |
58 | 'case', |
59 | 'catch', |
60 | 'cd', |
61 | 'checkbutton', |
62 | 'clipboard', |
63 | 'clock', |
64 | 'close', |
65 | 'concat', |
66 | 'console', |
67 | 'continue', |
68 | 'dde', |
69 | 'destroy', |
70 | 'else', |
71 | 'elseif', |
72 | 'encoding', |
73 | 'entry', |
74 | 'env', |
75 | 'eof', |
76 | 'error', |
77 | 'errorCode', |
78 | 'errorInfo', |
79 | 'eval', |
80 | 'event', |
81 | 'exec', |
82 | 'exit', |
83 | 'expr', |
84 | 'fblocked', |
85 | 'fconfigure', |
86 | 'fcopy', |
87 | 'file', |
88 | 'fileevent', |
89 | 'flush', |
90 | 'focus', |
91 | 'font', |
92 | 'for', |
93 | 'foreach', |
94 | 'format', |
95 | 'frame', |
96 | 'gets', |
97 | 'glob', |
98 | 'global', |
99 | 'grab', |
100 | 'grid', |
101 | 'history', |
102 | 'if', |
103 | 'image', |
104 | 'incr', |
105 | 'info', |
106 | 'interp', |
107 | 'join', |
108 | 'label', |
109 | 'lappend', |
110 | 'lindex', |
111 | 'linsert', |
112 | 'list', |
113 | 'listbox', |
114 | 'llength', |
115 | 'load', |
116 | 'lower', |
117 | 'lrange', |
118 | 'lreplace', |
119 | 'lsearch', |
120 | 'lsort', |
121 | 'menu', |
122 | 'menubutton', |
123 | 'message', |
124 | 'namespace', |
125 | 'open', |
126 | 'option', |
127 | 'pack', |
128 | 'package', |
129 | 'parray', |
130 | 'pid', |
131 | 'pkg_mkindex', |
132 | 'place', |
133 | 'proc', |
134 | 'puts', |
135 | 'pwd', |
136 | 'radiobutton', |
137 | 'raise', |
138 | 'read', |
139 | 'regexp', |
140 | 'registry', |
141 | 'regsub', |
142 | 'rename', |
143 | 'resource', |
144 | 'return', |
145 | 'scale', |
146 | 'scan', |
147 | 'scrollbar', |
148 | 'seek', |
149 | 'selection', |
150 | 'send', |
151 | 'set', |
152 | 'socket', |
153 | 'source', |
154 | 'split', |
155 | 'string', |
156 | 'subst', |
157 | 'switch', |
158 | 'tclLog', |
159 | 'tcl_endOfWord', |
160 | 'tcl_findLibrary', |
161 | 'tcl_library', |
162 | 'tcl_patchLevel', |
163 | 'tcl_platform', |
164 | 'tcl_precision', |
165 | 'tcl_rcFileName', |
166 | 'tcl_rcRsrcName', |
167 | 'tcl_startOfNextWord', |
168 | 'tcl_startOfPreviousWord', |
169 | 'tcl_traceCompile', |
170 | 'tcl_traceExec', |
171 | 'tcl_version', |
172 | 'tcl_wordBreakAfter', |
173 | 'tcl_wordBreakBefore', |
174 | 'tell', |
175 | 'text', |
176 | 'time', |
177 | 'tk', |
178 | 'tkTabToWindow', |
179 | 'tk_chooseColor', |
180 | 'tk_chooseDirectory', |
181 | 'tk_focusFollowMouse', |
182 | 'tk_focusNext', |
183 | 'tk_focusPrev', |
184 | 'tk_getOpenFile', |
185 | 'tk_getSaveFile', |
186 | 'tk_library', |
187 | 'tk_messageBox', |
188 | 'tk_optionMenu', |
189 | 'tk_patchLevel', |
190 | 'tk_popup', |
191 | 'tk_strictMotif', |
192 | 'tk_version', |
193 | 'tkwait', |
194 | 'toplevel', |
195 | 'trace', |
196 | 'unknown', |
197 | 'unset', |
198 | 'update', |
199 | 'uplevel', |
200 | 'upvar', |
201 | 'variable', |
202 | 'vwait', |
203 | 'while', |
204 | 'winfo', |
205 | 'wm', |
206 | ); |
207 | $self->listAdd('keywords-opt', |
208 | 'activate', |
209 | 'actual', |
210 | 'add', |
211 | 'addtag', |
212 | 'append', |
213 | 'appname', |
214 | 'args', |
215 | 'aspect', |
216 | 'atime', |
217 | 'atom', |
218 | 'atomname', |
219 | 'attributes', |
220 | 'bbox', |
221 | 'bind', |
222 | 'body', |
223 | 'broadcast', |
224 | 'bytelength', |
225 | 'cancel', |
226 | 'canvasx', |
227 | 'canvasy', |
228 | 'caret', |
229 | 'cells', |
230 | 'cget', |
231 | 'channels', |
232 | 'children', |
233 | 'class', |
234 | 'clear', |
235 | 'clicks', |
236 | 'client', |
237 | 'clone', |
238 | 'cmdcount', |
239 | 'colormapfull', |
240 | 'colormapwindows', |
241 | 'command', |
242 | 'commands', |
243 | 'compare', |
244 | 'complete', |
245 | 'configure', |
246 | 'containing', |
247 | 'convertfrom', |
248 | 'convertto', |
249 | 'coords', |
250 | 'copy', |
251 | 'create', |
252 | 'current', |
253 | 'curselection', |
254 | 'dchars', |
255 | 'debug', |
256 | 'default', |
257 | 'deiconify', |
258 | 'delete', |
259 | 'delta', |
260 | 'depth', |
261 | 'deselect', |
262 | 'dirname', |
263 | 'dlineinfo', |
264 | 'dtag', |
265 | 'dump', |
266 | 'edit', |
267 | 'entrycget', |
268 | 'entryconfigure', |
269 | 'equal', |
270 | 'executable', |
271 | 'exists', |
272 | 'extension', |
273 | 'families', |
274 | 'find', |
275 | 'first', |
276 | 'flash', |
277 | 'focus', |
278 | 'focusmodel', |
279 | 'forget', |
280 | 'format', |
281 | 'fpixels', |
282 | 'fraction', |
283 | 'frame', |
284 | 'functions', |
285 | 'generate', |
286 | 'geometry', |
287 | 'get', |
288 | 'gettags', |
289 | 'globals', |
290 | 'grid', |
291 | 'group', |
292 | 'handle', |
293 | 'height', |
294 | 'hide', |
295 | 'hostname', |
296 | 'iconbitmap', |
297 | 'iconify', |
298 | 'iconmask', |
299 | 'iconname', |
300 | 'iconposition', |
301 | 'iconwindow', |
302 | 'icursor', |
303 | 'id', |
304 | 'identify', |
305 | 'idle', |
306 | 'ifneeded', |
307 | 'image', |
308 | 'index', |
309 | 'info', |
310 | 'insert', |
311 | 'interps', |
312 | 'inuse', |
313 | 'invoke', |
314 | 'is', |
315 | 'isdirectory', |
316 | 'isfile', |
317 | 'ismapped', |
318 | 'itemcget', |
319 | 'itemconfigure', |
320 | 'join', |
321 | 'keys', |
322 | 'last', |
323 | 'length', |
324 | 'level', |
325 | 'library', |
326 | 'link', |
327 | 'loaded', |
328 | 'locals', |
329 | 'lower', |
330 | 'lstat', |
331 | 'manager', |
332 | 'map', |
333 | 'mark', |
334 | 'match', |
335 | 'maxsize', |
336 | 'measure', |
337 | 'metrics', |
338 | 'minsize', |
339 | 'mkdir', |
340 | 'move', |
341 | 'mtime', |
342 | 'name', |
343 | 'nameofexecutable', |
344 | 'names', |
345 | 'nativename', |
346 | 'nearest', |
347 | 'normalize', |
348 | 'number', |
349 | 'overrideredirect', |
350 | 'own', |
351 | 'owned', |
352 | 'panecget', |
353 | 'paneconfigure', |
354 | 'panes', |
355 | 'parent', |
356 | 'patchlevel', |
357 | 'pathname', |
358 | 'pathtype', |
359 | 'pixels', |
360 | 'pointerx', |
361 | 'pointerxy', |
362 | 'pointery', |
363 | 'positionfrom', |
364 | 'post', |
365 | 'postcascade', |
366 | 'postscript', |
367 | 'present', |
368 | 'procs', |
369 | 'protocol', |
370 | 'provide', |
371 | 'proxy', |
372 | 'raise', |
373 | 'range', |
374 | 'readable', |
375 | 'readlink', |
376 | 'release', |
377 | 'remove', |
378 | 'rename', |
379 | 'repeat', |
380 | 'replace', |
381 | 'reqheight', |
382 | 'require', |
383 | 'reqwidth', |
384 | 'resizable', |
385 | 'rgb', |
386 | 'rootname', |
387 | 'rootx', |
388 | 'rooty', |
389 | 'scale', |
390 | 'scaling', |
391 | 'scan', |
392 | 'screen', |
393 | 'screencells', |
394 | 'screendepth', |
395 | 'screenheight', |
396 | 'screenmmheight', |
397 | 'screenmmwidth', |
398 | 'screenvisual', |
399 | 'screenwidth', |
400 | 'script', |
401 | 'search', |
402 | 'seconds', |
403 | 'see', |
404 | 'select', |
405 | 'selection', |
406 | 'separator', |
407 | 'server', |
408 | 'set', |
409 | 'sharedlibextension', |
410 | 'show', |
411 | 'size', |
412 | 'sizefrom', |
413 | 'split', |
414 | 'stackorder', |
415 | 'stat', |
416 | 'state', |
417 | 'status', |
418 | 'system', |
419 | 'tag', |
420 | 'tail', |
421 | 'tclversion', |
422 | 'title', |
423 | 'tolower', |
424 | 'toplevel', |
425 | 'totitle', |
426 | 'toupper', |
427 | 'transient', |
428 | 'trim', |
429 | 'trimleft', |
430 | 'trimright', |
431 | 'type', |
432 | 'types', |
433 | 'unknown', |
434 | 'unpost', |
435 | 'useinputmethods', |
436 | 'validate', |
437 | 'values', |
438 | 'variable', |
439 | 'vars', |
440 | 'vcompare', |
441 | 'vdelete', |
442 | 'versions', |
443 | 'viewable', |
444 | 'vinfo', |
445 | 'visual', |
446 | 'visualid', |
447 | 'visualsavailable', |
448 | 'volumes', |
449 | 'vrootheight', |
450 | 'vrootwidth', |
451 | 'vrootx', |
452 | 'vrooty', |
453 | 'vsatisfies', |
454 | 'width', |
455 | 'window', |
456 | 'windowingsystem', |
457 | 'withdraw', |
458 | 'wordend', |
459 | 'wordstart', |
460 | 'writable', |
461 | 'x', |
462 | 'xview', |
463 | 'y', |
464 | ); |
465 | $self->contextdata({ |
466 | 'Base' => { |
467 | callback => \&parseBase, |
468 | attribute => 'Normal Text', |
469 | }, |
470 | 'String' => { |
471 | callback => \&parseString, |
472 | attribute => 'String', |
473 | }, |
474 | }); |
475 | $self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
476 | $self->basecontext('Base'); |
477 | $self->keywordscase(0); |
478 | $self->initialize; |
479 | bless ($self, $class); |
480 | return $self; |
481 | } |
482 | |
483 | sub language { |
484 | return 'Tcl/Tk'; |
485 | } |
486 | |
487 | sub parseBase { |
488 | my ($self, $text) = @_; |
489 | # String => '#\s*BEGIN.*$' |
490 | # attribute => 'Region Marker' |
491 | # beginRegion => 'region' |
492 | # context => '#stay' |
493 | # firstNonSpace => 'true' |
494 | # type => 'RegExpr' |
495 | if ($self->testRegExpr($text, '#\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
496 | return 1 |
497 | } |
498 | # String => '#\s*END.*$' |
499 | # attribute => 'Region Marker' |
500 | # context => '#stay' |
501 | # endRegion => 'region' |
502 | # firstNonSpace => 'true' |
503 | # type => 'RegExpr' |
504 | if ($self->testRegExpr($text, '#\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
505 | return 1 |
506 | } |
507 | # String => 'keywords' |
508 | # attribute => 'Keyword' |
509 | # context => '#stay' |
510 | # type => 'keyword' |
511 | if ($self->testKeyword($text, 'keywords', 0, undef, 0, '#stay', 'Keyword')) { |
512 | return 1 |
513 | } |
514 | # String => 'keywords-opt' |
515 | # attribute => 'Parameter' |
516 | # context => '#stay' |
517 | # type => 'keyword' |
518 | if ($self->testKeyword($text, 'keywords-opt', 0, undef, 0, '#stay', 'Parameter')) { |
519 | return 1 |
520 | } |
521 | # attribute => 'Float' |
522 | # context => '#stay' |
523 | # type => 'Float' |
524 | if ($self->testFloat($text, 0, undef, 0, '#stay', 'Float')) { |
525 | return 1 |
526 | } |
527 | # attribute => 'Decimal' |
528 | # context => '#stay' |
529 | # type => 'Int' |
530 | if ($self->testInt($text, 0, undef, 0, '#stay', 'Decimal')) { |
531 | return 1 |
532 | } |
533 | # String => '\\.' |
534 | # attribute => 'Char' |
535 | # context => '#stay' |
536 | # type => 'RegExpr' |
537 | if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
538 | return 1 |
539 | } |
540 | # String => '\W-\w+' |
541 | # attribute => 'Parameter' |
542 | # context => '#stay' |
543 | # type => 'RegExpr' |
544 | if ($self->testRegExpr($text, '\\W-\\w+', 0, 0, 0, undef, 0, '#stay', 'Parameter')) { |
545 | return 1 |
546 | } |
547 | # String => '\$\{[^\}]+\}' |
548 | # attribute => 'Variable' |
549 | # context => '#stay' |
550 | # type => 'RegExpr' |
551 | if ($self->testRegExpr($text, '\\$\\{[^\\}]+\\}', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
552 | return 1 |
553 | } |
554 | # String => '\$(::)?[\S\D]\w+' |
555 | # attribute => 'Variable' |
556 | # context => '#stay' |
557 | # type => 'RegExpr' |
558 | if ($self->testRegExpr($text, '\\$(::)?[\\S\\D]\\w+', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
559 | return 1 |
560 | } |
561 | # String => '[^\\]""' |
562 | # attribute => 'String' |
563 | # context => '#stay' |
564 | # type => 'RegExpr' |
565 | if ($self->testRegExpr($text, '[^\\\\]""', 0, 0, 0, undef, 0, '#stay', 'String')) { |
566 | return 1 |
567 | } |
568 | # String => '[^\\]"' |
569 | # attribute => 'String' |
570 | # context => 'String' |
571 | # type => 'RegExpr' |
572 | if ($self->testRegExpr($text, '[^\\\\]"', 0, 0, 0, undef, 0, 'String', 'String')) { |
573 | return 1 |
574 | } |
575 | # String => '#.*$' |
576 | # attribute => 'Comment' |
577 | # context => '#stay' |
578 | # firstNonSpace => 'true' |
579 | # type => 'RegExpr' |
580 | if ($self->testRegExpr($text, '#.*$', 0, 0, 0, undef, 1, '#stay', 'Comment')) { |
581 | return 1 |
582 | } |
583 | # String => ';\s*#.*$' |
584 | # attribute => 'Comment' |
585 | # context => '#stay' |
586 | # type => 'RegExpr' |
587 | if ($self->testRegExpr($text, ';\\s*#.*$', 0, 0, 0, undef, 0, '#stay', 'Comment')) { |
588 | return 1 |
589 | } |
590 | # attribute => 'Keyword' |
591 | # beginRegion => 'block' |
592 | # char => '{' |
593 | # context => '#stay' |
594 | # type => 'DetectChar' |
595 | if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
596 | return 1 |
597 | } |
598 | # attribute => 'Keyword' |
599 | # char => '}' |
600 | # context => '#stay' |
601 | # endRegion => 'block' |
602 | # type => 'DetectChar' |
603 | if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
604 | return 1 |
605 | } |
606 | # attribute => 'Keyword' |
607 | # char => '[' |
608 | # context => '#stay' |
609 | # type => 'DetectChar' |
610 | if ($self->testDetectChar($text, '[', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
611 | return 1 |
612 | } |
613 | # attribute => 'Keyword' |
614 | # char => ']' |
615 | # context => '#stay' |
616 | # type => 'DetectChar' |
617 | if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#stay', 'Keyword')) { |
618 | return 1 |
619 | } |
620 | return 0; |
621 | }; |
622 | |
623 | sub parseString { |
624 | my ($self, $text) = @_; |
625 | # String => '\\.' |
626 | # attribute => 'Char' |
627 | # context => '#stay' |
628 | # type => 'RegExpr' |
629 | if ($self->testRegExpr($text, '\\\\.', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
630 | return 1 |
631 | } |
632 | # attribute => 'String' |
633 | # char => '"' |
634 | # context => '#pop' |
635 | # type => 'DetectChar' |
636 | if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
637 | return 1 |
638 | } |
639 | # attribute => 'Variable' |
640 | # char => '$' |
641 | # context => '#stay' |
642 | # type => 'DetectChar' |
643 | if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#stay', 'Variable')) { |
644 | return 1 |
645 | } |
646 | return 0; |
647 | }; |
648 | |
649 | |
650 | 1; |
651 | |
652 | __END__ |
653 | |
654 | =head1 NAME |
655 | |
656 | Syntax::Highlight::Engine::Kate::Tcl_Tk - a Plugin for Tcl/Tk syntax highlighting |
657 | |
658 | =head1 SYNOPSIS |
659 | |
660 | require Syntax::Highlight::Engine::Kate::Tcl_Tk; |
661 | my $sh = new Syntax::Highlight::Engine::Kate::Tcl_Tk([ |
662 | ]); |
663 | |
664 | =head1 DESCRIPTION |
665 | |
666 | Syntax::Highlight::Engine::Kate::Tcl_Tk is a plugin module that provides syntax highlighting |
667 | for Tcl/Tk to the Syntax::Haghlight::Engine::Kate highlighting engine. |
668 | |
669 | This code is generated from the syntax definition files used |
670 | by the Kate project. |
671 | It works quite fine, but can use refinement and optimization. |
672 | |
673 | It inherits Syntax::Higlight::Engine::Kate::Template. See also there. |
674 | |
675 | =cut |
676 | |
677 | =head1 AUTHOR |
678 | |
679 | Hans Jeuken (haje <at> toneel <dot> demon <dot> nl) |
680 | |
681 | =cut |
682 | |
683 | =head1 BUGS |
684 | |
685 | Unknown. If you find any, please contact the author |
686 | |
687 | =cut |
688 | |