ast

package
v0.0.0-...-6aa2a36 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StringType  = "string"
	BooleanType = "bool"
	NumberType  = "number"
	SymbolType  = "symbol"
	NullType    = "null"
)

type tags

Variables

This section is empty.

Functions

This section is empty.

Types

type Assignment

type Assignment struct {
	Name Symbol
	Val  Expression
}

statements

func (Assignment) CompareStatement

func (n Assignment) CompareStatement(b Statement) bool

type BinaryOp

type BinaryOp struct {
	Operator BinaryOperator
	LeftArg  Expression
	RightArg Expression
}

expressions

func (BinaryOp) CompareExpression

func (a BinaryOp) CompareExpression(b Expression) bool

type BinaryOperator

type BinaryOperator string

expressions

const (
	AddOp    BinaryOperator = "add"
	SubOp    BinaryOperator = "sub"
	MulOp    BinaryOperator = "mul"
	DivOp    BinaryOperator = "div"
	ModOp    BinaryOperator = "mod"
	GtOp     BinaryOperator = "gt"
	GteOp    BinaryOperator = "gte"
	LtOp     BinaryOperator = "lt"
	LteOp    BinaryOperator = "lte"
	EqOp     BinaryOperator = "eq"
	NeqOp    BinaryOperator = "neq"
	AndOp    BinaryOperator = "and"
	OrOp     BinaryOperator = "or"
	ConcatOp BinaryOperator = "concat"
)

binary operators

type BlockElement

type BlockElement interface {
	CompareBlock(b BlockElement) bool
}

block elements

type CodeBlock

type CodeBlock struct {
	Code []Statement
}

block elements

func (CodeBlock) CompareBlock

func (n CodeBlock) CompareBlock(b BlockElement) bool

type Conditional

type Conditional struct {
	Cond       Expression
	Consequent Statement
	Alternate  Statement
}

statements

func (Conditional) CompareStatement

func (n Conditional) CompareStatement(b Statement) bool

type Expression

type Expression interface {
	CompareExpression(b Expression) bool
}

expressions

type FunctionCall

type FunctionCall struct {
	Name   Symbol
	Params []Expression
}

statements

func (FunctionCall) CompareStatement

func (n FunctionCall) CompareStatement(b Statement) bool

type GotoNode

type GotoNode struct {
	Name Symbol
}

statements

func (GotoNode) CompareStatement

func (n GotoNode) CompareStatement(b Statement) bool

type InfiniteLoop

type InfiniteLoop struct {
	Consequent Statement
}

statements

func (InfiniteLoop) CompareStatement

func (n InfiniteLoop) CompareStatement(b Statement) bool

type Inline

type Inline interface {
	CompareInline(b Inline) bool
}

inlines

type InlineCode

type InlineCode struct {
	Expr Expression
}

inlines

func (InlineCode) CompareInline

func (n InlineCode) CompareInline(b Inline) bool
type Link struct {
	Dest Symbol
	Text Inline
}

block elements

func (Link) CompareBlock

func (n Link) CompareBlock(b BlockElement) bool

type Literal

type Literal struct {
	Type Type
	Val  interface{}
}

expressions

func (Literal) CompareExpression

func (a Literal) CompareExpression(b Expression) bool

type Loop

type Loop struct {
	Cond       Expression
	Consequent Statement
}

statements

func (Loop) CompareStatement

func (n Loop) CompareStatement(b Statement) bool

type Node

type Node struct {
	Name Symbol
	Body []BlockElement
}

top level elements

func (Node) CompareNode

func (n Node) CompareNode(n2 Node) bool

type Option

type Option []Link

block elements

func (Option) CompareBlock

func (n Option) CompareBlock(b BlockElement) bool

type Paragraph

type Paragraph []Inline

block elements

func (Paragraph) CompareBlock

func (n Paragraph) CompareBlock(b BlockElement) bool

type Script

type Script struct {
	Nodes     []Node
	Functions map[string][]Type
}

top level elements

func (Script) CompareScript

func (s Script) CompareScript(s2 Script) bool

type Statement

type Statement interface {
	CompareStatement(b Statement) bool
}

statements

type StatementBlock

type StatementBlock []Statement

statements

func (StatementBlock) CompareStatement

func (n StatementBlock) CompareStatement(b Statement) bool

type Symbol

type Symbol string

top level elements

type Text

type Text string

inlines

func (Text) CompareInline

func (n Text) CompareInline(b Inline) bool

type Type

type Type string

expressions

type UnaryOp

type UnaryOp struct {
	Operator UnaryOperator
	Arg      Expression
}

expressions

func (UnaryOp) CompareExpression

func (a UnaryOp) CompareExpression(b Expression) bool

type UnaryOperator

type UnaryOperator string

expressions

const (
	IncOp UnaryOperator = "inc"
	DecOp UnaryOperator = "dec"
	NotOp UnaryOperator = "not"
	NegOp UnaryOperator = "neg"
)

unary operators

Jump to

Keyboard shortcuts

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