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

Function fxPushNodeStruct

xs/sources/xsSyntaxical.c:594–623  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

592}
593
594void fxPushNodeStruct(txParser* parser, txInteger count, txToken token, txInteger line)
595{
596 const txNodeDescription* description = &gxTokenDescriptions[token];
597 txNode* node;
598 if ((count > parser->nodeCount) || ((sizeof(txNode) + (count * sizeof(txNode*))) > (size_t)(description->size))) {
599 fxReportParserError(parser, parser->states[0].line, "invalid %s", gxTokenNames[token]);
600 }
601 node = fxNewParserChunkClear(parser, description->size);
602 node->description = description;
603 node->flags |= parser->flags & (mxStrictFlag | mxGeneratorFlag | mxAsyncFlag);
604 node->path = parser->path;
605 node->line = line;
606 parser->nodeCount -= count;
607 if (count) {
608 txNode** dst = (txNode**)&node[1];
609 txNode* src = parser->root;
610 while (count) {
611 txNode* next = src->next;
612 src->next = NULL;
613 count--;
614 if (src->description)
615 dst[count] = src;
616 else if (src->path)
617 dst[count] = (txNode*)(src->path);
618 src = next;
619 }
620 parser->root = src;
621 }
622 fxPushNode(parser, node);
623}
624
625void fxPushNodeList(txParser* parser, txInteger count)
626{

Callers 15

fxModuleFunction · 0.85
fxExportDeclarationFunction · 0.85
fxExportBindingFunction · 0.85
fxImportDeclarationFunction · 0.85
fxSpecifiersFunction · 0.85
fxProgramFunction · 0.85
fxBodyFunction · 0.85
fxBlockFunction · 0.85
fxStatementsFunction · 0.85
fxStatementFunction · 0.85
fxBreakStatementFunction · 0.85
fxContinueStatementFunction · 0.85

Calls 3

fxReportParserErrorFunction · 0.85
fxNewParserChunkClearFunction · 0.85
fxPushNodeFunction · 0.85

Tested by

no test coverage detected