parser_sql

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TOKEN_EOF              = iota // end-of-file
	TOKEN_NOT                     // !
	TOKEN_LEFT_PAREN              // (
	TOKEN_RIGHT_PAREN             // )
	TOKEN_LEFT_BRACKET            // [
	TOKEN_RIGHT_BRACKET           // ]
	TOKEN_LEFT_BRACE              // {
	TOKEN_RIGHT_BRACE             // }
	TOKEN_LT                      // <
	TOKEN_GT                      // >
	TOKEN_COLON                   // :
	TOKEN_SEMICOLON               // ;
	TOKEN_DOT                     // .
	TOKEN_COMMA                   // ,
	TOKEN_EQUAL                   // =
	TOKEN_AT                      // @
	TOKEN_AND                     // &
	TOKEN_VERTICAL_BAR            // |
	TOKEN_QUOTE                   // "
	TOKEN_DUOQUOTE                // ""
	TOKEN_SINGLE_QUOTE            // '
	TOKEN_DUO_SINGLE_QUOTE        // ”
	TOKEN_BACKQUOTE               // `
	TOKEN_ESCAPE_CHARACTER        // \

	// comment
	TOKEN_MULTI_LINE_COMMENT_START // /*
	TOKEN_MULTI_LINE_COMMENT_END   // */
	TOKEN_COMMENT_SHARP            // #
	TOKEN_SINGLE_LINE_COMMENT      // --

	// literal
	TOKEN_NUMBER // number literal

	// keywords
	TOKEN_SELECT // select
	TOKEN_UPDATE // update
	TOKEN_DELETE // delete
	TOKEN_CREATE // create
	TOKEN_INSERT // insert

	TOKEN_OTHER_TOKEN // SourceCharacter - Words
)

token const

Variables

This section is empty.

Functions

func IsSelectSQL

func IsSelectSQL(lexer *Lexer) (bool, error)

Types

type Lexer

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

lexer struct

func NewLexer

func NewLexer(sql string) *Lexer

func (*Lexer) GetLineNum

func (lexer *Lexer) GetLineNum() int

func (*Lexer) GetNextToken

func (lexer *Lexer) GetNextToken() (lineNum int, tokenType int, token string, err error)

func (*Lexer) GetPos

func (lexer *Lexer) GetPos() int

func (*Lexer) LookAhead

func (lexer *Lexer) LookAhead() (int, error)

func (*Lexer) MatchToken

func (lexer *Lexer) MatchToken() (lineNum int, tokenType int, token string, err error)

func (*Lexer) NextTokenIs

func (lexer *Lexer) NextTokenIs(tokenType int) (lineNum int, token string, err error)

type SQL

type SQL struct {
	LastLineNum int
	Statements  []Statement
}

type Statement

type Statement struct {
	LineNum   int
	QyeryType int
	Query     []*Token
}

type Token

type Token struct {
	LineNum int
	Value   string
}

type Word

type Word struct {
	LineNum int
	Value   string
}

type Words

type Words []*Word

Jump to

Keyboard shortcuts

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