token

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2018 License: MIT Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// Illegal is an unknown token type.
	Illegal = Type("Illegal")

	// EOF indicates the End-Of-File for the lexer.
	EOF = Type("EOF")

	// Literal defines entities such as columns, tables, etc...
	Literal = Type("Literal")
)
View Source
const (
	Comma     = Type(",")
	Semicolon = Type(";")
	Colon     = Type(":")
	LParen    = Type("(")
	RParen    = Type(")")
	Equals    = Type("=")
	Asterisk  = Type("*")
)

Symbols token types.

View Source
const (
	Select    = Type("SELECT")
	Update    = Type("UPDATE")
	Insert    = Type("INSERT")
	Delete    = Type("DELETE")
	From      = Type("FROM")
	Where     = Type("WHERE")
	And       = Type("AND")
	Or        = Type("OR")
	Limit     = Type("LIMIT")
	Offset    = Type("OFFSET")
	Set       = Type("SET")
	As        = Type("AS")
	Inner     = Type("INNER")
	Cross     = Type("CROSS")
	Left      = Type("LEFT")
	Right     = Type("RIGHT")
	Join      = Type("JOIN")
	On        = Type("ON")
	Group     = Type("GROUP")
	By        = Type("BY")
	Having    = Type("HAVING")
	Order     = Type("ORDER")
	Distinct  = Type("DISTINCT")
	Only      = Type("ONLY")
	Using     = Type("USING")
	Returning = Type("RETURNING")
	Values    = Type("VALUES")
	Into      = Type("INTO")
	Conflict  = Type("CONFLICT")
	Do        = Type("DO")
	Nothing   = Type("NOTHING")
)

Keywords token types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type  Type
	Value string
}

A Token is defined by its type and a value.

func New

func New(t Type, v string) Token

New creates a new Token using given type and a value.

func (*Token) String

func (t *Token) String() string

type Type

type Type string

Type defines a token type identified by the lexer.

func Lookup

func Lookup(e string) Type

Lookup will try to map a statement to a keyword.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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