token

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int
const (
	ILLEGAL Kind = iota
	UNKNOWN
	UNTERM_STR
	UNTERM_TEMP
	UNTERM_TEMP_EXPR
	EOF

	WHITESPACE
	COMMENT

	// Delimeter
	PUNCTUATION

	LEFT_PARENS
	RIGHT_PARENS
	LEFT_CURLY_BRACE
	RIGHT_CURLY_BRACE
	LEFT_SQUARE_BRACKET
	RIGHT_SQUARE_BRACKET
	DOT
	COMMA
	COLON
	DOUBLE_COLON
	QUESTION_MARK
	STAR
	PLUS
	MINUS
	FORWARD_SLASH
	PERCENT
	CARET

	// Delimeter
	LOGICAL

	AND
	OR
	EQUALS
	NOT_EQUALS
	GT
	GTE
	LT
	LTE

	// Delimeter
	LITERAL

	IDENT
	STRING
	TEMPLATE
	NUMBER

	// Delimeter
	KEYWORD

	DECLARE
	AS
	IMPORT
	FN
	TYPE
	SECTION
)

func (Kind) MarshalJSON

func (k Kind) MarshalJSON() ([]byte, error)

func (Kind) String

func (k Kind) String() string

type Position

type Position struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

func NewPosition

func NewPosition(line, col int) Position

func (Position) String

func (p Position) String() string

type Token

type Token struct {
	Kind    Kind     `json:"kind"`
	Literal string   `json:"literal"`
	Raw     string   `json:"raw"`
	Start   Position `json:"start"`
	End     Position `json:"end"`
}

func (Token) Position

func (t Token) Position() (Position, Position)

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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