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

Function parsePrimaryExpression

docs/tests/v2/es6/js/sanddance.js:129035–129079  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

129033};
129034
129035function parsePrimaryExpression() {
129036 var type, token, expr;
129037
129038 if (match('(')) {
129039 return parseGroupExpression();
129040 }
129041
129042 if (match('[')) {
129043 return parseArrayInitialiser();
129044 }
129045
129046 if (match('{')) {
129047 return parseObjectInitialiser();
129048 }
129049
129050 type = lookahead.type;
129051 index = lookahead.start;
129052
129053 if (type === TokenIdentifier || legalKeywords[lookahead.value]) {
129054 expr = finishIdentifier(lex().value);
129055 } else if (type === TokenStringLiteral || type === TokenNumericLiteral) {
129056 if (lookahead.octal) {
129057 throwError(lookahead, MessageStrictOctalLiteral);
129058 }
129059
129060 expr = finishLiteral(lex());
129061 } else if (type === TokenKeyword) {
129062 throw new Error(DISABLED);
129063 } else if (type === TokenBooleanLiteral) {
129064 token = lex();
129065 token.value = token.value === 'true';
129066 expr = finishLiteral(token);
129067 } else if (type === TokenNullLiteral) {
129068 token = lex();
129069 token.value = null;
129070 expr = finishLiteral(token);
129071 } else if (match('/') || match('/=')) {
129072 expr = finishLiteral(scanRegExp());
129073 peek();
129074 } else {
129075 throwUnexpected(lex());
129076 }
129077
129078 return expr;
129079} // 11.2 Left-Hand-Side Expressions
129080
129081
129082function parseArguments() {

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