MCPcopy Create free account
hub / github.com/microsoft/typescript-go / scanASCIIWhile

Method scanASCIIWhile

internal/scanner/scanner.go:456–467  ·  view source on GitHub ↗

scanASCIIWhile advances s.pos over the longest run of ASCII bytes for which pred returns true. It stops at end-of-text, the first non-ASCII byte, or the first byte where pred is false.

(pred func(byte) bool)

Source from the content-addressed store, hash-verified

454// pred returns true. It stops at end-of-text, the first non-ASCII byte, or the
455// first byte where pred is false.
456func (s *Scanner) scanASCIIWhile(pred func(byte) bool) {
457 text := s.text[s.pos:s.end]
458 i := 0
459 for i < len(text) {
460 b := text[i]
461 if b >= utf8.RuneSelf || !pred(b) {
462 break
463 }
464 i++
465 }
466 s.pos += i
467}
468
469func (s *Scanner) Scan() ast.Kind {
470 s.fullStartPos = s.pos

Callers 4

ScanMethod · 0.95
scanIdentifierMethod · 0.95
scanNumberFragmentMethod · 0.95

Calls 1

lenFunction · 0.85

Tested by

no test coverage detected