()
| 636 | } |
| 637 | |
| 638 | function scanIdentifier() { |
| 639 | var start, id, type; |
| 640 | |
| 641 | start = index; |
| 642 | |
| 643 | // Backslash (U+005C) starts an escaped character. |
| 644 | id = (source.charCodeAt(index) === 0x5C) ? getEscapedIdentifier() : getIdentifier(); |
| 645 | |
| 646 | // There is no keyword or literal with only one character. |
| 647 | // Thus, it must be an identifier. |
| 648 | if (id.length === 1) { |
| 649 | type = Token.Identifier; |
| 650 | } else if (isKeyword(id)) { |
| 651 | type = Token.Keyword; |
| 652 | } else if (id === 'null') { |
| 653 | type = Token.NullLiteral; |
| 654 | } else if (id === 'true' || id === 'false') { |
| 655 | type = Token.BooleanLiteral; |
| 656 | } else { |
| 657 | type = Token.Identifier; |
| 658 | } |
| 659 | |
| 660 | return { |
| 661 | type: type, |
| 662 | value: id, |
| 663 | lineNumber: lineNumber, |
| 664 | lineStart: lineStart, |
| 665 | start: start, |
| 666 | end: index |
| 667 | }; |
| 668 | } |
| 669 | |
| 670 | |
| 671 | // 7.7 Punctuators |
no test coverage detected