1 | define(["dojox/main", "../_base"], function(dojox){ |
---|
2 | |
---|
3 | var dh = dojox.highlight, dhc = dh.constants; |
---|
4 | dh.languages.javascript = { |
---|
5 | defaultMode: { |
---|
6 | lexems: [dhc.UNDERSCORE_IDENT_RE], |
---|
7 | contains: ['string', 'comment', 'number', 'regexp', 'function'], |
---|
8 | keywords: { |
---|
9 | 'keyword': { |
---|
10 | 'in': 1, 'if': 1, 'for': 1, 'while': 1, 'finally': 1, 'var': 1, |
---|
11 | 'new': 1, 'function': 1, 'do': 1, 'return': 1, 'void': 1, |
---|
12 | 'else': 1, 'break': 1, 'catch': 1, 'instanceof': 1, 'with': 1, |
---|
13 | 'throw': 1, 'case': 1, 'default': 1, 'try': 1, 'this': 1, |
---|
14 | 'switch': 1, 'continue': 1, 'typeof': 1, 'delete': 1 |
---|
15 | }, |
---|
16 | 'literal': {'true': 1, 'false': 1, 'null': 1} |
---|
17 | } |
---|
18 | }, |
---|
19 | modes: [ |
---|
20 | dhc.C_LINE_COMMENT_MODE, |
---|
21 | dhc.C_BLOCK_COMMENT_MODE, |
---|
22 | dhc.C_NUMBER_MODE, |
---|
23 | dhc.APOS_STRING_MODE, |
---|
24 | dhc.QUOTE_STRING_MODE, |
---|
25 | dhc.BACKSLASH_ESCAPE, |
---|
26 | { |
---|
27 | className: 'regexp', |
---|
28 | begin: '/.*?[^\\\\/]/[gim]*', end: '^' |
---|
29 | }, |
---|
30 | { |
---|
31 | className: 'function', |
---|
32 | begin: 'function\\b', end: '{', |
---|
33 | lexems: [dhc.UNDERSCORE_IDENT_RE], |
---|
34 | keywords: {'function': 1}, |
---|
35 | contains: ['title', 'params'] |
---|
36 | }, |
---|
37 | { |
---|
38 | className: 'title', |
---|
39 | begin: dhc.UNDERSCORE_IDENT_RE, end: '^' |
---|
40 | }, |
---|
41 | { |
---|
42 | className: 'params', |
---|
43 | begin: '\\(', end: '\\)', |
---|
44 | contains: ['string', 'comment'] |
---|
45 | } |
---|
46 | ] |
---|
47 | }; |
---|
48 | |
---|
49 | return dh.languages.javascript; |
---|
50 | }); |
---|