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

Function fxUnaryExpression

xs/sources/xsSyntaxical.c:2066–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2064}
2065
2066void fxUnaryExpression(txParser* parser)
2067{
2068 if (gxTokenFlags[parser->states[0].token] & XS_TOKEN_UNARY_EXPRESSION) {
2069 txToken aToken = parser->states[0].token;
2070 txInteger aLine = parser->states[0].line;
2071 fxCheckParserStack(parser, aLine);
2072 fxMatchToken(parser, aToken);
2073 fxUnaryExpression(parser);
2074 fxCheckArrowFunction(parser, 1);
2075 if (aToken == XS_TOKEN_ADD)
2076 fxPushNodeStruct(parser, 1, XS_TOKEN_PLUS, aLine);
2077 else if (aToken == XS_TOKEN_SUBTRACT)
2078 fxPushNodeStruct(parser, 1, XS_TOKEN_MINUS, aLine);
2079 else if (aToken == XS_TOKEN_DELETE) {
2080 //if ((parser->flags & mxStrictFlag) && (parser->root->description->token == XS_TOKEN_ACCESS)) {
2081 // fxReportParserError(parser, parser->states[0].line, "no reference (strict mode)");
2082 //}
2083 if (!fxCheckReference(parser, aToken))
2084 fxReportParserError(parser, parser->states[0].line, "no reference");
2085 fxPushNodeStruct(parser, 1, aToken, aLine);
2086 }
2087 else if (aToken == XS_TOKEN_AWAIT) {
2088 if ((parser->flags & mxGeneratorFlag) && !(parser->flags & mxYieldFlag))
2089 fxReportParserError(parser, parser->states[0].line, "invalid await");
2090 else
2091 parser->flags |= mxAwaitingFlag;
2092 fxPushNodeStruct(parser, 1, aToken, aLine);
2093 }
2094 else
2095 fxPushNodeStruct(parser, 1, aToken, aLine);
2096
2097 }
2098 else
2099 fxPrefixExpression(parser);
2100}
2101
2102void fxPrefixExpression(txParser* parser)
2103{

Callers 1

Calls 7

fxCheckParserStackFunction · 0.85
fxMatchTokenFunction · 0.85
fxCheckArrowFunctionFunction · 0.85
fxPushNodeStructFunction · 0.85
fxCheckReferenceFunction · 0.85
fxReportParserErrorFunction · 0.85
fxPrefixExpressionFunction · 0.85

Tested by

no test coverage detected