1<?php
2/*************************************************************************************
3 * tcl.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' => 'TCL',
53    'COMMENT_SINGLE' => array(),
54    'COMMENT_MULTI' => array(),
55    'COMMENT_REGEXP' => array(
56        1 => '/(?:^|(?<=\{|;))\s*#(?:\\\\\\\\|\\\\\\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            'proc', 'global', 'upvar', 'if', 'then', 'else', 'elseif', 'for', 'foreach',
69            'break', 'continue', 'while', 'set', 'eval', 'case', 'in', 'switch',
70            'default', 'exit', 'error', 'return', 'uplevel', 'loop',
71            'for_array_keys', 'for_recursive_glob', 'for_file', 'unwind_protect',
72            'expr', 'catch', 'namespace', 'rename', 'variable',
73            // itcl
74            'method', 'itcl_class', 'public', 'protected'),
75
76        /*
77         * Set 2: builtins
78         * http://asps.activatestate.com/ASPN/docs/ActiveTcl/8.4/tcl/tcl_2_contents.htm
79         */
80        2 => array(
81            // string handling
82            'append', 'binary', 'format', 're_syntax', 'regexp', 'regsub',
83            'scan', 'string', 'subst',
84            // list handling
85            'concat', 'join', 'lappend', 'lindex', 'list', 'llength', 'lrange',
86            'lreplace', 'lsearch', 'lset', 'lsort', 'split',
87            // procedures and output
88            'incr', 'close', 'eof', 'fblocked', 'fconfigure', 'fcopy', 'file',
89            'fileevent', 'flush', 'gets', 'open', 'puts', 'read', 'seek',
90            'socket', 'tell',
91            // packages and source files
92            'load', 'loadTk', 'package', 'pgk::create', 'pgk_mkIndex', 'source',
93            // interpreter routines
94            'bgerror', 'history', 'info', 'interp', 'memory', 'unknown',
95            // library routines
96            'enconding', 'http', 'msgcat',
97            // system related
98            'cd', 'clock', 'exec', 'glob', 'pid', 'pwd', 'time',
99            // platform specified
100            'dde', 'registry', 'resource',
101            // special variables
102            '$argc', '$argv', '$errorCode', '$errorInfo', '$argv0',
103            '$auto_index', '$auto_oldpath', '$auto_path', '$env',
104            '$tcl_interactive', '$tcl_libpath', '$tcl_library',
105            '$tcl_pkgPath', '$tcl_platform', '$tcl_precision', '$tcl_traceExec',
106            ),
107
108        /*
109         * Set 3: standard library
110         */
111        3 => array(
112            'comment', 'filename', 'library', 'packagens', 'tcltest', 'tclvars',
113            ),
114
115        /*
116         * Set 4: special methods
117         */
118//        4 => array(
119//            )
120
121        ),
122    'SYMBOLS' => array(
123        '(', ')', '[', ']', '{', '}', '$', '*', '&', '%', '!', ';', '<', '>', '?'
124        ),
125    'CASE_SENSITIVE' => array(
126        GESHI_COMMENTS => false,
127        1 => true,
128        2 => true,
129        3 => true,
130//        4 => true
131        ),
132    'STYLES' => array(
133        'KEYWORDS' => array(
134            1 => 'color: #ff7700;font-weight:bold;',    // Reserved
135            2 => 'color: #008000;',                        // Built-ins + self
136            3 => 'color: #dc143c;',                        // Standard lib
137//            4 => 'color: #0000cd;'                        // Special methods
138            ),
139        'COMMENTS' => array(
140            1 => 'color: #808080; font-style: italic;',
141//            2 => 'color: #483d8b;',
142            'MULTI' => 'color: #808080; font-style: italic;'
143            ),
144        'ESCAPE_CHAR' => array(
145            0 => 'color: #000099; font-weight: bold;'
146            ),
147        'BRACKETS' => array(
148            0 => 'color: black;'
149            ),
150        'STRINGS' => array(
151            0 => 'color: #483d8b;'
152            ),
153        'NUMBERS' => array(
154            0 => 'color: #ff4500;'
155            ),
156        'METHODS' => array(
157            1 => 'color: black;'
158            ),
159        'SYMBOLS' => array(
160            0 => 'color: #66cc66;'
161            ),
162        'REGEXPS' => array(
163            0 => 'color: #ff3333;'
164            ),
165        'SCRIPT' => array(
166            )
167        ),
168    'URLS' => array(
169        1 => '',
170        2 => '',
171        3 => '',
172//        4 => ''
173        ),
174    'OOLANG' => true,
175    'OBJECT_SPLITTERS' => array(
176        1 => '::'
177        ),
178    'REGEXPS' => array(
179        //Special variables
180        0 => '[\\$]+[a-zA-Z_][a-zA-Z0-9_]*',
181        ),
182    'STRICT_MODE_APPLIES' => GESHI_NEVER,
183    'SCRIPT_DELIMITERS' => array(
184        ),
185    'HIGHLIGHT_STRICT_BLOCK' => array(
186        ),
187    'PARSER_CONTROL' => array(
188        'COMMENTS' => array(
189            'DISALLOWED_BEFORE' => '\\'
190            )
191        )
192);
193