MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxExportDeclaration

Function fxExportDeclaration

xs/sources/xsSyntaxical.c:742–954  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

740}
741
742void fxExportDeclaration(txParser* parser)
743{
744 txSymbol* symbol = C_NULL;
745 txInteger count;
746 txInteger line = parser->states[0].line;
747 txUnsigned flag = 0;
748 txToken aToken;
749 fxMatchToken(parser, XS_TOKEN_EXPORT);
750 switch (parser->states[0].token) {
751 case XS_TOKEN_MULTIPLY:
752 fxPushNULL(parser);
753 fxGetNextToken(parser);
754 if (fxIsKeyword(parser, parser->asSymbol)) {
755 fxGetNextToken(parser);
756 if (gxTokenFlags[parser->states[0].token] & XS_TOKEN_IDENTIFIER_NAME) {
757 fxPushSymbol(parser, parser->states[0].symbol);
758 fxGetNextToken(parser);
759 }
760 else {
761 fxPushNULL(parser);
762 fxReportParserError(parser, parser->states[0].line, "missing identifier");
763 }
764 }
765 else {
766 fxPushNULL(parser);
767 }
768 if (fxIsKeyword(parser, parser->fromSymbol)) {
769 fxGetNextToken(parser);
770 if (parser->states[0].token == XS_TOKEN_STRING) {
771 fxPushNodeStruct(parser, 2, XS_TOKEN_SPECIFIER, line);
772 fxPushNodeList(parser, 1);
773 fxPushStringNode(parser, parser->states[0].stringLength, parser->states[0].string, line);
774 fxGetNextToken(parser);
775 if (!parser->states[0].crlf && (parser->states[0].token == XS_TOKEN_WITH)) {
776 fxGetNextToken(parser);
777 fxWithAttributes(parser);
778 }
779 else
780 fxPushNULL(parser);
781 fxPushNodeStruct(parser, 3, XS_TOKEN_EXPORT, line);
782 fxSemicolon(parser);
783 }
784 else
785 fxReportParserError(parser, parser->states[0].line, "missing module");
786 }
787 else
788 fxReportParserError(parser, parser->states[0].line, "missing from");
789 break;
790 case XS_TOKEN_DEFAULT:
791 fxMatchToken(parser, XS_TOKEN_DEFAULT);
792 if (parser->flags & mxDefaultFlag)
793 fxReportParserError(parser, parser->states[0].line, "invalid default");
794 parser->flags |= mxDefaultFlag;
795 if (parser->states[0].token == XS_TOKEN_CLASS) {
796 fxClassExpression(parser, line, &symbol);
797 if (symbol)
798 fxPushSymbol(parser, symbol);
799 else

Callers 1

fxModuleFunction · 0.85

Calls 15

fxMatchTokenFunction · 0.85
fxPushNULLFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushSymbolFunction · 0.85
fxReportParserErrorFunction · 0.85
fxPushNodeStructFunction · 0.85
fxPushNodeListFunction · 0.85
fxPushStringNodeFunction · 0.85
fxWithAttributesFunction · 0.85
fxSemicolonFunction · 0.85
fxClassExpressionFunction · 0.85
fxSwapNodesFunction · 0.85

Tested by

no test coverage detected