compiler

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Compiler

type Compiler struct {
	// contains filtered or unexported fields
}

func New

func New(l *Lexer) *Compiler

func (*Compiler) Compile

func (c *Compiler) Compile() (*Root, error)

type FnExpr

type FnExpr struct {
	Name      string
	Token     Token
	Arguments []Node
	// contains filtered or unexported fields
}

func (*FnExpr) AddNode

func (f *FnExpr) AddNode(node Node)

type Lexer

type Lexer struct {
	// contains filtered or unexported fields
}

func NewLexer

func NewLexer(str string) *Lexer

func (*Lexer) Err

func (l *Lexer) Err() error

func (*Lexer) Scan

func (l *Lexer) Scan() bool

func (*Lexer) Token

func (l *Lexer) Token() Token

type Node

type Node interface {
	// contains filtered or unexported methods
}

type Root

type Root struct {
	Nodes []Node
	// contains filtered or unexported fields
}

func (*Root) AddNode

func (r *Root) AddNode(node Node)

type TextExpr

type TextExpr struct {
	Token
	// contains filtered or unexported fields
}

type Token

type Token struct {
	Kind     TokenKind
	Value    string
	StartPos int
	EndPos   int
}

func (Token) String

func (t Token) String() string

type TokenErr

type TokenErr struct {
	Token
	// contains filtered or unexported fields
}

func NewErr

func NewErr(t Token, message string) *TokenErr

func (*TokenErr) Error

func (t *TokenErr) Error() string

type TokenKind

type TokenKind int
const (
	Unknown TokenKind = iota
	OpenParenthesis
	CloseParenthesis
	Function
	Text
)

func (TokenKind) String

func (s TokenKind) String() string

Jump to

Keyboard shortcuts

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