MCPcopy Create free account
hub / github.com/microsoft/SandDance / parsePrimaryExpression

Function parsePrimaryExpression

docs/app/js/sanddance-app.js:144174–144199  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

144172 "if": 1
144173};
144174function parsePrimaryExpression() {
144175 var type, token, expr;
144176 if (match("(")) return parseGroupExpression();
144177 if (match("[")) return parseArrayInitialiser();
144178 if (match("{")) return parseObjectInitialiser();
144179 type = lookahead.type;
144180 index = lookahead.start;
144181 if (type === TokenIdentifier || legalKeywords[lookahead.value]) expr = finishIdentifier(lex().value);
144182 else if (type === TokenStringLiteral || type === TokenNumericLiteral) {
144183 if (lookahead.octal) throwError(lookahead, MessageStrictOctalLiteral);
144184 expr = finishLiteral(lex());
144185 } else if (type === TokenKeyword) throw new Error(DISABLED);
144186 else if (type === TokenBooleanLiteral) {
144187 token = lex();
144188 token.value = token.value === "true";
144189 expr = finishLiteral(token);
144190 } else if (type === TokenNullLiteral) {
144191 token = lex();
144192 token.value = null;
144193 expr = finishLiteral(token);
144194 } else if (match("/") || match("/=")) {
144195 expr = finishLiteral(scanRegExp());
144196 peek();
144197 } else throwUnexpected(lex());
144198 return expr;
144199} // 11.2 Left-Hand-Side Expressions
144200function parseArguments() {
144201 const args = [];
144202 expect("(");

Callers 1

Calls 11

matchFunction · 0.70
parseGroupExpressionFunction · 0.70
parseArrayInitialiserFunction · 0.70
parseObjectInitialiserFunction · 0.70
finishIdentifierFunction · 0.70
lexFunction · 0.70
throwErrorFunction · 0.70
finishLiteralFunction · 0.70
scanRegExpFunction · 0.70
peekFunction · 0.70
throwUnexpectedFunction · 0.70

Tested by

no test coverage detected