token

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ILLEGAL = "ILLEGAL" // For any unknown token/character
	EOFILE  = "EOFILE"  // Tells the parser that it should stop

	// Identifiers + literals
	IDENT  = "IDENT" // add, foobar, x, y, ...
	INT    = "INT"   // 1343456
	FLOAT  = "FLOAT" // 1.234
	STRING = "STRING"

	// Operators
	ASSIGN        = "="
	PLUS          = "+"
	MINUS         = "-"
	EXCLAMATION   = "!"
	ASTERISK      = "*"
	SLASH         = "/"
	LESSTHAN      = "<"
	GREATERTHAN   = ">"
	LESSTHANEQ    = "<="
	GREATERTHANEQ = ">="
	EQUAL         = "=="
	NOTEQUAL      = "!="
	MOD           = "%"

	// Logical Operators
	AND = "and"
	OR  = "or"

	// Delimiters
	COMMA       = ","
	SEMICOLON   = ";"
	LEFTPAR     = "("
	RIGHTPAR    = ")"
	LEFTBRAC    = "{"
	RIGHTBRAC   = "}"
	COLON       = ":"
	LEFTSQPRAC  = "["
	RIGHTSQPRAC = "]"
	UNDERSCORE  = "_"

	// Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	CONST    = "CONST"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
	DURING   = "DURING"
	BREAK    = "BREAK"
	SKIP     = "SKIP"
	FOR      = "FOR"
	IN       = "IN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    TokenType
	Literal string
}

type TokenType

type TokenType string

func LookupIdent

func LookupIdent(ident string) TokenType

Jump to

Keyboard shortcuts

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