tokenizer

package
v1.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StandardRemoveQuotedTextAndComment

func StandardRemoveQuotedTextAndComment(statement string) (string, error)

StandardRemoveQuotedTextAndComment removes the quoted text and comment.

Types

type Tokenizer

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

func NewTokenizer

func NewTokenizer(statement string) *Tokenizer

NewTokenizer creates a new tokenizer. Notice: we append an additional eofRune in the statement. This is a sentinel rune.

func (*Tokenizer) SetLineForMySQLCreateTableStmt

func (t *Tokenizer) SetLineForMySQLCreateTableStmt(node *tidbast.CreateTableStmt, firstLine int) error

func (*Tokenizer) SplitPostgreSQLMultiSQL

func (t *Tokenizer) SplitPostgreSQLMultiSQL() ([]base.SingleSQL, error)

SplitPostgreSQLMultiSQL splits the statement to a string slice. We mainly considered:

comments
- style /* comments */
- style -- comments
string
- style 'string'
- style $$ string $$
identifier
- style "indentifier"

Notice:

func (*Tokenizer) SplitStandardMultiSQL

func (t *Tokenizer) SplitStandardMultiSQL() ([]base.SingleSQL, error)

SplitStandardMultiSQL splits the statement to a string slice. We mainly considered:

comments
- style /* comments */
- style -- comments
string
- style 'string'
identifier
- style "identifier"

The difference between PostgreSQL and Oracle is that PostgreSQL supports dollar-quoted string, but Oracle does not.

func (*Tokenizer) SplitTiDBMultiSQL

func (t *Tokenizer) SplitTiDBMultiSQL() ([]base.SingleSQL, error)

SplitTiDBMultiSQL splits the statement to a string slice.

Jump to

Keyboard shortcuts

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