token

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Position

type Position struct {
	Line   int
	Column int
}

Position points to a location in the source SQL (1-based indices).

type Token

type Token struct {
	Type    Type
	Literal string
	Pos     Position
}

Token holds the type, literal representation, and source location.

type Type

type Type string

Type identifies the lexical class of a token.

const (
	ILLEGAL Type = "ILLEGAL"
	EOF     Type = "EOF"

	IDENT       Type = "IDENT"
	NUMBER      Type = "NUMBER"
	STRING      Type = "STRING"
	PLACEHOLDER Type = "PLACEHOLDER"

	COMMA     Type = ","
	SEMICOLON Type = ";"
	LPAREN    Type = "("
	RPAREN    Type = ")"
	LBRACKET  Type = "["
	RBRACKET  Type = "]"
	DOT       Type = "."
	STAR      Type = "*"
	PLUS      Type = "+"
	MINUS     Type = "-"
	SLASH     Type = "/"
	PERCENT   Type = "%"
	CARET     Type = "^"
	EQ        Type = "="
	NEQ       Type = "NEQ"
	LT        Type = "<"
	LTE       Type = "<="
	GT        Type = ">"
	GTE       Type = ">="

	// Keywords
	SELECT       Type = "SELECT"
	CREATE       Type = "CREATE"
	DROP         Type = "DROP"
	SHOW         Type = "SHOW"
	VIEW         Type = "VIEW"
	VIEWS        Type = "VIEWS"
	TABLE        Type = "TABLE"
	TABLES       Type = "TABLES"
	DESCRIBE     Type = "DESCRIBE"
	REPLACE      Type = "REPLACE"
	MATERIALIZED Type = "MATERIALIZED"
	INSERT       Type = "INSERT"
	UPDATE       Type = "UPDATE"
	DELETE       Type = "DELETE"
	CASE         Type = "CASE"
	INTO         Type = "INTO"
	VALUES       Type = "VALUES"
	SET          Type = "SET"
	FROM         Type = "FROM"
	WHERE        Type = "WHERE"
	GROUP        Type = "GROUP"
	BY           Type = "BY"
	HAVING       Type = "HAVING"
	ORDER        Type = "ORDER"
	LIMIT        Type = "LIMIT"
	OFFSET       Type = "OFFSET"
	AS           Type = "AS"
	WHEN         Type = "WHEN"
	THEN         Type = "THEN"
	ELSE         Type = "ELSE"
	END          Type = "END"
	IF           Type = "IF"
	DISTINCT     Type = "DISTINCT"
	WITH         Type = "WITH"
	RECURSIVE    Type = "RECURSIVE"
	OVER         Type = "OVER"
	PARTITION    Type = "PARTITION"

	JOIN  Type = "JOIN"
	INNER Type = "INNER"
	LEFT  Type = "LEFT"
	RIGHT Type = "RIGHT"
	FULL  Type = "FULL"
	OUTER Type = "OUTER"
	CROSS Type = "CROSS"
	ON    Type = "ON"

	AND     Type = "AND"
	OR      Type = "OR"
	NOT     Type = "NOT"
	NULL    Type = "NULL"
	TRUE    Type = "TRUE"
	FALSE   Type = "FALSE"
	IN      Type = "IN"
	EXISTS  Type = "EXISTS"
	BETWEEN Type = "BETWEEN"
	LIKE    Type = "LIKE"
	IS      Type = "IS"
	DESC    Type = "DESC"
	ASC     Type = "ASC"

	UNION     Type = "UNION"
	INTERSECT Type = "INTERSECT"
	EXCEPT    Type = "EXCEPT"
	ALL       Type = "ALL"
)

Token types supported by the SQL parser.

func Lookup

func Lookup(ident string) Type

Lookup returns the keyword token if the identifier matches a reserved word.

Jump to

Keyboard shortcuts

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