()
| 346 | } |
| 347 | |
| 348 | nextToken() { |
| 349 | /* |
| 350 | * Each index in CharScanners (0-65535) contains a scan function for the charCode with that number. |
| 351 | * The array is "zero-filled" with a throwing function and has functions for all ASCII chars (except ~@#`\) |
| 352 | * and IdentifierParts from the Latin1 script (1314 in total). |
| 353 | * Additional characters can be added via addIdentifierStart / addIdentifierPart. |
| 354 | */ |
| 355 | while (this.idx < this.len) { |
| 356 | if (this.ch <= /*whitespace*/0x20) { |
| 357 | this.next(); |
| 358 | continue; |
| 359 | } |
| 360 | this.start = this.idx; |
| 361 | if (this.ch === /*$*/0x24 || (this.ch >= /*a*/0x61 && this.ch <= /*z*/0x7A)) { |
| 362 | this.tkn = this.scanIdentifier(); |
| 363 | return; |
| 364 | } |
| 365 | /* |
| 366 | * Note: the lookup below could also handle the characters which are handled above. It's just a performance tweak (direct |
| 367 | * comparisons are faster than array indexers) |
| 368 | */ |
| 369 | if ((this.tkn = CharScanners[this.ch](this)) !== null) { // a null token means the character must be skipped |
| 370 | return; |
| 371 | } |
| 372 | } |
| 373 | this.tkn = T$EOF; |
| 374 | } |
| 375 | |
| 376 | /** Advance to the next char */ |
| 377 | next() { |
no test coverage detected