MCPcopy
hub / github.com/BloombergGraphics/whatiscode / expectCommaSeparator

Function expectCommaSeparator

scripts/libs/esprima.js:2142–2158  ·  view source on GitHub ↗

* @name expectCommaSeparator * @description Quietly expect a comma when in tolerant mode, otherwise delegates * to expect(value) * @since 2.0

()

Source from the content-addressed store, hash-verified

2140 * @since 2.0
2141 */
2142 function expectCommaSeparator() {
2143 var token;
2144
2145 if (extra.errors) {
2146 token = lookahead;
2147 if (token.type === Token.Punctuator && token.value === ',') {
2148 lex();
2149 } else if (token.type === Token.Punctuator && token.value === ';') {
2150 lex();
2151 tolerateUnexpectedToken(token);
2152 } else {
2153 tolerateUnexpectedToken(token, Messages.UnexpectedToken);
2154 }
2155 } else {
2156 expect(',');
2157 }
2158 }
2159
2160 // Expect the next token to match the specified keyword.
2161 // If not, an exception will be thrown.

Callers 2

parseObjectInitialiserFunction · 0.85
parseArgumentsFunction · 0.85

Calls 3

lexFunction · 0.85
tolerateUnexpectedTokenFunction · 0.85
expectFunction · 0.85

Tested by

no test coverage detected