token

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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
	STRING = "STRING"

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

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

	// Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	CONST    = "CONST"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
)

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