parser

package
v0.58.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package parser builds a typed syntax tree from SQL text. Expression parsing is a Pratt parser over one precedence table per dialect, so precedence and associativity are decided in a single place; statement parsing is recursive descent.

The parser implements a stated subset of SQL rather than any dialect in full. A construct it does not model is refused with ErrUnsupportedFeature, never forwarded to the caller untranslated: what this package accepts is what it has been taught, not what SQLite happens to tolerate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(d dialects.Dialect, query string) (ast.Stmt, error)

Parse reads one statement, which must be the whole of the query apart from a trailing semicolon.

func ParseExpr

func ParseExpr(d dialects.Dialect, text string) (ast.Expr, error)

ParseExpr reads one expression and nothing else. It exists for tests and for callers that translate a fragment rather than a statement.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser reads a token stream into a syntax tree.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL