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 ¶
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.