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

Function fxStatement

xs/sources/xsSyntaxical.c:1249–1438  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1247}
1248
1249void fxStatement(txParser* parser, txInteger blockIt)
1250{
1251 txInteger line = parser->states[0].line;
1252 txSymbol* symbol = C_NULL;
1253 txUnsigned flag = 0;
1254 switch (parser->states[0].token) {
1255// case XS_TOKEN_COMMA:
1256 case XS_TOKEN_SEMICOLON:
1257 fxGetNextToken(parser);
1258 if (!blockIt) {
1259 fxPushNodeStruct(parser, 0, XS_TOKEN_UNDEFINED, line);
1260 fxPushNodeStruct(parser, 1, XS_TOKEN_STATEMENT, line);
1261 }
1262 break;
1263 case XS_TOKEN_BREAK:
1264 fxBreakStatement(parser);
1265 fxSemicolon(parser);
1266 break;
1267 case XS_TOKEN_CLASS:
1268 if (!blockIt)
1269 fxReportParserError(parser, parser->states[0].line, "no block");
1270 fxClassExpression(parser, line, &symbol);
1271 if (symbol) {
1272 fxPushSymbol(parser, symbol);
1273 fxPushNodeStruct(parser, 1, XS_TOKEN_LET, line);
1274 fxSwapNodes(parser);
1275 fxPushNodeStruct(parser, 2, XS_TOKEN_BINDING, line);
1276 }
1277 else
1278 fxReportParserError(parser, parser->states[0].line, "missing identifier");
1279 break;
1280 case XS_TOKEN_CONST:
1281 if (!blockIt)
1282 fxReportParserError(parser, parser->states[0].line, "no block");
1283 fxVariableStatement(parser, XS_TOKEN_CONST, 0);
1284 fxSemicolon(parser);
1285 break;
1286 case XS_TOKEN_CONTINUE:
1287 fxContinueStatement(parser);
1288 fxSemicolon(parser);
1289 break;
1290 case XS_TOKEN_DEBUGGER:
1291 fxDebuggerStatement(parser);
1292 fxSemicolon(parser);
1293 break;
1294 case XS_TOKEN_DO:
1295 fxDoStatement(parser);
1296 break;
1297 case XS_TOKEN_FOR:
1298 fxForStatement(parser);
1299 break;
1300 case XS_TOKEN_FUNCTION:
1301 //if ((parser->flags & mxStrictFlag) && !blockIt) BROWSER
1302 again:
1303 if (!blockIt)
1304 fxReportParserError(parser, parser->states[0].line, "no block (strict code)");
1305 fxMatchToken(parser, XS_TOKEN_FUNCTION);
1306 if (parser->states[0].token == XS_TOKEN_MULTIPLY) {

Callers 10

fxModuleFunction · 0.85
fxProgramFunction · 0.85
fxBodyFunction · 0.85
fxStatementsFunction · 0.85
fxDoStatementFunction · 0.85
xsSyntaxical.cFile · 0.85
fxIfStatementFunction · 0.85
fxSwitchStatementFunction · 0.85
fxWhileStatementFunction · 0.85
fxWithStatementFunction · 0.85

Calls 15

fxGetNextTokenFunction · 0.85
fxPushNodeStructFunction · 0.85
fxBreakStatementFunction · 0.85
fxSemicolonFunction · 0.85
fxReportParserErrorFunction · 0.85
fxClassExpressionFunction · 0.85
fxPushSymbolFunction · 0.85
fxSwapNodesFunction · 0.85
fxVariableStatementFunction · 0.85
fxContinueStatementFunction · 0.85
fxDebuggerStatementFunction · 0.85
fxDoStatementFunction · 0.85

Tested by

no test coverage detected