1<?php
2/*************************************************************************************
3 * j.php
4 * --------
5 * Author: Ric Sherlock (tikkanz@gmail.com)
6 * Copyright: (c) 2009 Ric Sherlock
7 * Release Version: 1.0.9.1
8 * Date Started: 2009/11/10
9 *
10 * J language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 *  2010/07/18 (1.0.8.10)
15 *   - Infinity and negative infinity recognized as numbers
16 *  2010/03/01 (1.0.8.8)
17 *   - Add support for label_xyz. and goto_xyz.
18 *   - Fix highlighting of for_i.
19 *   - Use alternative method for highlighting for_xyz. construct
20 *  2010/02/14 (1.0.8.7)
21 *   - Add support for primitives
22 *  2010/01/12 (1.0.2)
23 *   - Use HARDQUOTE for strings
24 *   - Highlight open quotes/incomplete strings
25 *   - Highlight multi-line comments that use Note
26 *   - Refinements for NUMBERS and Argument keywords
27 *   - Highlight infinity and neg. infinity using REGEXPS
28 *   - Highlight "for_myvar." style Control keyword using REGEXPS
29 *  2009/12/14 (1.0.1)
30 *   -  Regex for NUMBERS, SYMBOLS for () and turn off BRACKETS
31 *  2009/11/12 (1.0.0)
32 *   -  First Release
33 *
34 * TODO (updated 2010/01/27)
35 * -------------------------
36 *  * combine keyword categories by using conditional regex statement in PARSER CONTROL?
37 *************************************************************************************
38 *
39 *     This file is part of GeSHi.
40 *
41 *   GeSHi is free software; you can redistribute it and/or modify
42 *   it under the terms of the GNU General Public License as published by
43 *   the Free Software Foundation; either version 2 of the License, or
44 *   (at your option) any later version.
45 *
46 *   GeSHi is distributed in the hope that it will be useful,
47 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
48 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
49 *   GNU General Public License for more details.
50 *
51 *   You should have received a copy of the GNU General Public License
52 *   along with GeSHi; if not, write to the Free Software
53 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
54 *
55 ************************************************************************************/
56
57$language_data = array(
58    'LANG_NAME' => 'J',
59    'COMMENT_SINGLE' => array(),
60    'COMMENT_MULTI' => array(),
61    'COMMENT_REGEXP' => array(
62        1 => '/(?<!\w)NB\..*?$/m',                //singleline comments NB.
63        2 => '/(?<=\bNote\b).*?$\s+\)(?:(?!\n)\s)*$/sm',   //multiline comments in Note
64        3 => "/'[^']*?$/m"                        //incomplete strings/open quotes
65        ),
66    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
67    'QUOTEMARKS' => array(),
68    'ESCAPE_CHAR' => '',
69    'HARDQUOTE' => array("'", "'"),
70    'HARDESCAPE' => array("'"),
71    'HARDCHAR' => "'",
72    'NUMBERS' => array(
73        0 => '\b(?:_?\d+(?:\.\d+)?(?:x|[bejprx]_?[\da-z]+(?:\.[\da-z]+)?)?|__?)(?![\w\.\:])',
74        ),
75    'KEYWORDS' => array(
76        //Control words
77        1 => array(
78            'assert.', 'break.', 'case.', 'catch.', 'catcht.', 'continue.', 'do.',
79            'else.', 'elseif.', 'end.', 'fcase.', 'for.', 'goto.', 'if.', 'label.',
80            'return.', 'select.', 'throw.', 'trap.', 'try.', 'while.', 'whilst.'
81            ),
82        //Arguments
83        2 => array(
84            'm', 'n', 'u', 'v', 'x', 'y'
85            ),
86        ),
87    'SYMBOLS' => array(
88        //Punctuation
89        0 => array(
90            '(', ')'
91            )
92        ),
93    'CASE_SENSITIVE' => array(
94        GESHI_COMMENTS => false,
95        1 => true,
96        2 => true,
97        //6 => true,
98        //7 => true,
99        //8 => true,
100        ),
101    'STYLES' => array(
102        'KEYWORDS' => array(
103            1 => 'color: #0000ff; font-weight: bold;',
104            2 => 'color: #0000cc; font-weight: bold;',
105            //6 => 'color: #000000; font-weight: bold;',
106            //7 => 'color: #000000; font-weight: bold;',
107            //8 => 'color: #000000; font-weight: bold;',
108            ),
109        'COMMENTS' => array(
110            1 => 'color: #666666; font-style: italic;',
111            2 => 'color: #666666; font-style: italic; font-weight: bold;',
112            3 => 'color: #ff00ff; ',                      //open quote
113            'MULTI' => 'color: #666666; font-style: italic;'
114            ),
115        'ESCAPE_CHAR' => array(
116            'HARD' => 'font-weight: bold;',
117            0 => '',
118            ),
119        'BRACKETS' => array(
120            0 => 'color: #009900;'
121            ),
122        'STRINGS' => array(
123            'HARD' => 'color: #ff0000;',
124            0 => 'color: #ff0000;',
125            ),
126        'NUMBERS' => array(
127            0 => 'color: #009999; font-weight: bold;'
128            ),
129        'METHODS' => array(
130            ),
131        'SYMBOLS' => array(
132            0 => 'color: #009900; font-weight: bold;'
133            ),
134        'REGEXPS' => array(
135            0 => 'color: #0000ff; font-weight: bold;',   //for_xyz. - same as kw1
136            ),
137        'SCRIPT' => array(
138            )
139        ),
140    'URLS' => array(
141        1 => '', //'http://www.jsoftware.com/help/dictionary/ctrl.htm',
142        2 => '',
143        //6 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
144        //7 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
145        //8 => '', //'http://www.jsoftware.com/jwiki/Vocabulary',
146        ),
147    'OOLANG' => false,
148    'OBJECT_SPLITTERS' => array(
149        ),
150    'REGEXPS' => array(
151        0 => '\b(for|goto|label)_[a-zA-Z]\w*\.',   //for_xyz. - should be kw1
152        ),
153    'STRICT_MODE_APPLIES' => GESHI_NEVER,
154    'SCRIPT_DELIMITERS' => array(
155        ),
156    'HIGHLIGHT_STRICT_BLOCK' => array(
157        ),
158    'PARSER_CONTROL' => array(
159        'ENABLE_FLAGS' => array(
160            'BRACKETS' => GESHI_NEVER,
161            ),
162        'NUMBERS' => array(
163            'PRECHECK_RX' => '#[\d_]#',            // underscore is valid number
164            ),
165        'KEYWORDS' => array(
166            //Control words
167            2 => array(
168                'DISALLOWED_BEFORE' => '(?<!\w)',
169                'DISALLOWED_AFTER' => '(?![\w\.\:])',
170                ),
171            //Primtives starting with a symbol (except . or :)
172            6 => array(
173                'DISALLOWED_BEFORE' => '(?!K)',    // effect should be to allow anything
174                'DISALLOWED_AFTER' => '(?=.*)',
175                ),
176            //Primtives starting with a letter
177            7 => array(
178                'DISALLOWED_BEFORE' => '(?<!\w)',
179                'DISALLOWED_AFTER' => '(?=.*)',
180                ),
181            //Primtives starting with symbol . or :
182            8 => array(
183                'DISALLOWED_BEFORE' => '(?<=\s)',
184                'DISALLOWED_AFTER' => '(?=.*)',
185                ),
186            )
187        )
188);
189