plsqlparser

package module
v0.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	OpenParenTok = TokenType(iota + 1)
	CloseParenTok
	CommaTok
	AtomTok
	StringTok
	NumberTok
	OpTok
	LineCommentTok
	BlockCommentTok
	EndTok
)

Variables

View Source
var (
	// NewPlSqlLexer is a copy of plsql.NewPlSqlLexer
	NewPlSqlLexer = plsql.NewPlSqlLexer
	// NewPlSqlParser is a copy of plsql.NewPlSqlParser
	NewPlSqlParser = plsql.NewPlSqlParser
)

Export functionality of plsql package.

View Source
var Warning = errors.New("WARNING")

Functions

func NewPlSqlLexerParser

func NewPlSqlLexerParser(text string) *plsql.PlSqlParser

NewPlSqlLexerParser returns a new *PlSqlParser, including a PlSqlLexer with the given text.

func NewPlSqlStringLexer

func NewPlSqlStringLexer(text string) *plsql.PlSqlLexer

NewPlSqlStringLexer returns a new *PlSqlLexer with an input stream set to the given text.

func ParseTillCloseParen

func ParseTillCloseParen(tokens []Token) ([]Token, Expressions, error)

Types

type BaseWalkListener

type BaseWalkListener struct {
	*plsql.BasePlSqlParserListener
	*antlr.DefaultErrorListener
	Ambiguity [][2]int
	Err       *Errors
}

BaseWalkListener is a minimal Walk Listener.

func NewPlSqlParserListener

func NewPlSqlParserListener() *BaseWalkListener

NewPlSqlParserListener returns a *BaseWalkListener with the DefaultErrorListener set.

func (*BaseWalkListener) AddError

func (wl *BaseWalkListener) AddError(err error)

func (*BaseWalkListener) Walk

func (wl *BaseWalkListener) Walk(tree Tree, parser interface{ AddErrorListener(ErrorListener) }) error

Walk the given Tree, with the optional parser's ErrorListener set to wl.

type Chunk

type Chunk struct {
	Text        string
	Start, Stop int
}

func (Chunk) String

func (t Chunk) String() string

type ConvertMap

type ConvertMap struct {
	Table  string
	Fields []Chunk
	Select *selectStmt
	Values []Chunk

	InsertInto Chunk
}

func ParseToConvertMap

func ParseToConvertMap(text string) (ConvertMap, error)

ParseToConvertMap parses the text into a ConvertMap (INSERT INTO with SELECT statements only).

func (ConvertMap) String

func (M ConvertMap) String() string

type ErrorListener

type ErrorListener = antlr.ErrorListener

type Errors

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

Errors implements the "error" interface, and holds several errors.

func (*Errors) Append

func (es *Errors) Append(err error)

func (*Errors) Error

func (es *Errors) Error() string

type Expression

type Expression struct {
	Value string
	Expr  Expressions
}

type Expressions

type Expressions []Expression

type InsertInto

type InsertInto struct {
	Table    string
	IsSelect bool
	Fields   []string
	Values   []Expression
}

func (*InsertInto) Parse

func (ii *InsertInto) Parse(text string) error

Parse the text, naively.

type SelectStatement

type SelectStatement struct {
	Fields []Expression
}

func ParseSelect

func ParseSelect(tokens []Token) (SelectStatement, error)

type TableWithAlias

type TableWithAlias struct {
	Alias, Table string
}

type Token

type Token struct {
	Type  TokenType
	Value string
	Err   error
}

type TokenType

type TokenType uint8

type Tree

type Tree = antlr.Tree

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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