token

package
v0.0.0-...-dcc2aae Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// epsilon
	EpsilonRune rune = constant.ZeroInt
	KeywordList      = []Type{Select, From, As, Where, And, Or}
)

Functions

func HasIntersect

func HasIntersect(tokenTypeList [][]Type) bool

func TypeExists

func TypeExists(tokenTypeList []Type, t Type) bool

Types

type Token

type Token struct {
	Type   Type
	Lexeme string
}

func NewToken

func NewToken(tokenType Type, lexeme string) *Token

NewToken returns a new *Token

func (*Token) String

func (t *Token) String() string

String returns the string representation of the token

type Type

type Type int
const (
	// keyword
	Select Type = iota + 1
	From
	As
	Where
	And
	Or
	// identifier
	Identifier
	// comparison operator
	GE
	GT
	LE
	LT
	Equal
	NotEqual1
	NotEqual2
	// arithmetic operator
	Plus
	Minus
	Multiply
	Divide
	Mod
	// number literal
	NumberLiteral
	// string literal
	StringLiteral
	// separator
	Comma
	Semicolon
	LeftParenthesis
	RightParenthesis
	SingleQuote
	// white space
	WhiteSpace
	// Epsilon
	Epsilon
	// End
	End
	// error
	Error
)

func (Type) IsKeyword

func (t Type) IsKeyword() bool

IsKeyword returns if the token type is a keyword

func (Type) String

func (t Type) String() string

String returns the string representation of the token type

Jump to

Keyboard shortcuts

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