MCPcopy Create free account
hub / github.com/openai/plugins / expectToken

Method expectToken

plugins/shopify/skills/shopify-functions/scripts/validate.mjs:3094–3105  ·  view source on GitHub ↗

* If the next token is of the given kind, return that token after advancing the lexer. * Otherwise, do not change the parser state and throw an error.

(kind)

Source from the content-addressed store, hash-verified

3092 * Otherwise, do not change the parser state and throw an error.
3093 */
3094 expectToken(kind) {
3095 const token = this._lexer.token;
3096 if (token.kind === kind) {
3097 this.advanceLexer();
3098 return token;
3099 }
3100 throw (0, _syntaxError.syntaxError)(
3101 this._lexer.source,
3102 token.start,
3103 `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`
3104 );
3105 }
3106 /**
3107 * If the next token is of the given kind, return "true" after advancing the lexer.
3108 * Otherwise, do not change the parser state and return "false".

Callers 15

parseValueFunction · 0.45
parseConstValueFunction · 0.45
parseTypeFunction · 0.45
parseSchemaCoordinateFunction · 0.45
parseNameMethod · 0.45
parseOperationTypeMethod · 0.45
parseVariableMethod · 0.45
parseArgumentMethod · 0.45
parseFragmentMethod · 0.45
parseValueLiteralMethod · 0.45
parseObjectFieldMethod · 0.45

Calls 3

getTokenKindDescFunction · 0.70
getTokenDescFunction · 0.70
advanceLexerMethod · 0.45

Tested by

no test coverage detected