token

package
v0.0.0-...-8c2d49f Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2023 License: MIT Imports: 0 Imported by: 0

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   = "%"

	Match = "=~"
	LT    = "<"
	LTE   = "<="
	GT    = ">"
	GTE   = ">="

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

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

	Eq        = "=="
	NotEq     = "!="
	IsSame    = "==="
	IsNotSame = "!=="
	Range     = ".."
	RangeExcl = "..."

	True     = "TRUE"
	False    = "FALSE"
	Nil      = "NIL"
	If       = "IF"
	ElsIf    = "ELSIF"
	Else     = "ELSE"
	Default  = "DEFAULT"
	Switch   = "SWITCH"
	Case     = "CASE"
	Return   = "RETURN"
	Continue = "CONTINUE"
	Break    = "BREAK"
	Def      = "DEF"
	Self     = "SELF"
	Super    = "SUPER"
	While    = "WHILE"
	Yield    = "YIELD"
	GetBlock = "BLOCK"
	HasBlock = "HASBLOCK"
	Class    = "CLASS"
	Module   = "MODULE"
	Catch    = "CATCH"
	Finally  = "FINALLY"

	ResolutionOperator = "::"

	RightArrow = "->"
	LeftArrow  = "<-"
	Pipe       = "|>"
)

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 Create

func Create(t Type, literal string, line int) Token

Create will create a token

func CreateOperator

func CreateOperator(literal string, line int) Token

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

func CreateSeparator

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