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

Function fxModule

xs/sources/xsSyntaxical.c:703–740  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

701}
702
703void fxModule(txParser* parser)
704{
705 txInteger aCount = parser->nodeCount;
706 txInteger aLine = parser->states[0].line;
707 while ((parser->states[0].token != XS_TOKEN_EOF)) {
708 if (parser->states[0].token == XS_TOKEN_EXPORT)
709 fxExportDeclaration(parser);
710 else if (parser->states[0].token == XS_TOKEN_IMPORT) {
711 fxLookAheadOnce(parser);
712 if ((parser->states[1].token == XS_TOKEN_DOT) || (parser->states[1].token == XS_TOKEN_LEFT_PARENTHESIS))
713 fxStatement(parser, 1);
714 else
715 fxImportDeclaration(parser);
716 }
717 else if (parser->states[0].token == XS_TOKEN_RETURN) {
718 fxReportParserError(parser, parser->states[0].line, "invalid return");
719 fxGetNextToken(parser);
720 }
721 else if (parser->states[0].token == XS_TOKEN_YIELD) {
722 fxReportParserError(parser, parser->states[0].line, "invalid yield");
723 fxGetNextToken(parser);
724 }
725 else {
726 fxStatement(parser, 1);
727 }
728 }
729 aCount = parser->nodeCount - aCount;
730 if (aCount > 1) {
731 fxPushNodeList(parser, aCount);
732 fxPushNodeStruct(parser, 1, XS_TOKEN_STATEMENTS, aLine);
733 }
734 else if (aCount == 0) {
735 fxPushNodeStruct(parser, 0, XS_TOKEN_UNDEFINED, aLine);
736 fxPushNodeStruct(parser, 1, XS_TOKEN_STATEMENT, aLine);
737 }
738 fxPushNodeStruct(parser, 1, XS_TOKEN_MODULE, aLine);
739 parser->root->flags = parser->flags & (mxStrictFlag | mxAwaitingFlag);
740}
741
742void fxExportDeclaration(txParser* parser)
743{

Callers 1

fxParserTreeFunction · 0.85

Calls 8

fxExportDeclarationFunction · 0.85
fxLookAheadOnceFunction · 0.85
fxStatementFunction · 0.85
fxImportDeclarationFunction · 0.85
fxReportParserErrorFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushNodeListFunction · 0.85
fxPushNodeStructFunction · 0.85

Tested by

no test coverage detected