MCPcopy
hub / github.com/kashav/fsql / expect

Method expect

parser/parser.go:126–140  ·  view source on GitHub ↗

expect returns the next token if it matches the expectation t, and nil otherwise.

(t tokenizer.TokenType)

Source from the content-addressed store, hash-verified

124// expect returns the next token if it matches the expectation t, and
125// nil otherwise.
126func (p *parser) expect(t tokenizer.TokenType) *tokenizer.Token {
127 p.expected = t
128
129 if p.current == nil {
130 p.current = p.tokenizer.Next()
131 }
132
133 if p.current != nil && p.current.Type == t {
134 tok := p.current
135 p.current = nil
136 return tok
137 }
138
139 return nil
140}

Callers 8

TestParser_ExpectFunction · 0.95
parseSourceListMethod · 0.95
parseSelectClauseMethod · 0.95
parseFromClauseMethod · 0.95
parseWhereClauseMethod · 0.95
parseAttrsMethod · 0.95
parseAttrMethod · 0.95
parseConditionMethod · 0.95

Calls 1

NextMethod · 0.80

Tested by 1

TestParser_ExpectFunction · 0.76