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

Method nextToken

src/parser.ts:324–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

322 }
323
324 nextToken(): RawToken {
325 const token = this.lookahead;
326
327 this.lastMarker.index = this.scanner.index;
328 this.lastMarker.line = this.scanner.lineNumber;
329 this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
330
331 this.collectComments();
332
333 if (this.scanner.index !== this.startMarker.index) {
334 this.startMarker.index = this.scanner.index;
335 this.startMarker.line = this.scanner.lineNumber;
336 this.startMarker.column = this.scanner.index - this.scanner.lineStart;
337 }
338
339 const next = this.scanner.lex();
340 this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
341
342 if (next && this.context.strict && next.type === Token.Identifier) {
343 if (this.scanner.isStrictModeReservedWord(next.value as string)) {
344 next.type = Token.Keyword;
345 }
346 }
347 this.lookahead = next;
348
349 if (this.config.tokens && next.type !== Token.EOF) {
350 this.tokens.push(this.convertToken(next));
351 }
352
353 return token;
354 }
355
356 nextRegexToken(): RawToken {
357 this.collectComments();

Callers 15

constructorMethod · 0.95
nextRegexTokenMethod · 0.95
expectMethod · 0.95
expectCommaSeparatorMethod · 0.95
expectKeywordMethod · 0.95
consumeSemicolonMethod · 0.95
parseArrayInitializerMethod · 0.95
parseObjectPropertyMethod · 0.95
parseTemplateHeadMethod · 0.95
parseTemplateElementMethod · 0.95

Calls 5

collectCommentsMethod · 0.95
convertTokenMethod · 0.95
lexMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected