token

package
v0.0.0-...-005afaa Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CMP_LESS comparisonResult = iota
	CMP_EQ
	CMP_GREATER
)
View Source
const (
	ILLEGAL = "ILLEGAL"
	EOF     = "EOF"

	IDENT  = "IDENT"
	INT    = "INT"
	STRING = "STRING"

	ASSIGN   = "="
	PLUS     = "+"
	MINUS    = "-"
	BANG     = "!"
	ASTERISK = "*"
	SLASH    = "/"
	LT       = "<"
	GT       = ">"
	EQ       = "=="
	NOT_EQ   = "!="

	COMMA      = ","
	COLON      = ":"
	SEMICOLON  = ";"
	TWO_DOTS   = ".."
	THREE_DOTS = "..."

	LPAREN   = "("
	RPAREN   = ")"
	LBRACE   = "{"
	RBRACE   = "}"
	LBRACKET = "["
	RBRACKET = "]"

	FUNCTION = "FUNCTION"
	LET      = "LET"
	TRUE     = "TRUE"
	FALSE    = "FALSE"
	IF       = "IF"
	ELSE     = "ELSE"
	RETURN   = "RETURN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	Line   int
	Column int
}

type Span

type Span struct {
	Text       *string
	Start, End Location
}

func (Span) Contains

func (s Span) Contains(l Location) bool

func (Span) Join

func (first Span) Join(second Span) Span

type Token

type Token struct {
	Type    TokenType
	Literal string
	Span    Span
}

func (*Token) IsIdent

func (t *Token) IsIdent() bool

func (*Token) IsLet

func (t *Token) IsLet() bool

func (*Token) IsReturn

func (t *Token) IsReturn() bool

type TokenType

type TokenType string

func LookupIdentifier

func LookupIdentifier(ident string) TokenType

Jump to

Keyboard shortcuts

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