token

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

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

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

	// Operators
	ASSIGN   = "="
	PLUS     = "+"
	MINUS    = "-"
	BANG     = "!"
	ASTERISK = "*"
	SLASH    = "/"
	INC      = "++"
	DEC      = "--"

	LT = "<"
	GT = ">"

	EQ     = "=="
	NOT_EQ = "!="

	// Delimiters
	COMMA         = ","
	SEMICOLON     = ";"
	COLON         = ":"
	LPAREN        = "("
	RPAREN        = ")"
	LBRACE        = "{"
	RBRACE        = "}"
	LBRACKET      = "["
	RBRACKET      = "]"
	LDBRACKET     = "[["
	RDBRACKET     = "]]"
	DOUBLE_LPAREN = "(("

	// Keywords
	FUNCTION = "FUNCTION"
	LET      = "LET"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
	THEN     = "THEN"
	FI       = "FI"
	FOR      = "FOR"
	DONE     = "DONE"

	// Zsh-specific tokens (initial)
	DOLLAR        = "$"
	DOLLAR_LBRACE = "${"
	DOLLAR_LPAREN = "$("
	HASH          = "#"
	AMPERSAND     = "&"
	PIPE          = "|"
	BACKTICK      = "`"
	TILDE         = "~"
	CARET         = "^"
	PERCENT       = "%"
	DOT           = "."
	SHEBANG       = "#!"

	// Zsh-specific operators (initial)
	AND = "&&"
	OR  = "||"

	// Zsh-specific delimiters (initial)
	LARRAY = "("
	RARRAY = ")"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    TokenType
	Literal string
	Line    int
	Column  int
}

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