MCPcopy
hub / github.com/jquery/esprima / expectCommaSeparator

Method expectCommaSeparator

src/parser.ts:449–463  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

447 // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
448
449 expectCommaSeparator() {
450 if (this.config.tolerant) {
451 const token = this.lookahead;
452 if (token.type === Token.Punctuator && token.value === ',') {
453 this.nextToken();
454 } else if (token.type === Token.Punctuator && token.value === ';') {
455 this.nextToken();
456 this.tolerateUnexpectedToken(token);
457 } else {
458 this.tolerateUnexpectedToken(token, Messages.UnexpectedToken);
459 }
460 } else {
461 this.expect(',');
462 }
463 }
464
465 // Expect the next token to match the specified keyword.
466 // If not, an exception will be thrown.

Callers 3

parseArgumentsMethod · 0.95
parseAsyncArgumentsMethod · 0.95

Calls 3

nextTokenMethod · 0.95
expectMethod · 0.95

Tested by

no test coverage detected