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

Function fxParseScript

xs/sources/xsPlatforms.c:323–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321#if mxUseDefaultParseScript
322
323txScript* fxParseScript(txMachine* the, void* stream, txGetter getter, txUnsigned flags)
324{
325 txParser _parser;
326 txParser* parser = &_parser;
327 txParserJump jump;
328 txScript* script = NULL;
329 fxInitializeParser(parser, the, the->parserBufferSize, the->parserTableModulo);
330 parser->firstJump = &jump;
331 if (c_setjmp(jump.jmp_buf) == 0) {
332 fxParserTree(parser, stream, getter, flags, NULL);
333#ifdef mxDebug
334 parser->flags |= mxDebugFlag;
335 if (!the->debugEval) {
336 if (!parser->source) {
337 char tag[16];
338 parser->flags |= mxDebugFlag;
339 fxGenerateTag(the, tag, sizeof(tag), C_NULL);
340 parser->source = fxNewParserSymbol(parser, tag);
341 }
342 if (fxIsConnected(the)) {
343 if (getter == fxStringGetter)
344 fxFileEvalString(the, ((txStringStream*)stream)->slot->value.string, parser->source->string);
345 else if (getter == fxStringCGetter)
346 fxFileEvalString(the, ((txStringCStream*)stream)->buffer, parser->source->string);
347 }
348 }
349#endif
350 fxParserHoist(parser);
351 fxParserBind(parser);
352 script = fxParserCode(parser);
353 }
354#ifdef mxInstrument
355 if (the->peakParserSize < parser->total)
356 the->peakParserSize = parser->total;
357#endif
358 fxTerminateParser(parser);
359 return script;
360}
361
362#endif /* mxUseDefaultParseScript */
363

Callers 8

fx_ModuleSourceFunction · 0.70
fxRunEvalFunction · 0.70
fx_GeneratorFunctionFunction · 0.70
fx_FunctionFunction · 0.70
fx_AsyncFunctionFunction · 0.70
fx_evalFunction · 0.70

Calls 10

fxInitializeParserFunction · 0.85
fxParserTreeFunction · 0.85
fxNewParserSymbolFunction · 0.85
fxFileEvalStringFunction · 0.85
fxParserHoistFunction · 0.85
fxParserBindFunction · 0.85
fxParserCodeFunction · 0.85
fxTerminateParserFunction · 0.85
fxGenerateTagFunction · 0.70
fxIsConnectedFunction · 0.70

Tested by

no test coverage detected