()
| 601 | } |
| 602 | |
| 603 | function scanIdentifier() { |
| 604 | var start, id, type; |
| 605 | |
| 606 | start = index; |
| 607 | |
| 608 | // Backslash (U+005C) starts an escaped character. |
| 609 | id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); |
| 610 | |
| 611 | // There is no keyword or literal with only one character. |
| 612 | // Thus, it must be an identifier. |
| 613 | if (id.length === 1) { |
| 614 | type = Token.Identifier; |
| 615 | } else if (isKeyword(id)) { |
| 616 | type = Token.Keyword; |
| 617 | } else if (id === 'null') { |
| 618 | type = Token.NullLiteral; |
| 619 | } else if (id === 'true' || id === 'false') { |
| 620 | type = Token.BooleanLiteral; |
| 621 | } else { |
| 622 | type = Token.Identifier; |
| 623 | } |
| 624 | |
| 625 | return { |
| 626 | type: type, |
| 627 | value: id, |
| 628 | lineNumber: lineNumber, |
| 629 | lineStart: lineStart, |
| 630 | start: start, |
| 631 | end: index |
| 632 | }; |
| 633 | } |
| 634 | |
| 635 | |
| 636 | // 7.7 Punctuators |
no test coverage detected