1 | var colors = require('ansicolors');
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | module.exports = {
|
9 |
|
10 | 'Boolean': {
|
11 | 'true' : undefined
|
12 | , 'false' : undefined
|
13 | , _default : colors.brightRed
|
14 | }
|
15 |
|
16 | , 'Identifier': {
|
17 | 'undefined' : colors.brightBlack
|
18 | , 'self' : colors.brightRed
|
19 | , 'console' : colors.blue
|
20 | , 'log' : colors.blue
|
21 | , 'warn' : colors.red
|
22 | , 'error' : colors.brightRed
|
23 | , _default : colors.white
|
24 | }
|
25 |
|
26 | , 'Null': {
|
27 | _default: colors.brightBlack
|
28 | }
|
29 |
|
30 | , 'Numeric': {
|
31 | _default: colors.blue
|
32 | }
|
33 |
|
34 | , 'String': {
|
35 | _default: function (s, info) {
|
36 | var nextToken = info.tokens[info.tokenIndex + 1];
|
37 |
|
38 |
|
39 | return (nextToken && nextToken.type === 'Punctuator' && nextToken.value === ':')
|
40 | ? colors.brightBlue(s)
|
41 | : colors.brightGreen(s);
|
42 | }
|
43 | }
|
44 |
|
45 | , 'Keyword': {
|
46 | 'break' : undefined
|
47 |
|
48 | , 'case' : undefined
|
49 | , 'catch' : colors.cyan
|
50 | , 'class' : undefined
|
51 | , 'const' : undefined
|
52 | , 'continue' : undefined
|
53 |
|
54 | , 'debugger' : undefined
|
55 | , 'default' : undefined
|
56 | , 'delete' : colors.red
|
57 | , 'do' : undefined
|
58 |
|
59 | , 'else' : undefined
|
60 | , 'enum' : undefined
|
61 | , 'export' : undefined
|
62 | , 'extends' : undefined
|
63 |
|
64 | , 'finally' : colors.cyan
|
65 | , 'for' : undefined
|
66 | , 'function' : undefined
|
67 |
|
68 | , 'if' : undefined
|
69 | , 'implements' : undefined
|
70 | , 'import' : undefined
|
71 | , 'in' : undefined
|
72 | , 'instanceof' : undefined
|
73 | , 'let' : undefined
|
74 | , 'new' : colors.red
|
75 | , 'package' : undefined
|
76 | , 'private' : undefined
|
77 | , 'protected' : undefined
|
78 | , 'public' : undefined
|
79 | , 'return' : colors.red
|
80 | , 'static' : undefined
|
81 | , 'super' : undefined
|
82 | , 'switch' : undefined
|
83 |
|
84 | , 'this' : colors.brightRed
|
85 | , 'throw' : undefined
|
86 | , 'try' : colors.cyan
|
87 | , 'typeof' : undefined
|
88 |
|
89 | , 'var' : colors.green
|
90 | , 'void' : undefined
|
91 |
|
92 | , 'while' : undefined
|
93 | , 'with' : undefined
|
94 | , 'yield' : undefined
|
95 | , _default : colors.brightBlue
|
96 | }
|
97 | , 'Punctuator': {
|
98 | ';': colors.brightBlack
|
99 | , '.': colors.green
|
100 | , ',': colors.green
|
101 |
|
102 | , '{': colors.brightWhite
|
103 | , '}': colors.brightWhite
|
104 | , '(': colors.brightBlack
|
105 | , ')': colors.brightBlack
|
106 | , '[': colors.brightWhite
|
107 | , ']': colors.brightWhite
|
108 |
|
109 | , '<': undefined
|
110 | , '>': undefined
|
111 | , '+': undefined
|
112 | , '-': undefined
|
113 | , '*': undefined
|
114 | , '%': undefined
|
115 | , '&': undefined
|
116 | , '|': undefined
|
117 | , '^': undefined
|
118 | , '!': undefined
|
119 | , '~': undefined
|
120 | , '?': undefined
|
121 | , ':': undefined
|
122 | , '=': undefined
|
123 |
|
124 | , '<=': undefined
|
125 | , '>=': undefined
|
126 | , '==': undefined
|
127 | , '!=': undefined
|
128 | , '++': undefined
|
129 | , '--': undefined
|
130 | , '<<': undefined
|
131 | , '>>': undefined
|
132 | , '&&': undefined
|
133 | , '||': undefined
|
134 | , '+=': undefined
|
135 | , '-=': undefined
|
136 | , '*=': undefined
|
137 | , '%=': undefined
|
138 | , '&=': undefined
|
139 | , '|=': undefined
|
140 | , '^=': undefined
|
141 | , '/=': undefined
|
142 | , '=>': undefined
|
143 |
|
144 | , '===': undefined
|
145 | , '!==': undefined
|
146 | , '>>>': undefined
|
147 | , '<<=': undefined
|
148 | , '>>=': undefined
|
149 | , '...': undefined
|
150 |
|
151 | , '>>>=': undefined
|
152 |
|
153 | , _default: colors.brightYellow
|
154 | }
|
155 |
|
156 |
|
157 | , Line: {
|
158 | _default: colors.brightBlack
|
159 | }
|
160 |
|
161 |
|
162 | , Block: {
|
163 | _default: colors.brightBlack
|
164 | }
|
165 |
|
166 | , _default: undefined
|
167 | };
|