parser

package
v0.0.0-...-959c02d Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lexer

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

Lexer implements the yyLexer interface.

func NewLexer

func NewLexer(s string) *Lexer

NewLexer returns a new scanner object.

func (*Lexer) AppendError

func (l *Lexer) AppendError(err error)

AppendError sets error into scanner. Lexer satisfies yyLexer interface which need this function.

func (*Lexer) AppendWarn

func (l *Lexer) AppendWarn(err error)

AppendWarn sets warning into scanner.

func (*Lexer) Errorf

func (l *Lexer) Errorf(format string, a ...interface{}) (err error)

Errorf tells scanner something is wrong. Lexer satisfies yyLexer interface which need this function.

func (*Lexer) Errors

func (l *Lexer) Errors() (warns []error, errs []error)

Errors returns the errors and warns during a scan.

func (*Lexer) InheritScanner

func (l *Lexer) InheritScanner(sql string) *Lexer

InheritScanner returns a new scanner object which inherits configurations from the parent scanner.

func (*Lexer) Lex

func (l *Lexer) Lex(v *yySymType) int

Lex returns a token and store the token value in v. Lexer satisfies yyLexer interface. 0 and invalid are special token id this function would return: return 0 tells parser that scanner meets EOF, return invalid tells parser that scanner meets illegal character.

func (*Lexer) LexLiteral

func (l *Lexer) LexLiteral() interface{}

LexLiteral returns the value of the converted literal

type Parser

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

func New

func New() *Parser

func (*Parser) Parse

func (p *Parser) Parse(sql string) (stmts []ast.StmtNode, warns []error, err error)

func (*Parser) ParseOneStmt

func (p *Parser) ParseOneStmt(sql string) (ast.StmtNode, error)

ParseOneStmt parses a query and returns an ast.StmtNode. The query must have exactly one statement.

type Pos

type Pos struct {
	Line   int
	Col    int
	Offset int
}

Pos represents the position of a token.

Directories

Path Synopsis
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
Package ast is the abstract syntax tree parsed from a SQL statement by parser.
Goyacc is a version of yacc generating Go parsers.
Goyacc is a version of yacc generating Go parsers.

Jump to

Keyboard shortcuts

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