token

package
v0.0.0-...-e9dc133 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EOF TokenType = "EOF"

	NEW_LINE = "NEWLINE"

	// Single character symbols
	LEFT_PAREN    = "("
	RIGHT_PAREN   = ")"
	LEFT_BRACE    = "{"
	RIGHT_BRACE   = "}"
	LEFT_BRACKET  = "["
	RIGHT_BRACKET = "]"
	COMMA         = ","
	DOT           = "."
	MINUS         = "-"
	PLUS          = "+"
	SEMICOLON     = ";"
	SLASH         = "/"
	STAR          = "*"
	QUESTION      = "?"
	COLON         = ":"

	// Multi character symbols
	BANG          = "!"
	BANG_EQUAL    = "!="
	EQUAL         = "="
	EQUAL_EQUAL   = "=="
	GREATER       = ">"
	GREATER_EQUAL = ">="
	LESS          = "<"
	LESS_EQUAL    = "<="
	LAMBDA_ARROW  = "=>"

	// Literals
	IDENTIFIER = "IDENTIFIER"
	STRING     = "STRING"
	NUMBER     = "NUMBER"

	// Keywords
	AND      = "AND"
	BREAK    = "BREAK"
	CLASS    = "CLASS"
	CONTINUE = "CONTINUE"
	ELSE     = "ELSE"
	FALSE    = "FALSE"
	FUN      = "FUN"
	FOR      = "FOR"
	GET      = "GET"
	IF       = "IF"
	NIL      = "NIL"
	OF       = "OF"
	OR       = "OR"
	RETURN   = "RETURN"
	SET      = "SET"
	STATIC   = "STATIC"
	SUPER    = "SUPER"
	THIS     = "THIS"
	TRUE     = "TRUE"
	VAR      = "VAR"
	WHILE    = "WHILE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

type Token struct {
	Type    TokenType
	Lexeme  string
	Literal any
	Line    int
}

type TokenType

type TokenType string

func LookupKeyword

func LookupKeyword(word string) TokenType

Jump to

Keyboard shortcuts

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