()
| 8681 | // 15 Program |
| 8682 | |
| 8683 | function parseSourceElement() { |
| 8684 | var token; |
| 8685 | if (lookahead.type === Token.Keyword) { |
| 8686 | switch (lookahead.value) { |
| 8687 | case 'const': |
| 8688 | case 'let': |
| 8689 | return parseConstLetDeclaration(lookahead.value); |
| 8690 | case 'function': |
| 8691 | return parseFunctionDeclaration(); |
| 8692 | case 'export': |
| 8693 | throwErrorTolerant({}, Messages.IllegalExportDeclaration); |
| 8694 | return parseExportDeclaration(); |
| 8695 | case 'import': |
| 8696 | throwErrorTolerant({}, Messages.IllegalImportDeclaration); |
| 8697 | return parseImportDeclaration(); |
| 8698 | case 'interface': |
| 8699 | if (lookahead2().type === Token.Identifier) { |
| 8700 | return parseInterface(); |
| 8701 | } |
| 8702 | return parseStatement(); |
| 8703 | default: |
| 8704 | return parseStatement(); |
| 8705 | } |
| 8706 | } |
| 8707 | |
| 8708 | if (matchContextualKeyword('type') |
| 8709 | && lookahead2().type === Token.Identifier) { |
| 8710 | return parseTypeAlias(); |
| 8711 | } |
| 8712 | |
| 8713 | if (matchContextualKeyword('interface') |
| 8714 | && lookahead2().type === Token.Identifier) { |
| 8715 | return parseInterface(); |
| 8716 | } |
| 8717 | |
| 8718 | if (matchContextualKeyword('declare')) { |
| 8719 | token = lookahead2(); |
| 8720 | if (token.type === Token.Keyword) { |
| 8721 | switch (token.value) { |
| 8722 | case 'class': |
| 8723 | return parseDeclareClass(); |
| 8724 | case 'function': |
| 8725 | return parseDeclareFunction(); |
| 8726 | case 'var': |
| 8727 | return parseDeclareVariable(); |
| 8728 | } |
| 8729 | } else if (token.type === Token.Identifier |
| 8730 | && token.value === 'module') { |
| 8731 | return parseDeclareModule(); |
| 8732 | } |
| 8733 | } |
| 8734 | |
| 8735 | if (lookahead.type !== Token.EOF) { |
| 8736 | return parseStatement(); |
| 8737 | } |
| 8738 | } |
| 8739 | |
| 8740 | function parseProgramElement() { |
no test coverage detected