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

Function throwUnexpected

docs/app/js/sanddance-app.js:144086–144094  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

144084 throw error;
144085} // Throw an exception because of the token.
144086function throwUnexpected(token) {
144087 if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS);
144088 if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber);
144089 if (token.type === TokenStringLiteral) throwError(token, MessageUnexpectedString);
144090 if (token.type === TokenIdentifier) throwError(token, MessageUnexpectedIdentifier);
144091 if (token.type === TokenKeyword) throwError(token, MessageUnexpectedReserved);
144092 // BooleanLiteral, NullLiteral, or Punctuator.
144093 throwError(token, MessageUnexpectedToken, token.value);
144094} // Expect the next token to match the specified punctuator.
144095// If not, an exception will be thrown.
144096function expect(value) {
144097 const token = lex();

Callers 4

expectFunction · 0.70
parseObjectPropertyFunction · 0.70
parsePrimaryExpressionFunction · 0.70
parseNonComputedPropertyFunction · 0.70

Calls 1

throwErrorFunction · 0.70

Tested by

no test coverage detected