1<?php
2/*************************************************************************************
3 * tclegg.php
4 * ---------------------------------
5 * Author: Reid van Melle (rvanmelle@gmail.com)
6 * Copyright: (c) 2004 Reid van Melle (sorry@nowhere)
7 * Release Version: 1.0.9.1
8 * Date Started: 2006/05/05
9 *
10 * TCL/iTCL language file for GeSHi.
11 *
12 * This was thrown together in about an hour so I don't expect
13 * really great things.  However, it is a good start.  I never
14 * got a change to try out the iTCL or object-based support but
15 * this is not widely used anyway.
16 *
17 * CHANGES
18 * -------
19 * 2008/05/23 (1.0.7.22)
20 *  -  Added description of extra language features (SF#1970248)
21 * 2006/05/05 (1.0.0)
22 *  -  First Release
23 *
24 * TODO (updated 2006/05/05)
25 * -------------------------
26 * - Get TCL built-in special variables highlighted with a new color..
27 *   currently, these are listed in //special variables in the keywords
28 *   section, but they get covered by the general REGEXP for symbols
29 * - General cleanup, testing, and verification
30 *
31 *************************************************************************************
32 *
33 *     This file is part of GeSHi.
34 *
35 *   GeSHi is free software; you can redistribute it and/or modify
36 *   it under the terms of the GNU General Public License as published by
37 *   the Free Software Foundation; either version 2 of the License, or
38 *   (at your option) any later version.
39 *
40 *   GeSHi is distributed in the hope that it will be useful,
41 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
42 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43 *   GNU General Public License for more details.
44 *
45 *   You should have received a copy of the GNU General Public License
46 *   along with GeSHi; if not, write to the Free Software
47 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
48 *
49 ************************************************************************************/
50
51$language_data = array(
52    'LANG_NAME' => 'TCLEGG',
53    'COMMENT_SINGLE' => array(1 => '#'),
54    'COMMENT_MULTI' => array(),
55    'COMMENT_REGEXP' => array(
56        1 => '/(?<!\\\\)#(?:\\\\\\\\|\\\\\\n|.)*$/m',
57        //2 => '/{[^}\n]+}/'
58    ),
59    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
60    'QUOTEMARKS' => array('"', "'"),
61    'ESCAPE_CHAR' => '\\',
62    'KEYWORDS' => array(
63        /*
64         * Set 1: reserved words
65         * http://python.org/doc/current/ref/keywords.html
66         */
67        1 => array(
68            'break',
69            'case',
70            'catch',
71            'continue',
72            'default',
73            'else',
74            'elseif',
75            'error',
76            'eval',
77            'exit',
78            'expr',
79            'for',
80            'for_array_keys',
81            'for_file',
82            'for_recursive_glob',
83            'foreach',
84            'global',
85            'if',
86            'in',
87            'itcl_class',
88            'loop',
89            'method',
90            'namespace',
91            'proc',
92            'protected',
93            'public',
94            'rename',
95            'return',
96            'set',
97            'switch',
98            'then',
99            'unwind_protect',
100            'uplevel',
101            'upvar',
102            'variable',
103            'while',
104        ),
105
106        /*
107         * Set 2: builtins
108         * http://asps.activatestate.com/ASPN/docs/ActiveTcl/8.4/tcl/tcl_2_contents.htm
109         */
110        2 => array(
111            // string handling
112            'append', 'binary', 'format', 're_syntax', 'regexp', 'regsub',
113            'scan', 'string', 'subst',
114            // list handling
115            'concat', 'join', 'lappend', 'lindex', 'list', 'llength', 'lrange',
116            'lreplace', 'lsearch', 'lset', 'lsort', 'split',
117            // procedures and output
118            'incr', 'close', 'eof', 'fblocked', 'fconfigure', 'fcopy', 'file',
119            'fileevent', 'flush', 'gets', 'open', 'puts', 'read', 'seek',
120            'socket', 'tell',
121            // packages and source files
122            'load', 'loadTk', 'package', 'pgk::create', 'pgk_mkIndex', 'source',
123            // interpreter routines
124            'bgerror', 'history', 'info', 'interp', 'memory', 'unknown',
125            // library routines
126            'enconding', 'http', 'msgcat',
127            // system related
128            'cd', 'clock', 'exec', 'glob', 'pid', 'pwd', 'time',
129            // platform specified
130            'dde', 'registry', 'resource',
131            // special variables
132            '$argc', '$argv', '$errorCode', '$errorInfo', '$argv0',
133            '$auto_index', '$auto_oldpath', '$auto_path', '$env',
134            '$tcl_interactive', '$tcl_libpath', '$tcl_library',
135            '$tcl_pkgPath', '$tcl_platform', '$tcl_precision', '$tcl_traceExec',
136        ),
137
138        /*
139         * Set 3: standard library
140         * Replaced by binds
141         */
142        3 => array(
143            //'comment', 'filename', 'library', 'packagens', 'tcltest', 'tclvars',
144            'act',
145            'away',
146            'bcst',
147            'bot',
148            'chat',
149            'chjn',
150            'chof',
151            'chon',
152            'chpt',
153            'cron',
154            'ctcp',
155            'ctcr',
156            'dcc',
157            'disc',
158            'evnt',
159            'fil',
160            'filt',
161            'flud',
162            'kick',
163            'link',
164            'log',
165            'lost',
166            'mode',
167            'msg',
168            'msgm',
169            'need',
170            'nick',
171            'nkch',
172            'notc',
173            'note',
174            'out',
175            'part',
176            'pub',
177            'pubm',
178            'raw',
179            'rcvd',
180            'rejn',
181            'sent',
182            'sign',
183            'splt',
184            'topc',
185            'tout',
186            'unld',
187            'wall',
188        ),
189
190        /*
191         * Set 4: tcl-commands (eggdrop dedicated)
192         */
193        4 => array(
194            'addbot',
195            'addchanrec',
196            'adduser',
197            'assoc',
198
199            'backup',
200            'banlist',
201            'bind',
202            'binds',
203            'boot',
204            'botattr',
205            'botishalfop',
206            'botisop',
207            'botisvoice',
208            'botlist',
209            'botonchan',
210            'bots',
211
212            'callevent',
213            'chanbans',
214            'chanexempts',
215            'chaninvites',
216            'chanlist',
217            'channel',
218            'channels',
219            'chansettype',
220            'chattr',
221            'chhandle',
222            'clearqueue',
223            'compressfile',
224            'connect',
225            'console',
226            'control',
227            'countusers',
228            'cp',
229            'ctime',
230
231            'dccbroadcast',
232            'dccdumpfile',
233            'dcclist',
234            'dccputchan',
235            'dccsend',
236            'dccsimul',
237            'dccused',
238            'decrypt',
239            'delchanrec',
240            'delhost',
241            'deludef',
242            'deluser',
243            'die',
244            'dnslookup',
245            'dumpfile',
246            'duration',
247
248            'echo',
249            'encpass',
250            'encrypt',
251            'erasenotes',
252            'exemptlist',
253
254            'filesend',
255            'finduser',
256            'flushmode',
257
258            'getchan',
259            'getchanhost',
260            'getchanidle',
261            'getchaninfo',
262            'getchanjoin',
263            'getchanmode',
264            'getdccaway',
265            'getdccidle',
266            'getdesc',
267            'getdirs',
268            'getfileq',
269            'getfiles',
270            'getfilesendtime',
271            'getflags',
272            'getlink',
273            'getowner',
274            'getpwd',
275            'getting',
276            'getudefs',
277            'getuser',
278
279            'hand',
280            'handonchan',
281
282            'idx',
283            'ignorelist',
284            'invitelist',
285            'isban',
286            'isbansticky',
287            'isbotnick',
288            'ischanban',
289            'ischanexempt',
290            'ischaninvite',
291            'ischanjuped',
292            'iscompressed',
293            'isdynamic',
294            'isexempt',
295            'isexemptsticky',
296            'ishalfop',
297            'isignore',
298            'isinvite',
299            'isinvitesticky',
300            'islinked',
301            'isop',
302            'ispermban',
303            'ispermexempt',
304            'isperminvite',
305            'isvoice',
306
307            'jump',
308
309            'killassoc',
310            'killban',
311            'killchanban',
312            'killchanexempt',
313            'killchaninvite',
314            'killdcc',
315            'killexempt',
316            'killignore',
317            'killinvite',
318            'killtimer',
319            'killutimer',
320
321            'listen',
322            'listnotes',
323            'loadchannels',
324            'loadhelp',
325            'loadmodule',
326            'logfile',
327
328            'maskhost',
329            'matchaddr',
330            'matchattr',
331            'matchban',
332            'matchcidr',
333            'matchexempt',
334            'matchinvite',
335            'matchstr',
336            'md',
337            'mkdir',
338            'modules',
339            'mv',
340            'myip',
341
342            'newban',
343            'newchanban',
344            'newchanexempt',
345            'newchaninvite',
346            'newexempt',
347            'newignore',
348            'newinvite',
349            'notes',
350
351            'onchan',
352            'onchansplit',
353
354            'passwdok',
355            'pushmode',
356            'putallbots',
357            'putbot',
358            'putcmdlog',
359            'putdcc',
360            'puthelp',
361            'putkick',
362            'putlog',
363            'putloglev',
364            'putnow',
365            'putquick',
366            'putserv',
367            'putxferlog',
368
369            'queuesize',
370
371            'rand',
372            'rehash',
373            'reload',
374            'reloadhelp',
375            'renudef',
376            'resetbans',
377            'resetchan',
378            'resetchanidle',
379            'resetchanjoin',
380            'resetexempts',
381            'resetinvites',
382            'restart',
383            'rmdir',
384
385            'save',
386            'savechannels',
387            'sendnote',
388            'setchan',
389            'setchaninfo',
390            'setdccaway',
391            'setdesc',
392            'setflags',
393            'setlink',
394            'setowner',
395            'setpwd',
396            'setudef',
397            'setuser',
398            'stickban',
399            'stickexempt',
400            'stickinvite',
401            'storenote',
402            'strftime',
403            'strip',
404            'stripcodes',
405
406            'timer',
407            'timers',
408            'topic',
409            'traffic',
410
411            'unames',
412            'unbind',
413            'uncompressfile',
414            'unixtime',
415            'unlink',
416            'unloadhelp',
417            'unloadmodule',
418            'unstickban',
419            'unstickexempt',
420            'unstickinvite',
421            'userlist',
422            'utimer',
423            'utimers',
424
425            'validchan',
426            'valididx',
427            'validuser',
428
429            'washalfop',
430            'wasop',
431            'whom',
432        )
433    ),
434    'SYMBOLS' => array(
435        '(', ')', '[', ']', '{', '}', '$', '*', '&', '%', '!', ';', '<', '>', '?'
436    ),
437    'CASE_SENSITIVE' => array(
438        GESHI_COMMENTS => false,
439        1 => true,
440        2 => true,
441        3 => true,
442        4 => true
443    ),
444    'STYLES' => array(
445        'KEYWORDS' => array(
446            1 => 'color: #ff7700;font-weight:bold;',    // Reserved
447            2 => 'color: #008000;',                        // Built-ins + self
448            3 => 'color: #dc143c;',                        // Standard lib
449            4 => 'color: #0000cd;'                        // Special methods
450        ),
451        'COMMENTS' => array(
452            1 => 'color: #808080; font-style: italic;',
453//            2 => 'color: #483d8b;',
454            'MULTI' => 'color: #808080; font-style: italic;'
455        ),
456        'ESCAPE_CHAR' => array(
457            0 => 'color: #000099; font-weight: bold;'
458        ),
459        'BRACKETS' => array(
460            0 => 'color: black;'
461        ),
462        'STRINGS' => array(
463            0 => 'color: #483d8b;'
464        ),
465        'NUMBERS' => array(
466            0 => 'color: #ff4500;'
467        ),
468        'METHODS' => array(
469            1 => 'color: black;'
470        ),
471        'SYMBOLS' => array(
472            0 => 'color: #66cc66;'
473        ),
474        'REGEXPS' => array(
475            0 => 'color: #ff3333;'
476        ),
477        'SCRIPT' => array()
478    ),
479    'URLS' => array(
480        1 => 'http://wiki.tcl.tk/{FNAMEL}',
481        2 => 'http://wiki.tcl.tk/{FNAMEUF}',
482        3 => 'http://wiki.eggdrop.fr/Binds#{FNAMEU}',
483        4 => 'http://wiki.eggdrop.fr/{FNAMEUF}'
484    ),
485    'OOLANG' => true,
486    'OBJECT_SPLITTERS' => array(
487        1 => '::'
488    ),
489    'REGEXPS' => array(
490        //Special variables
491        0 => '[\\$]+[a-zA-Z_][a-zA-Z0-9_]*',
492    ),
493    'STRICT_MODE_APPLIES' => GESHI_NEVER,
494    'SCRIPT_DELIMITERS' => array(),
495    'HIGHLIGHT_STRICT_BLOCK' => array(),
496    'PARSER_CONTROL' => array(
497        'COMMENTS' => array(
498            'DISALLOWED_BEFORE' => '\\'
499        )
500    )
501);
502