token

package
v0.0.1-lw Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: MIT, MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Token

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

type TokenType

type TokenType byte
const (
	ERROR TokenType = iota
	EOF

	// Identifiers
	IDENTIFIER // variable names: x, y, add, foobar

	// literals
	NUMBER
	STRING

	// Operators
	ASSIGN       // =
	ASSIGN_ARROW // <-
	PIPE         // |>
	PLUS         // +
	MINUS        // -
	DIV          // /
	MOD          // %
	BANG         // !
	MUL          // *
	GT           // >
	LT           // <
	GTE          // >=
	LTE          // <=
	EQ           // ==
	NOT_EQ       // !=
	OR           // ||
	VOR          // |
	AND          // &&
	VAND         // &

	// Delimiters
	COMMA     // ,
	COLON     // :
	SEMICOLON // ;
	LPAREN    // (
	RPAREN    // )
	LBRACKET  // [
	RBRACKET  // ]
	LBRACE    // {
	RBRACE    // }
	NEWLINE   // \n

	// Keywords
	FUNCTION // fn
	LET      // let
	IF       // if
	ELSE     // else
	TRUE     // true
	FALSE    // false
	NULL     // null
	RETURN   // return
	FOR      // for
	IN       // IN
)

func GetIdentifierType

func GetIdentifierType(k string) TokenType

func (TokenType) String

func (t TokenType) String() string

for debugging purposes

Jump to

Keyboard shortcuts

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