MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / parseWithDepth

Method parseWithDepth

pkg/sql/parser/parse.go:152–170  ·  view source on GitHub ↗
(depth int, sql string, nakedIntType *types.T)

Source from the content-addressed store, hash-verified

150}
151
152func (p *Parser) parseWithDepth(depth int, sql string, nakedIntType *types.T) (Statements, error) {
153 stmts := Statements(p.stmtBuf[:0])
154 p.scanner.init(sql)
155 defer p.scanner.cleanup()
156 for {
157 sql, tokens, done := p.scanOneStmt()
158 stmt, err := p.parse(depth+1, sql, tokens, nakedIntType)
159 if err != nil {
160 return nil, err
161 }
162 if stmt.AST != nil {
163 stmts = append(stmts, stmt)
164 }
165 if done {
166 break
167 }
168 }
169 return stmts, nil
170}
171
172// parse parses a statement from the given scanned tokens.
173func (p *Parser) parse(

Callers 4

ParseMethod · 0.95
ParseWithIntMethod · 0.95
parseOneWithDepthMethod · 0.95
ParseFunction · 0.95

Calls 5

scanOneStmtMethod · 0.95
parseMethod · 0.95
StatementsTypeAlias · 0.85
initMethod · 0.45
cleanupMethod · 0.45

Tested by

no test coverage detected