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

Function fxArrayBinding

xs/sources/xsSyntaxical.c:3603–3637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3601}
3602
3603void fxArrayBinding(txParser* parser, txToken theToken)
3604{
3605 txInteger aCount = 0;
3606 txInteger aLine = parser->states[0].line;
3607 int elision = 1;
3608 fxCheckParserStack(parser, aLine);
3609 fxMatchToken(parser, XS_TOKEN_LEFT_BRACKET);
3610 while ((parser->states[0].token == XS_TOKEN_COMMA) || (gxTokenFlags[parser->states[0].token] & XS_TOKEN_BEGIN_BINDING)) {
3611 txInteger anItemLine = parser->states[0].line;
3612 if (parser->states[0].token == XS_TOKEN_COMMA) {
3613 fxGetNextToken(parser);
3614 if (elision) {
3615 fxPushNodeStruct(parser, 0, XS_TOKEN_SKIP_BINDING, anItemLine);
3616 aCount++;
3617 }
3618 else
3619 elision = 1;
3620 }
3621 else {
3622 if (!elision)
3623 fxReportParserError(parser, parser->states[0].line, "missing ,");
3624 if (parser->states[0].token == XS_TOKEN_SPREAD) {
3625 fxRestBinding(parser, theToken, 0);
3626 aCount++;
3627 break;
3628 }
3629 fxBinding(parser, theToken, 1);
3630 aCount++;
3631 elision = 0;
3632 }
3633 }
3634 fxMatchToken(parser, XS_TOKEN_RIGHT_BRACKET);
3635 fxPushNodeList(parser, aCount);
3636 fxPushNodeStruct(parser, 1, XS_TOKEN_ARRAY_BINDING, aLine);
3637}
3638
3639txNode* fxArrayBindingFromExpression(txParser* parser, txNode* theNode, txToken theToken)
3640{

Callers 1

fxBindingFunction · 0.85

Calls 8

fxCheckParserStackFunction · 0.85
fxMatchTokenFunction · 0.85
fxGetNextTokenFunction · 0.85
fxPushNodeStructFunction · 0.85
fxReportParserErrorFunction · 0.85
fxRestBindingFunction · 0.85
fxBindingFunction · 0.85
fxPushNodeListFunction · 0.85

Tested by

no test coverage detected