token

package
v0.0.0-...-99afa44 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

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

	IDENT  = "IDENT"  // x, t, add
	INT    = "INT"    // 123
	STRING = "STRING" // "abcde"

	ASSIGN        = "="
	PLUS          = "+"
	MINUS         = "-"
	STAR          = "*"
	SLASH         = "/"
	EXCLAMINATION = "!"
	PERCENT       = "%"

	EQ  = "=="
	NEQ = "!="
	LEQ = "<="
	GEQ = ">="
	LT  = "<"
	GT  = ">"

	LAND = "&&"
	LOR  = "||"

	COMMA     = ","
	SEMICOLON = ";"
	COLON     = ":"

	LPAR     = "("
	RPAR     = ")"
	LBRACE   = "{"
	RBRACE   = "}"
	LBRACKET = "["
	RBRACKET = "]"

	// keywords
	IF     = "IF"
	ELSE   = "ELSE"
	TRUE   = "TRUE"
	FALSE  = "FALSE"
	FUNC   = "FUNCTION"
	RETURN = "RETURN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Pos

type Pos struct {
	Line   int
	Offset int
}

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