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

Method expectKeyword

plugins/shopify/skills/shopify-partner/scripts/validate.mjs:3122–3133  ·  view source on GitHub ↗

* If the next token is a given keyword, advance the lexer. * Otherwise, do not change the parser state and throw an error.

(value)

Source from the content-addressed store, hash-verified

3120 * Otherwise, do not change the parser state and throw an error.
3121 */
3122 expectKeyword(value) {
3123 const token = this._lexer.token;
3124 if (token.kind === _tokenKind.TokenKind.NAME && token.value === value) {
3125 this.advanceLexer();
3126 } else {
3127 throw (0, _syntaxError.syntaxError)(
3128 this._lexer.source,
3129 token.start,
3130 `Expected "${value}", found ${getTokenDesc(token)}.`
3131 );
3132 }
3133 }
3134 /**
3135 * If the next token is a given keyword, return "true" after advancing the lexer.
3136 * Otherwise, do not change the parser state and return "false".

Calls 2

getTokenDescFunction · 0.70
advanceLexerMethod · 0.45

Tested by

no test coverage detected