token

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: MIT Imports: 0 Imported by: 18

Documentation

Index

Constants

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

	Constant         = "CONSTANT"
	Ident            = "IDENT"
	InstanceVariable = "INSTANCE_VAR"
	Int              = "INT"
	Float            = "FLOAT"
	String           = "STRING"
	Comment          = "COMMENT"

	Assign   = "="
	Plus     = "+"
	PlusEq   = "+="
	Minus    = "-"
	MinusEq  = "-="
	Bang     = "!"
	Asterisk = "*"
	Pow      = "**"
	Slash    = "/"
	Dot      = "."
	And      = "&&"
	Or       = "||"
	OrEq     = "||="
	Modulo   = "%"

	LT   = "<"
	LTE  = "<="
	GT   = ">"
	GTE  = ">="
	COMP = "<=>"

	Comma     = ","
	Semicolon = ";"
	Colon     = ":"
	Bar       = "|"

	LParen   = "("
	RParen   = ")"
	LBrace   = "{"
	RBrace   = "}"
	LBracket = "["
	RBracket = "]"

	Eq    = "=="
	NotEq = "!="
	Range = ".."

	True     = "TRUE"
	False    = "FALSE"
	Null     = "Null"
	If       = "IF"
	ElsIf    = "ELSIF"
	Else     = "ELSE"
	Case     = "CASE"
	When     = "WHEN"
	Return   = "RETURN"
	Next     = "NEXT"
	Break    = "BREAK"
	Def      = "DEF"
	Self     = "SELF"
	End      = "END"
	While    = "WHILE"
	Do       = "DO"
	Yield    = "YIELD"
	GetBlock = "GET_BLOCK"
	Class    = "CLASS"
	Module   = "MODULE"

	ResolutionOperator = "::"
)

Literals

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    Type
	Literal string
	Line    int
}

Token is structure for identifying input stream of characters

func CreateOperator added in v0.1.12

func CreateOperator(literal string, line int) Token

CreateOperator - Factory method for creating operator types token from literal string

func CreateSeparator added in v0.1.12

func CreateSeparator(literal string, line int) Token

CreateSeparator - Factory method for creating separator types token from literal string

type Type

type Type string

Type is used to determine token type

func LookupIdent

func LookupIdent(ident string) Type

LookupIdent is used for keyword identification

Jump to

Keyboard shortcuts

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