MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / scan

Method scan

Extension/src/Utility/Text/scanner.ts:361–589  ·  view source on GitHub ↗

* Identifies and returns the next token type in the document * * @returns the state of the scanner will have the properties `token`, `value`, `offset` pointing to the current token at the end of this call. * * @notes before this call, `#offset` is pointing to the next charact

()

Source from the content-addressed store, hash-verified

359 *
360 */
361 scan(): Kind {
362
363 // this token starts at
364 this.offset = this.#offset;
365 this.stringValue = undefined;
366
367 if (!(this.eof || isNaN(this.#ch))) {
368 switch (this.#ch) {
369 case CharacterCodes.carriageReturn:
370 return this.newLine(this.#chNext === CharacterCodes.lineFeed ? 2 : 1);
371
372 case CharacterCodes.lineFeed:
373 return this.newLine();
374
375 case CharacterCodes.tab:
376 case CharacterCodes.verticalTab:
377 case CharacterCodes.formFeed:
378 case CharacterCodes.space:
379 case CharacterCodes.nonBreakingSpace:
380 case CharacterCodes.ogham:
381 case CharacterCodes.enQuad:
382 case CharacterCodes.emQuad:
383 case CharacterCodes.enSpace:
384 case CharacterCodes.emSpace:
385 case CharacterCodes.threePerEmSpace:
386 case CharacterCodes.fourPerEmSpace:
387 case CharacterCodes.sixPerEmSpace:
388 case CharacterCodes.figureSpace:
389 case CharacterCodes.punctuationSpace:
390 case CharacterCodes.thinSpace:
391 case CharacterCodes.hairSpace:
392 case CharacterCodes.zeroWidthSpace:
393 case CharacterCodes.narrowNoBreakSpace:
394 case CharacterCodes.mathematicalSpace:
395 case CharacterCodes.ideographicSpace:
396 case CharacterCodes.byteOrderMark:
397 return this.scanWhitespace();
398
399 case CharacterCodes.$:
400 return isIdentifierPart(this.#chNext) ? this.scanVariable() : this.next(Kind.Dollar);
401
402 case CharacterCodes.openParen:
403 return this.next(Kind.OpenParen);
404
405 case CharacterCodes.closeParen:
406 return this.next(Kind.CloseParen);
407
408 case CharacterCodes.comma:
409 return this.next(Kind.Comma);
410
411 case CharacterCodes.colon:
412 return this.next(Kind.Colon);
413
414 case CharacterCodes.semicolon:
415 return this.next(Kind.Semicolon);
416
417 case CharacterCodes.openBracket:
418 return this.next(Kind.OpenBracket);

Callers 5

startMethod · 0.95
takeMethod · 0.95
takeWhitespaceMethod · 0.95
processFactoryFunction · 0.45

Calls 15

newLineMethod · 0.95
scanWhitespaceMethod · 0.95
scanVariableMethod · 0.95
nextMethod · 0.95
scanNumberMethod · 0.95
scanSingleLineCommentMethod · 0.95
scanMultiLineCommentMethod · 0.95
scanHashCommentMethod · 0.95
scanHexNumberMethod · 0.95
scanBinaryNumberMethod · 0.95
isConflictMarkerMethod · 0.95

Tested by

no test coverage detected