1<?php
2/*************************************************************************************
3 * javascript.php
4 * --------------
5 * Author: Ben Keen (ben.keen@gmail.com)
6 * Copyright: (c) 2004 Ben Keen (ben.keen@gmail.com), Nigel McNie (http://qbnz.com/highlighter)
7 * Release Version: 1.0.9.1
8 * Date Started: 2004/06/20
9 *
10 * JavaScript language file for GeSHi.
11 *
12 * CHANGES
13 * -------
14 * 2012/06/27 (1.0.8.11)
15 *  -  Reordered Keyword Groups to reflect syntactical meaning of keywords
16 * 2008/05/23 (1.0.7.22)
17 *  -  Added description of extra language features (SF#1970248)
18 * 2004/11/27 (1.0.1)
19 *  -  Added support for multiple object splitters
20 * 2004/10/27 (1.0.0)
21 *  -  First Release
22 *
23 * TODO (updated 2004/11/27)
24 * -------------------------
25 *
26 *************************************************************************************
27 *
28 *     This file is part of GeSHi.
29 *
30 *   GeSHi is free software; you can redistribute it and/or modify
31 *   it under the terms of the GNU General Public License as published by
32 *   the Free Software Foundation; either version 2 of the License, or
33 *   (at your option) any later version.
34 *
35 *   GeSHi is distributed in the hope that it will be useful,
36 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
37 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
38 *   GNU General Public License for more details.
39 *
40 *   You should have received a copy of the GNU General Public License
41 *   along with GeSHi; if not, write to the Free Software
42 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
43 *
44 ************************************************************************************/
45
46$language_data = array (
47    'LANG_NAME' => 'Javascript',
48    'COMMENT_SINGLE' => array(1 => '//'),
49    'COMMENT_MULTI' => array('/*' => '*/'),
50    'COMMENT_REGEXP' => array(
51        //Regular Expressions
52        2 => "/(?<=[\\s^])(s|tr|y)\\/(?!\*)(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])+(?<!\s)\\/(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])*(?<!\s)\\/[msixpogcde]*(?=[\\s$\\.\\;])|(?<=[\\s^(=])(m|q[qrwx]?)?\\/(?!\*)(?!\s)(?:\\\\.|(?!\n)[^\\/\\\\])+(?<!\s)\\/[msixpogc]*(?=[\\s$\\.\\,\\;\\)])/iU"
53        ),
54    'CASE_KEYWORDS' => GESHI_CAPS_NO_CHANGE,
55    'QUOTEMARKS' => array("'", '"'),
56    'ESCAPE_CHAR' => '\\',
57    'KEYWORDS' => array(
58        1 => array(
59            //reserved/keywords; also some non-reserved keywords
60            'break','case','catch','const','continue',
61            'default','delete','do',
62            'else',
63            'finally','for','function',
64            'get','goto',
65            'if','in','instanceof',
66            'new',
67            'prototype',
68            'return',
69            'set','static','switch',
70            'this','throw','try','typeof',
71            'var','void'
72            ),
73        2 => array(
74            //reserved/non-keywords; metaconstants
75            'false','null','true','undefined','NaN','Infinity'
76            ),
77        3 => array(
78            //magic properties/functions
79            '__proto__','__defineGetter__','__defineSetter__','hasOwnProperty','hasProperty'
80            ),
81        4 => array(
82            //type constructors
83            'Object', 'Function', 'Date', 'Math', 'String', 'Number', 'Boolean', 'Array'
84            ),
85        5 => array(
86            //reserved, but invalid in language
87            'abstract','boolean','byte','char','class','debugger','double','enum','export','extends',
88            'final','float','implements','import','int','interface','long','native',
89            'short','super','synchronized','throws','transient','volatile'
90            ),
91        ),
92    'SYMBOLS' => array(
93        '(', ')', '[', ']', '{', '}',
94        '+', '-', '*', '/', '%',
95        '!', '@', '&', '|', '^',
96        '<', '>', '=',
97        ',', ';', '?', ':'
98        ),
99    'CASE_SENSITIVE' => array(
100        GESHI_COMMENTS => false,
101        1 => true,
102        2 => true,
103        3 => true,
104        4 => true,
105        5 => true
106        ),
107    'STYLES' => array(
108        'KEYWORDS' => array(
109            1 => 'color: #000066; font-weight: bold;',
110            2 => 'color: #003366; font-weight: bold;',
111            3 => 'color: #000066;',
112            5 => 'color: #FF0000;'
113            ),
114        'COMMENTS' => array(
115            1 => 'color: #006600; font-style: italic;',
116            2 => 'color: #009966; font-style: italic;',
117            'MULTI' => 'color: #006600; font-style: italic;'
118            ),
119        'ESCAPE_CHAR' => array(
120            0 => 'color: #000099; font-weight: bold;'
121            ),
122        'BRACKETS' => array(
123            0 => 'color: #009900;'
124            ),
125        'STRINGS' => array(
126            0 => 'color: #3366CC;'
127            ),
128        'NUMBERS' => array(
129            0 => 'color: #CC0000;'
130            ),
131        'METHODS' => array(
132            1 => 'color: #660066;'
133            ),
134        'SYMBOLS' => array(
135            0 => 'color: #339933;'
136            ),
137        'REGEXPS' => array(
138            ),
139        'SCRIPT' => array(
140            0 => '',
141            1 => '',
142            2 => '',
143            3 => ''
144            )
145        ),
146    'URLS' => array(
147        1 => '',
148        2 => '',
149        3 => '',
150        4 => '',
151        5 => ''
152    ),
153    'OOLANG' => true,
154    'OBJECT_SPLITTERS' => array(
155        1 => '.'
156        ),
157    'REGEXPS' => array(
158        ),
159    'STRICT_MODE_APPLIES' => GESHI_MAYBE,
160    'SCRIPT_DELIMITERS' => array(
161        0 => array(
162            '<script type="text/javascript">' => '</script>'
163            ),
164        1 => array(
165            '<script language="javascript">' => '</script>'
166            )
167        ),
168    'HIGHLIGHT_STRICT_BLOCK' => array(
169        0 => true,
170        1 => true
171        )
172);
173