MCPcopy Create free account
hub / github.com/bytebase/bytebase / parseOmniStatementNode

Function parseOmniStatementNode

backend/plugin/parser/snowflake/omni_ast.go:51–60  ·  view source on GitHub ↗

parseOmniStatementNode parses ONE statement's text with the omni parser and returns its single top-level statement node. Unlike the dual-AST transition (where omni was best-effort behind the legacy gatekeeper), a parse failure is now a hard error: the omni parser is the only parser, so a statement i

(text string)

Source from the content-addressed store, hash-verified

49// is now a hard error: the omni parser is the only parser, so a statement it
50// rejects must fail the batch the way a legacy ANTLR syntax error did.
51func parseOmniStatementNode(text string) (omniast.Node, error) {
52 file, err := parseSnowflakeAST(text)
53 if err != nil {
54 return nil, err
55 }
56 if file == nil || len(file.Stmts) == 0 {
57 return nil, errors.New("statement yielded no parse tree")
58 }
59 return file.Stmts[0], nil
60}
61
62// convertOmniParseError converts an omni *parser.ParseError into the bare
63// *base.SyntaxError shape the legacy ANTLR error listener produced (callers

Callers 1

parseSnowflakeStatementsFunction · 0.85

Calls 1

parseSnowflakeASTFunction · 0.85

Tested by

no test coverage detected