token

package
v0.0.0-...-a2c20b6 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"

	//Identifiers + Literals
	IDENT = "IDENT" //add, foobar, x, y, ...
	INT   = "INT"   //123456789

	//Operators
	ASSIGN   = "="
	PLUS     = "+"
	MINUS    = "-"
	ASTERISK = "*"
	SLASH    = "/"
	PERCENT  = "%"
	GT       = ">"
	GTE      = ">="
	LT       = "<"
	LTE      = "<="
	AND      = "&"
	BAND     = "&&"
	OR       = "|"
	BOR      = "||"
	EQ       = "=="
	NE       = "!="
	BANG     = "!"
	DPLUS    = "++"

	//Delimiters
	COMMA     = ","
	SIMICOLON = ";"
	COLON     = ":"

	LPAREN = "("
	RPAREN = ")"
	LBRACE = "{"
	RBRACE = "}"

	//Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	IF       = "IF"
	ELSE     = "ELSE"
	SWITCH   = "SWITCH"
	CASE     = "CASE"
	DEFAULT  = "DEFAULT"
	RETURN   = "RETURN"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	FOR      = "FOR"
	BREAK    = "BREAK"
)

Variables

View Source
var (

	//Allowed Identifier CharSet =
	AllowedIdentChars = []*unicode.RangeTable{unicode.Letter, unicode.Number, rangetable.New('.', '_')}
)

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    TokenType
	Literal string
}

type TokenType

type TokenType string

func Lookup

func Lookup(ident string) TokenType

Jump to

Keyboard shortcuts

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