MCPcopy
hub / github.com/go-git/go-git / scan

Method scan

internal/revision/parser.go:121–132  ·  view source on GitHub ↗

scan returns the next token from the underlying scanner or the last scanned token if an unscan was requested

()

Source from the content-addressed store, hash-verified

119// scan returns the next token from the underlying scanner
120// or the last scanned token if an unscan was requested
121func (p *Parser) scan() (token, string, error) {
122 if p.unreadLastChar {
123 p.unreadLastChar = false
124 return p.currentParsedChar.tok, p.currentParsedChar.lit, nil
125 }
126
127 tok, lit, err := p.s.scan()
128
129 p.currentParsedChar.tok, p.currentParsedChar.lit = tok, lit
130
131 return tok, lit, err
132}
133
134// unscan pushes the previously read token back onto the buffer.
135func (p *Parser) unscan() { p.unreadLastChar = true }

Callers 15

TestScanMethod · 0.95
TestUnscanMethod · 0.95
ParseMethod · 0.95
parseAtMethod · 0.95
parseTildeMethod · 0.95
parseCaretMethod · 0.95
parseCaretBracesMethod · 0.95
parseColonMethod · 0.95
parseColonSlashMethod · 0.95
parseColonDefaultMethod · 0.95
parseRefMethod · 0.95
TestReadColonMethod · 0.45

Calls

no outgoing calls

Tested by 15

TestScanMethod · 0.76
TestUnscanMethod · 0.76
TestReadColonMethod · 0.36
TestReadTildeMethod · 0.36
TestReadCaretMethod · 0.36
TestReadDotMethod · 0.36
TestReadSlashMethod · 0.36
TestReadEOFMethod · 0.36
TestReadNumberMethod · 0.36
TestReadSpaceMethod · 0.36
TestReadControlMethod · 0.36
TestReadOpenBraceMethod · 0.36