parser

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(tokens []lexer.Token, options *formatters.Options) ([]formatters.Formatter, error)

Parse parses a sequence of tokens returning a logically grouped slice of Formatters. Each Formatter is a logical segment of an SQL query. It may also be a group of such.

Types

type Parser

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

Parser initiates with a sequence of lexer tokens to be processed by the Parse() function. Furthermore, it holds all necessary state variables and a set of options to be assigned to each Formatter.

func NewParser

func NewParser(tokens []lexer.Token, options *formatters.Options) (*Parser, error)

NewParser initializes a Parser with a sequence of lexer tokens representing an SQL query.

func (*Parser) Parse

func (r *Parser) Parse() ([]formatters.Formatter, error)

Parse wraps parseSegment() and loops until EOF is reached. The initial sequence of tokens is usually comprised out of multiple segments (SELECT, FROM, WHERE,...). Parse() loops until EOF to make sure all segments are processed.

Jump to

Keyboard shortcuts

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