MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / scan

Method scan

pkg/util/jsonpath/parser/parse.go:36–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34}
35
36func (p *Parser) scan() (query string, tokens []jsonpathSymType, done bool) {
37 var lval jsonpathSymType
38
39 p.scanner.Scan(&lval)
40 if lval.id == 0 {
41 return "", nil, true
42 }
43
44 startPos := lval.pos
45
46 lval.pos = 0
47 tokens = append(tokens, lval)
48 var posBeforeScan int
49 for {
50 if lval.id == ERROR {
51 return p.scanner.In()[startPos:], tokens, true
52 }
53 lval = jsonpathSymType{}
54 posBeforeScan = p.scanner.Pos()
55 p.scanner.Scan(&lval)
56 if lval.id == 0 {
57 return p.scanner.In()[startPos:posBeforeScan], tokens, (lval.id == 0)
58 }
59 lval.pos -= startPos
60 tokens = append(tokens, lval)
61 }
62}
63
64// parse parses a statement from the given scanned tokens.
65func (p *Parser) parse(

Callers 1

ParseMethod · 0.95

Calls 3

InMethod · 0.80
PosMethod · 0.65
ScanMethod · 0.45

Tested by

no test coverage detected