1<?php
2/*************************************************************************************
3 * dos.php
4 * -------
5 * Author: Alessandro Staltari (staltari@geocities.com)
6 * Copyright: (c) 2005 Alessandro Staltari (http://www.geocities.com/SiliconValley/Vista/8155/)
7 * Release Version: 1.0.9.1
8 * Date Started: 2005/07/05
9 *
10 * DOS language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2008/05/23 (1.0.7.22)
15 *   -  Added description of extra language features (SF#1970248)
16 * 2005/07/05 (1.0.0)
17 *  -  First Release
18 *
19 * TODO (updated 2005/07/05)
20 * -------------------------
21 *
22 * - Highlight pipes and redirection (do we really need this?)
23 * - Add missing keywords.
24 * - Find a good hyperlink for keywords.
25 * - Improve styles.
26 *
27 * KNOWN ISSUES (updated 2005/07/07)
28 * ---------------------------------
29 *
30 * - Doesn't even try to handle spaces in variables name or labels (I can't
31 *   find a reliable way to establish if a sting is a name or not, in some
32 *   cases it depends on the contex or enviroment status).
33 * - Doesn't handle %%[letter] pseudo variable used inside FOR constructs
34 *   (it should be done only into its scope: how to handle variable it?).
35 * - Doesn't handle %~[something] pseudo arguments.
36 * - If the same keyword is placed at the end of the line and the
37 *   beginning of the next, the second occourrence is not highlighted
38 *   (this should be a GeSHi bug, not related to the language definition).
39 * - I can't avoid to have keyword highlighted even when they are not used
40 *   as keywords but, for example, as arguments to the echo command.
41 *
42 *************************************************************************************
43 *
44 *     This file is part of GeSHi.
45 *
46 *   GeSHi is free software; you can redistribute it and/or modify
47 *   it under the terms of the GNU General Public License as published by
48 *   the Free Software Foundation; either version 2 of the License, or
49 *   (at your option) any later version.
50 *
51 *   GeSHi is distributed in the hope that it will be useful,
52 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
53 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54 *   GNU General Public License for more details.
55 *
56 *   You should have received a copy of the GNU General Public License
57 *   along with GeSHi; if not, write to the Free Software
58 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
59 *
60 ************************************************************************************/
61
62$language_data = array (
63    'LANG_NAME' => 'DOS',
64    'COMMENT_SINGLE' => array(),
65    'COMMENT_MULTI' => array(),
66    //DOS comment lines
67    'COMMENT_REGEXP' => array(
68        1 => "/^\s*@?REM\b.*$/mi",
69        2 => "/^\s*::.*$/m",
70        3 => "/\^./"
71        ),
72    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
73    'QUOTEMARKS' => array(),
74    'ESCAPE_CHAR' => '',
75    'KEYWORDS' => array(
76        /* Flow control keywords */
77        1 => array(
78            'if', 'else', 'goto', 'shift',
79            'for', 'in', 'do',
80            'call', 'exit'
81            ),
82        /* IF statement keywords */
83        2 => array(
84            'not', 'exist', 'errorlevel',
85            'defined',
86            'equ', 'neq', 'lss', 'leq', 'gtr', 'geq'
87            ),
88        /* Internal commands */
89        3 => array(
90            'cd', 'md', 'rd', 'chdir', 'mkdir', 'rmdir', 'dir',
91            'del', 'copy', 'move', 'ren', 'rename',
92            'echo',
93            'setlocal', 'endlocal', 'set',
94            'pause',
95            'pushd', 'popd', 'title', 'verify'
96            ),
97        /* Special files */
98        4 => array(
99            'prn', 'nul', 'lpt3', 'lpt2', 'lpt1', 'con',
100            'com4', 'com3', 'com2', 'com1', 'aux'
101            )
102        ),
103    'SYMBOLS' => array(
104        '(', ')', '@', '%', '!', '|', '<', '>', '&'
105        ),
106    'CASE_SENSITIVE' => array(
107        GESHI_COMMENTS => false,
108        1 => false,
109        2 => false,
110        3 => false,
111        4 => false
112        ),
113    'STYLES' => array(
114        'KEYWORDS' => array(
115            1 => 'color: #00b100; font-weight: bold;',
116            2 => 'color: #000000; font-weight: bold;',
117            3 => 'color: #b1b100; font-weight: bold;',
118            4 => 'color: #0000ff; font-weight: bold;'
119            ),
120        'COMMENTS' => array(
121            1 => 'color: #808080; font-style: italic;',
122            2 => 'color: #b100b1; font-style: italic;',
123            3 => 'color: #33cc33;'
124            ),
125        'ESCAPE_CHAR' => array(
126            0 => 'color: #ff0000; font-weight: bold;'
127            ),
128        'BRACKETS' => array(
129            0 => 'color: #66cc66;'
130            ),
131        'STRINGS' => array(
132            0 => 'color: #ff0000;'
133            ),
134        'NUMBERS' => array(
135            0 => 'color: #cc66cc;'
136            ),
137        'METHODS' => array(
138            ),
139        'SYMBOLS' => array(
140            0 => 'color: #33cc33;',
141            1 => 'color: #33cc33;'
142            ),
143        'SCRIPT' => array(
144            ),
145        'REGEXPS' => array(
146            0 => 'color: #b100b1; font-weight: bold;',
147            1 => 'color: #448844;',
148            2 => 'color: #448888;',
149            3 => 'color: #448888;'
150            )
151        ),
152    'OOLANG' => false,
153    'OBJECT_SPLITTERS' => array(
154        ),
155    'URLS' => array(
156        1 => 'http://www.ss64.com/nt/{FNAMEL}.html',
157        2 => 'http://www.ss64.com/nt/{FNAMEL}.html',
158        3 => 'http://www.ss64.com/nt/{FNAMEL}.html',
159        4 => 'http://www.ss64.com/nt/{FNAMEL}.html'
160        ),
161    'REGEXPS' => array(
162        /* Label */
163        0 => array(
164/*            GESHI_SEARCH => '((?si:[@\s]+GOTO\s+|\s+:)[\s]*)((?<!\n)[^\s\n]*)',*/
165            GESHI_SEARCH => '((?si:[@\s]+GOTO\s+|\s+:)[\s]*)((?<!\n)[^\s\n]*)',
166            GESHI_REPLACE => '\\2',
167            GESHI_MODIFIERS => 'si',
168            GESHI_BEFORE => '\\1',
169            GESHI_AFTER => ''
170        ),
171        /* Variable assignement */
172        1 => array(
173/*            GESHI_SEARCH => '(SET[\s]+(?si:\/A[\s]+|\/P[\s]+|))([^=\s\n]+)([\s]*=)',*/
174            GESHI_SEARCH => '(SET\s+(?si:\\/A\s+|\\/P\s+)?)([^=\n]+)(\s*=)',
175            GESHI_REPLACE => '\\2',
176            GESHI_MODIFIERS => 'si',
177            GESHI_BEFORE => '\\1',
178            GESHI_AFTER => '\\3'
179            ),
180        /* Arguments or variable evaluation */
181        2 => array(
182/*            GESHI_SEARCH => '(%)([\d*]|[^%\s]*(?=%))((?<!%\d)%|)',*/
183            GESHI_SEARCH => '(!(?:!(?=[a-z0-9]))?)([\d*]|(?:~[adfnpstxz]*(?:$\w+:)?)?[a-z0-9](?!\w)|[^!>\n]*(?=!))((?<!%\d)%|)(?!!>)',
184            GESHI_REPLACE => '\\2',
185            GESHI_MODIFIERS => 'si',
186            GESHI_BEFORE => '\\1',
187            GESHI_AFTER => '\\3'
188            ),
189        /* Arguments or variable evaluation */
190        3 => array(
191/*            GESHI_SEARCH => '(%)([\d*]|[^%\s]*(?=%))((?<!%\d)%|)',*/
192            GESHI_SEARCH => '(%(?:%(?=[a-z0-9]))?)([\d*]|(?:~[adfnpstxz]*(?:$\w+:)?)?[a-z0-9](?!\w)|[^%\n]*(?=%))((?<!%\d)%|)',
193            GESHI_REPLACE => '\\2',
194            GESHI_MODIFIERS => 'si',
195            GESHI_BEFORE => '\\1',
196            GESHI_AFTER => '\\3'
197            )
198        ),
199    'STRICT_MODE_APPLIES' => GESHI_NEVER,
200    'SCRIPT_DELIMITERS' => array(
201        ),
202    'HIGHLIGHT_STRICT_BLOCK' => array(
203        ),
204    'TAB_WIDTH' => 4,
205    'PARSER_CONTROL' => array(
206        'ENABLE_FLAGS' => array(
207            'BRACKETS' => GESHI_NEVER,
208            'NUMBERS' => GESHI_NEVER
209            ),
210        'KEYWORDS' => array(
211            1 => array(
212                'DISALLOWED_BEFORE' => '(?<![\w\-])'
213                ),
214            2 => array(
215                'DISALLOWED_BEFORE' => '(?<![\w\-])'
216                ),
217            3 => array(
218                'DISALLOWED_BEFORE' => '(?<![\w\-])'
219                ),
220            4 => array(
221                'DISALLOWED_BEFORE' => '(?<!\w)'
222                )
223            )
224        )
225);
226