OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 // Generated by scripts/tokenizer_gen.py. | |
5 | |
6 | |
7 /** A generated file that extends the hand coded methods in TokenizerBase. */ | |
8 class Tokenizer extends TokenizerBase { | |
9 | |
10 Tokenizer(SourceFile source, bool skipWhitespace, [int index = 0]) | |
11 : super(source, skipWhitespace, index); | |
12 | |
13 Token next() { | |
14 // keep track of our starting position | |
15 _startIndex = _index; | |
16 | |
17 if (_interpStack != null && _interpStack.depth == 0) { | |
18 var istack = _interpStack; | |
19 _interpStack = _interpStack.pop(); | |
20 if (istack.isMultiline) { | |
21 return finishMultilineString(istack.quote); | |
22 } else { | |
23 return finishStringBody(istack.quote); | |
24 } | |
25 } | |
26 | |
27 int ch; | |
28 ch = _nextChar(); | |
29 switch(ch) { | |
30 case 0: return _finishToken(TokenKind.END_OF_FILE); | |
31 case 32/*' '*/: case 9/*'\t'*/: case 10/*'\n'*/: case 13/*'\r'*/: | |
32 return finishWhitespace(); | |
33 case 33/*!*/: | |
34 if (_maybeEatChar(61/*=*/)) { | |
35 if (_maybeEatChar(61/*=*/)) { | |
36 return _finishToken(TokenKind.NE_STRICT); | |
37 } else { | |
38 return _finishToken(TokenKind.NE); | |
39 } | |
40 } else { | |
41 return _finishToken(TokenKind.NOT); | |
42 } | |
43 case 34/*"*/: | |
44 return finishString(34/*"*/); | |
45 case 35/*#*/: | |
46 if (_maybeEatChar(33/*!*/)) { | |
47 return finishHashBang(); | |
48 } else { | |
49 return _finishToken(TokenKind.HASH); | |
50 } | |
51 case 36/*$*/: | |
52 if (_maybeEatChar(34/*"*/)) { | |
53 return finishString(34/*"*/); | |
54 } else if (_maybeEatChar(39/*'*/)) { | |
55 return finishString(39/*'*/); | |
56 } else { | |
57 return finishIdentifier(36/*$*/); | |
58 } | |
59 case 37/*%*/: | |
60 if (_maybeEatChar(61/*=*/)) { | |
61 return _finishToken(TokenKind.ASSIGN_MOD); | |
62 } else { | |
63 return _finishToken(TokenKind.MOD); | |
64 } | |
65 case 38/*&*/: | |
66 if (_maybeEatChar(38/*&*/)) { | |
67 return _finishToken(TokenKind.AND); | |
68 } else if (_maybeEatChar(61/*=*/)) { | |
69 return _finishToken(TokenKind.ASSIGN_AND); | |
70 } else { | |
71 return _finishToken(TokenKind.BIT_AND); | |
72 } | |
73 case 39/*'*/: | |
74 return finishString(39/*'*/); | |
75 case 40/*(*/: | |
76 return _finishToken(TokenKind.LPAREN); | |
77 case 41/*)*/: | |
78 return _finishToken(TokenKind.RPAREN); | |
79 case 42/*'*'*/: | |
80 if (_maybeEatChar(61/*=*/)) { | |
81 return _finishToken(TokenKind.ASSIGN_MUL); | |
82 } else { | |
83 return _finishToken(TokenKind.MUL); | |
84 } | |
85 case 43/*+*/: | |
86 if (_maybeEatChar(43/*+*/)) { | |
87 return _finishToken(TokenKind.INCR); | |
88 } else if (_maybeEatChar(61/*=*/)) { | |
89 return _finishToken(TokenKind.ASSIGN_ADD); | |
90 } else { | |
91 return _finishToken(TokenKind.ADD); | |
92 } | |
93 case 44/*,*/: | |
94 return _finishToken(TokenKind.COMMA); | |
95 case 45/*-*/: | |
96 if (_maybeEatChar(45/*-*/)) { | |
97 return _finishToken(TokenKind.DECR); | |
98 } else if (_maybeEatChar(61/*=*/)) { | |
99 return _finishToken(TokenKind.ASSIGN_SUB); | |
100 } else { | |
101 return _finishToken(TokenKind.SUB); | |
102 } | |
103 case 46/*.*/: | |
104 if (_maybeEatChar(46/*.*/)) { | |
105 if (_maybeEatChar(46/*.*/)) { | |
106 return _finishToken(TokenKind.ELLIPSIS); | |
107 } else { | |
108 return _errorToken(); | |
109 } | |
110 } else { | |
111 return finishDot(); | |
112 } | |
113 case 47/*'/'*/: | |
114 if (_maybeEatChar(42/*'*'*/)) { | |
115 return finishMultiLineComment(); | |
116 } else if (_maybeEatChar(47/*'/'*/)) { | |
117 return finishSingleLineComment(); | |
118 } else if (_maybeEatChar(61/*=*/)) { | |
119 return _finishToken(TokenKind.ASSIGN_DIV); | |
120 } else { | |
121 return _finishToken(TokenKind.DIV); | |
122 } | |
123 case 48/*0*/: | |
124 if (_maybeEatChar(88/*X*/)) { | |
125 return finishHex(); | |
126 } else if (_maybeEatChar(120/*x*/)) { | |
127 return finishHex(); | |
128 } else { | |
129 return finishNumber(); | |
130 } | |
131 case 58/*:*/: | |
132 return _finishToken(TokenKind.COLON); | |
133 case 59/*;*/: | |
134 return _finishToken(TokenKind.SEMICOLON); | |
135 case 60/*<*/: | |
136 if (_maybeEatChar(60/*<*/)) { | |
137 if (_maybeEatChar(61/*=*/)) { | |
138 return _finishToken(TokenKind.ASSIGN_SHL); | |
139 } else { | |
140 return _finishToken(TokenKind.SHL); | |
141 } | |
142 } else if (_maybeEatChar(61/*=*/)) { | |
143 return _finishToken(TokenKind.LTE); | |
144 } else { | |
145 return _finishToken(TokenKind.LT); | |
146 } | |
147 case 61/*=*/: | |
148 if (_maybeEatChar(61/*=*/)) { | |
149 if (_maybeEatChar(61/*=*/)) { | |
150 return _finishToken(TokenKind.EQ_STRICT); | |
151 } else { | |
152 return _finishToken(TokenKind.EQ); | |
153 } | |
154 } else if (_maybeEatChar(62/*>*/)) { | |
155 return _finishToken(TokenKind.ARROW); | |
156 } else { | |
157 return _finishToken(TokenKind.ASSIGN); | |
158 } | |
159 case 62/*>*/: | |
160 if (_maybeEatChar(61/*=*/)) { | |
161 return _finishToken(TokenKind.GTE); | |
162 } else if (_maybeEatChar(62/*>*/)) { | |
163 if (_maybeEatChar(61/*=*/)) { | |
164 return _finishToken(TokenKind.ASSIGN_SAR); | |
165 } else if (_maybeEatChar(62/*>*/)) { | |
166 if (_maybeEatChar(61/*=*/)) { | |
167 return _finishToken(TokenKind.ASSIGN_SHR); | |
168 } else { | |
169 return _finishToken(TokenKind.SHR); | |
170 } | |
171 } else { | |
172 return _finishToken(TokenKind.SAR); | |
173 } | |
174 } else { | |
175 return _finishToken(TokenKind.GT); | |
176 } | |
177 case 63/*?*/: | |
178 return _finishToken(TokenKind.CONDITIONAL); | |
179 case 64/*@*/: | |
180 if (_maybeEatChar(34/*"*/)) { | |
181 return finishRawString(34/*"*/); | |
182 } else if (_maybeEatChar(39/*'*/)) { | |
183 return finishRawString(39/*'*/); | |
184 } else { | |
185 return _errorToken(); | |
186 } | |
187 case 91/*[*/: | |
188 if (_maybeEatChar(93/*]*/)) { | |
189 if (_maybeEatChar(61/*=*/)) { | |
190 return _finishToken(TokenKind.SETINDEX); | |
191 } else { | |
192 return _finishToken(TokenKind.INDEX); | |
193 } | |
194 } else { | |
195 return _finishToken(TokenKind.LBRACK); | |
196 } | |
197 case 93/*]*/: | |
198 return _finishToken(TokenKind.RBRACK); | |
199 case 94/*^*/: | |
200 if (_maybeEatChar(61/*=*/)) { | |
201 return _finishToken(TokenKind.ASSIGN_XOR); | |
202 } else { | |
203 return _finishToken(TokenKind.BIT_XOR); | |
204 } | |
205 case 123/*{*/: | |
206 return _finishOpenBrace(); | |
207 case 124/*|*/: | |
208 if (_maybeEatChar(61/*=*/)) { | |
209 return _finishToken(TokenKind.ASSIGN_OR); | |
210 } else if (_maybeEatChar(124/*|*/)) { | |
211 return _finishToken(TokenKind.OR); | |
212 } else { | |
213 return _finishToken(TokenKind.BIT_OR); | |
214 } | |
215 case 125/*}*/: | |
216 return _finishCloseBrace(); | |
217 case 126/*~*/: | |
218 if (_maybeEatChar(47/*'/'*/)) { | |
219 if (_maybeEatChar(61/*=*/)) { | |
220 return _finishToken(TokenKind.ASSIGN_TRUNCDIV); | |
221 } else { | |
222 return _finishToken(TokenKind.TRUNCDIV); | |
223 } | |
224 } else { | |
225 return _finishToken(TokenKind.BIT_NOT); | |
226 } | |
227 default: | |
228 if (TokenizerHelpers.isIdentifierStart(ch)) { | |
229 return this.finishIdentifier(ch); | |
230 } else if (TokenizerHelpers.isDigit(ch)) { | |
231 return this.finishNumber(); | |
232 } else { | |
233 return _errorToken(); | |
234 } | |
235 } | |
236 | |
237 } | |
238 | |
239 int getIdentifierKind() { | |
240 final i0 = _startIndex; | |
241 int ch; | |
242 switch (_index - i0) { | |
243 case 2: | |
244 ch = _text.charCodeAt(i0); | |
245 if (ch == 100/*d*/) { | |
246 if (_text.charCodeAt(i0+1) == 111/*o*/) return TokenKind.DO; | |
247 } else if (ch == 105/*i*/) { | |
248 ch = _text.charCodeAt(i0+1); | |
249 if (ch == 102/*f*/) { | |
250 return TokenKind.IF; | |
251 } else if (ch == 110/*n*/) { | |
252 return TokenKind.IN; | |
253 } else if (ch == 115/*s*/) { | |
254 return TokenKind.IS; | |
255 } | |
256 } | |
257 return TokenKind.IDENTIFIER; | |
258 case 3: | |
259 ch = _text.charCodeAt(i0); | |
260 if (ch == 102/*f*/) { | |
261 if (_text.charCodeAt(i0+1) == 111/*o*/ && _text.charCodeAt(i0+2) == 11
4/*r*/) return TokenKind.FOR; | |
262 } else if (ch == 103/*g*/) { | |
263 if (_text.charCodeAt(i0+1) == 101/*e*/ && _text.charCodeAt(i0+2) == 11
6/*t*/) return TokenKind.GET; | |
264 } else if (ch == 110/*n*/) { | |
265 if (_text.charCodeAt(i0+1) == 101/*e*/ && _text.charCodeAt(i0+2) == 11
9/*w*/) return TokenKind.NEW; | |
266 } else if (ch == 115/*s*/) { | |
267 if (_text.charCodeAt(i0+1) == 101/*e*/ && _text.charCodeAt(i0+2) == 11
6/*t*/) return TokenKind.SET; | |
268 } else if (ch == 116/*t*/) { | |
269 if (_text.charCodeAt(i0+1) == 114/*r*/ && _text.charCodeAt(i0+2) == 12
1/*y*/) return TokenKind.TRY; | |
270 } else if (ch == 118/*v*/) { | |
271 if (_text.charCodeAt(i0+1) == 97/*a*/ && _text.charCodeAt(i0+2) == 114
/*r*/) return TokenKind.VAR; | |
272 } | |
273 return TokenKind.IDENTIFIER; | |
274 case 4: | |
275 ch = _text.charCodeAt(i0); | |
276 if (ch == 99/*c*/) { | |
277 ch = _text.charCodeAt(i0+1); | |
278 if (ch == 97/*a*/) { | |
279 ch = _text.charCodeAt(i0+2); | |
280 if (ch == 108/*l*/) { | |
281 if (_text.charCodeAt(i0+3) == 108/*l*/) return TokenKind.CALL; | |
282 } else if (ch == 115/*s*/) { | |
283 if (_text.charCodeAt(i0+3) == 101/*e*/) return TokenKind.CASE; | |
284 } | |
285 } | |
286 } else if (ch == 101/*e*/) { | |
287 if (_text.charCodeAt(i0+1) == 108/*l*/ && _text.charCodeAt(i0+2) == 11
5/*s*/ && _text.charCodeAt(i0+3) == 101/*e*/) return TokenKind.ELSE; | |
288 } else if (ch == 110/*n*/) { | |
289 if (_text.charCodeAt(i0+1) == 117/*u*/ && _text.charCodeAt(i0+2) == 10
8/*l*/ && _text.charCodeAt(i0+3) == 108/*l*/) return TokenKind.NULL; | |
290 } else if (ch == 116/*t*/) { | |
291 ch = _text.charCodeAt(i0+1); | |
292 if (ch == 104/*h*/) { | |
293 if (_text.charCodeAt(i0+2) == 105/*i*/ && _text.charCodeAt(i0+3) ==
115/*s*/) return TokenKind.THIS; | |
294 } else if (ch == 114/*r*/) { | |
295 if (_text.charCodeAt(i0+2) == 117/*u*/ && _text.charCodeAt(i0+3) ==
101/*e*/) return TokenKind.TRUE; | |
296 } | |
297 } else if (ch == 118/*v*/) { | |
298 if (_text.charCodeAt(i0+1) == 111/*o*/ && _text.charCodeAt(i0+2) == 10
5/*i*/ && _text.charCodeAt(i0+3) == 100/*d*/) return TokenKind.VOID; | |
299 } | |
300 return TokenKind.IDENTIFIER; | |
301 case 5: | |
302 ch = _text.charCodeAt(i0); | |
303 if (ch == 97/*a*/) { | |
304 if (_text.charCodeAt(i0+1) == 119/*w*/ && _text.charCodeAt(i0+2) == 97
/*a*/ && _text.charCodeAt(i0+3) == 105/*i*/ && _text.charCodeAt(i0+4) == 116/*t*
/) return TokenKind.AWAIT; | |
305 } else if (ch == 98/*b*/) { | |
306 if (_text.charCodeAt(i0+1) == 114/*r*/ && _text.charCodeAt(i0+2) == 10
1/*e*/ && _text.charCodeAt(i0+3) == 97/*a*/ && _text.charCodeAt(i0+4) == 107/*k*
/) return TokenKind.BREAK; | |
307 } else if (ch == 99/*c*/) { | |
308 ch = _text.charCodeAt(i0+1); | |
309 if (ch == 97/*a*/) { | |
310 if (_text.charCodeAt(i0+2) == 116/*t*/ && _text.charCodeAt(i0+3) ==
99/*c*/ && _text.charCodeAt(i0+4) == 104/*h*/) return TokenKind.CATCH; | |
311 } else if (ch == 108/*l*/) { | |
312 if (_text.charCodeAt(i0+2) == 97/*a*/ && _text.charCodeAt(i0+3) == 1
15/*s*/ && _text.charCodeAt(i0+4) == 115/*s*/) return TokenKind.CLASS; | |
313 } else if (ch == 111/*o*/) { | |
314 if (_text.charCodeAt(i0+2) == 110/*n*/ && _text.charCodeAt(i0+3) ==
115/*s*/ && _text.charCodeAt(i0+4) == 116/*t*/) return TokenKind.CONST; | |
315 } | |
316 } else if (ch == 102/*f*/) { | |
317 ch = _text.charCodeAt(i0+1); | |
318 if (ch == 97/*a*/) { | |
319 if (_text.charCodeAt(i0+2) == 108/*l*/ && _text.charCodeAt(i0+3) ==
115/*s*/ && _text.charCodeAt(i0+4) == 101/*e*/) return TokenKind.FALSE; | |
320 } else if (ch == 105/*i*/) { | |
321 if (_text.charCodeAt(i0+2) == 110/*n*/ && _text.charCodeAt(i0+3) ==
97/*a*/ && _text.charCodeAt(i0+4) == 108/*l*/) return TokenKind.FINAL; | |
322 } | |
323 } else if (ch == 115/*s*/) { | |
324 if (_text.charCodeAt(i0+1) == 117/*u*/ && _text.charCodeAt(i0+2) == 11
2/*p*/ && _text.charCodeAt(i0+3) == 101/*e*/ && _text.charCodeAt(i0+4) == 114/*r
*/) return TokenKind.SUPER; | |
325 } else if (ch == 116/*t*/) { | |
326 if (_text.charCodeAt(i0+1) == 104/*h*/ && _text.charCodeAt(i0+2) == 11
4/*r*/ && _text.charCodeAt(i0+3) == 111/*o*/ && _text.charCodeAt(i0+4) == 119/*w
*/) return TokenKind.THROW; | |
327 } else if (ch == 119/*w*/) { | |
328 if (_text.charCodeAt(i0+1) == 104/*h*/ && _text.charCodeAt(i0+2) == 10
5/*i*/ && _text.charCodeAt(i0+3) == 108/*l*/ && _text.charCodeAt(i0+4) == 101/*e
*/) return TokenKind.WHILE; | |
329 } | |
330 return TokenKind.IDENTIFIER; | |
331 case 6: | |
332 ch = _text.charCodeAt(i0); | |
333 if (ch == 97/*a*/) { | |
334 if (_text.charCodeAt(i0+1) == 115/*s*/ && _text.charCodeAt(i0+2) == 11
5/*s*/ && _text.charCodeAt(i0+3) == 101/*e*/ && _text.charCodeAt(i0+4) == 114/*r
*/ && _text.charCodeAt(i0+5) == 116/*t*/) return TokenKind.ASSERT; | |
335 } else if (ch == 105/*i*/) { | |
336 if (_text.charCodeAt(i0+1) == 109/*m*/ && _text.charCodeAt(i0+2) == 11
2/*p*/ && _text.charCodeAt(i0+3) == 111/*o*/ && _text.charCodeAt(i0+4) == 114/*r
*/ && _text.charCodeAt(i0+5) == 116/*t*/) return TokenKind.IMPORT; | |
337 } else if (ch == 110/*n*/) { | |
338 ch = _text.charCodeAt(i0+1); | |
339 if (ch == 97/*a*/) { | |
340 if (_text.charCodeAt(i0+2) == 116/*t*/ && _text.charCodeAt(i0+3) ==
105/*i*/ && _text.charCodeAt(i0+4) == 118/*v*/ && _text.charCodeAt(i0+5) == 101/
*e*/) return TokenKind.NATIVE; | |
341 } else if (ch == 101/*e*/) { | |
342 if (_text.charCodeAt(i0+2) == 103/*g*/ && _text.charCodeAt(i0+3) ==
97/*a*/ && _text.charCodeAt(i0+4) == 116/*t*/ && _text.charCodeAt(i0+5) == 101/*
e*/) return TokenKind.NEGATE; | |
343 } | |
344 } else if (ch == 114/*r*/) { | |
345 if (_text.charCodeAt(i0+1) == 101/*e*/ && _text.charCodeAt(i0+2) == 11
6/*t*/ && _text.charCodeAt(i0+3) == 117/*u*/ && _text.charCodeAt(i0+4) == 114/*r
*/ && _text.charCodeAt(i0+5) == 110/*n*/) return TokenKind.RETURN; | |
346 } else if (ch == 115/*s*/) { | |
347 ch = _text.charCodeAt(i0+1); | |
348 if (ch == 111/*o*/) { | |
349 if (_text.charCodeAt(i0+2) == 117/*u*/ && _text.charCodeAt(i0+3) ==
114/*r*/ && _text.charCodeAt(i0+4) == 99/*c*/ && _text.charCodeAt(i0+5) == 101/*
e*/) return TokenKind.SOURCE; | |
350 } else if (ch == 116/*t*/) { | |
351 if (_text.charCodeAt(i0+2) == 97/*a*/ && _text.charCodeAt(i0+3) == 1
16/*t*/ && _text.charCodeAt(i0+4) == 105/*i*/ && _text.charCodeAt(i0+5) == 99/*c
*/) return TokenKind.STATIC; | |
352 } else if (ch == 119/*w*/) { | |
353 if (_text.charCodeAt(i0+2) == 105/*i*/ && _text.charCodeAt(i0+3) ==
116/*t*/ && _text.charCodeAt(i0+4) == 99/*c*/ && _text.charCodeAt(i0+5) == 104/*
h*/) return TokenKind.SWITCH; | |
354 } | |
355 } | |
356 return TokenKind.IDENTIFIER; | |
357 case 7: | |
358 ch = _text.charCodeAt(i0); | |
359 if (ch == 100/*d*/) { | |
360 if (_text.charCodeAt(i0+1) == 101/*e*/ && _text.charCodeAt(i0+2) == 10
2/*f*/ && _text.charCodeAt(i0+3) == 97/*a*/ && _text.charCodeAt(i0+4) == 117/*u*
/ && _text.charCodeAt(i0+5) == 108/*l*/ && _text.charCodeAt(i0+6) == 116/*t*/) r
eturn TokenKind.DEFAULT; | |
361 } else if (ch == 101/*e*/) { | |
362 if (_text.charCodeAt(i0+1) == 120/*x*/ && _text.charCodeAt(i0+2) == 11
6/*t*/ && _text.charCodeAt(i0+3) == 101/*e*/ && _text.charCodeAt(i0+4) == 110/*n
*/ && _text.charCodeAt(i0+5) == 100/*d*/ && _text.charCodeAt(i0+6) == 115/*s*/)
return TokenKind.EXTENDS; | |
363 } else if (ch == 102/*f*/) { | |
364 ch = _text.charCodeAt(i0+1); | |
365 if (ch == 97/*a*/) { | |
366 if (_text.charCodeAt(i0+2) == 99/*c*/ && _text.charCodeAt(i0+3) == 1
16/*t*/ && _text.charCodeAt(i0+4) == 111/*o*/ && _text.charCodeAt(i0+5) == 114/*
r*/ && _text.charCodeAt(i0+6) == 121/*y*/) return TokenKind.FACTORY; | |
367 } else if (ch == 105/*i*/) { | |
368 if (_text.charCodeAt(i0+2) == 110/*n*/ && _text.charCodeAt(i0+3) ==
97/*a*/ && _text.charCodeAt(i0+4) == 108/*l*/ && _text.charCodeAt(i0+5) == 108/*
l*/ && _text.charCodeAt(i0+6) == 121/*y*/) return TokenKind.FINALLY; | |
369 } | |
370 } else if (ch == 108/*l*/) { | |
371 if (_text.charCodeAt(i0+1) == 105/*i*/ && _text.charCodeAt(i0+2) == 98
/*b*/ && _text.charCodeAt(i0+3) == 114/*r*/ && _text.charCodeAt(i0+4) == 97/*a*/
&& _text.charCodeAt(i0+5) == 114/*r*/ && _text.charCodeAt(i0+6) == 121/*y*/) re
turn TokenKind.LIBRARY; | |
372 } else if (ch == 116/*t*/) { | |
373 if (_text.charCodeAt(i0+1) == 121/*y*/ && _text.charCodeAt(i0+2) == 11
2/*p*/ && _text.charCodeAt(i0+3) == 101/*e*/ && _text.charCodeAt(i0+4) == 100/*d
*/ && _text.charCodeAt(i0+5) == 101/*e*/ && _text.charCodeAt(i0+6) == 102/*f*/)
return TokenKind.TYPEDEF; | |
374 } | |
375 return TokenKind.IDENTIFIER; | |
376 case 8: | |
377 ch = _text.charCodeAt(i0); | |
378 if (ch == 97/*a*/) { | |
379 if (_text.charCodeAt(i0+1) == 98/*b*/ && _text.charCodeAt(i0+2) == 115
/*s*/ && _text.charCodeAt(i0+3) == 116/*t*/ && _text.charCodeAt(i0+4) == 114/*r*
/ && _text.charCodeAt(i0+5) == 97/*a*/ && _text.charCodeAt(i0+6) == 99/*c*/ && _
text.charCodeAt(i0+7) == 116/*t*/) return TokenKind.ABSTRACT; | |
380 } else if (ch == 99/*c*/) { | |
381 if (_text.charCodeAt(i0+1) == 111/*o*/ && _text.charCodeAt(i0+2) == 11
0/*n*/ && _text.charCodeAt(i0+3) == 116/*t*/ && _text.charCodeAt(i0+4) == 105/*i
*/ && _text.charCodeAt(i0+5) == 110/*n*/ && _text.charCodeAt(i0+6) == 117/*u*/ &
& _text.charCodeAt(i0+7) == 101/*e*/) return TokenKind.CONTINUE; | |
382 } else if (ch == 111/*o*/) { | |
383 if (_text.charCodeAt(i0+1) == 112/*p*/ && _text.charCodeAt(i0+2) == 10
1/*e*/ && _text.charCodeAt(i0+3) == 114/*r*/ && _text.charCodeAt(i0+4) == 97/*a*
/ && _text.charCodeAt(i0+5) == 116/*t*/ && _text.charCodeAt(i0+6) == 111/*o*/ &&
_text.charCodeAt(i0+7) == 114/*r*/) return TokenKind.OPERATOR; | |
384 } | |
385 return TokenKind.IDENTIFIER; | |
386 case 9: | |
387 if (_text.charCodeAt(i0) == 105/*i*/ && _text.charCodeAt(i0+1) == 110/*n
*/ && _text.charCodeAt(i0+2) == 116/*t*/ && _text.charCodeAt(i0+3) == 101/*e*/ &
& _text.charCodeAt(i0+4) == 114/*r*/ && _text.charCodeAt(i0+5) == 102/*f*/ && _t
ext.charCodeAt(i0+6) == 97/*a*/ && _text.charCodeAt(i0+7) == 99/*c*/ && _text.ch
arCodeAt(i0+8) == 101/*e*/) return TokenKind.INTERFACE; | |
388 return TokenKind.IDENTIFIER; | |
389 case 10: | |
390 if (_text.charCodeAt(i0) == 105/*i*/ && _text.charCodeAt(i0+1) == 109/*m
*/ && _text.charCodeAt(i0+2) == 112/*p*/ && _text.charCodeAt(i0+3) == 108/*l*/ &
& _text.charCodeAt(i0+4) == 101/*e*/ && _text.charCodeAt(i0+5) == 109/*m*/ && _t
ext.charCodeAt(i0+6) == 101/*e*/ && _text.charCodeAt(i0+7) == 110/*n*/ && _text.
charCodeAt(i0+8) == 116/*t*/ && _text.charCodeAt(i0+9) == 115/*s*/) return Token
Kind.IMPLEMENTS; | |
391 return TokenKind.IDENTIFIER; | |
392 default: return TokenKind.IDENTIFIER; | |
393 } | |
394 } | |
395 | |
396 } | |
397 | |
398 /** Static helper methods. */ | |
399 class TokenizerHelpers { | |
400 | |
401 static bool isIdentifierStart(int c) { | |
402 return ((c >= 97/*a*/ && c <= 122/*z*/) || (c >= 65/*A*/ && c <= 90/*Z*/) ||
c == 95/*_*/); | |
403 } | |
404 | |
405 static bool isDigit(int c) { | |
406 return (c >= 48/*0*/ && c <= 57/*9*/); | |
407 } | |
408 | |
409 static bool isHexDigit(int c) { | |
410 return (isDigit(c) || (c >= 97/*a*/ && c <= 102/*f*/) || (c >= 65/*A*/ && c
<= 70/*F*/)); | |
411 } | |
412 | |
413 static bool isWhitespace(int c) { | |
414 return (c == 32/*' '*/ || c == 9/*'\t'*/ || c == 10/*'\n'*/ || c == 13/*'\r'
*/); | |
415 } | |
416 | |
417 static bool isIdentifierPart(int c) { | |
418 return (isIdentifierStart(c) || isDigit(c) || c == 36/*$*/); | |
419 } | |
420 | |
421 static bool isInterpIdentifierPart(int c) { | |
422 return (isIdentifierStart(c) || isDigit(c)); | |
423 } | |
424 | |
425 | |
426 } | |
OLD | NEW |