tree

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MultiplicationBinaryOperator = iota
	DivisionBinaryOperator
	ModuloBinaryOperator
	AdditionBinaryOperator
	SubtractionBinaryOperator
	LessThanEqualsBinaryOperator
	GreaterThanEqualsBinaryOperator
	LessBinaryOperator
	GreaterBinaryOperator
	EqualsBinaryOperator
	NotEqualsBinaryOperator
	AndBinaryOperator
	OrBinaryOperator
	XorBinaryOperator

	AssignmentInPlaceOperator = iota
	MultiplicationInPlaceOperator
	DivisionInPlaceOperator
	ModuloInPlaceOperator
	AdditionInPlaceOperator
	SubtractionInPlaceOperator
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallStatement

type CallStatement struct {
	*FunctionCall
}

type Clause

type Clause struct {
	Condition  *Expression
	Statements []*Statement
}

type CommandStatement

type CommandStatement struct {
	Elements []*CommandStatementElement
}

type CommandStatementElement

type CommandStatementElement struct {
	Expression *Expression
	// contains filtered or unexported fields
}

type DeclareStatement

type DeclareStatement struct {
	VariableID string
	Value      *Expression
}

type Dialogue

type Dialogue struct {
	Nodes []Node
}

func FromFile

func FromFile(scriptPath string) (*Dialogue, error)

FromFile creates a dialogue tree by reading the file located at scriptPath.

func FromReader

func FromReader(reader io.Reader) (*Dialogue, error)

FromReader creates a dialogue tree by reading the content of reader.

func FromReaders

func FromReaders(readers ...io.Reader) (*Dialogue, error)

FromReaders creates a dialogue tree by reading the content of readers.

func (*Dialogue) FindNode

func (d *Dialogue) FindNode(title string) (*Node, bool)

type Expression

type Expression struct {
	Value                     *variable.Value
	VariableID                *string
	FunctionCall              *FunctionCall
	NegativeExpression        *Expression
	NotExpression             *Expression
	LeftOperand, RightOperand *Expression
	Operator                  *int
}

Expression represents something that can be evaluated to a YarnSpinner value when a Dialogue is run.

func NewStringExpression

func NewStringExpression(str string) *Expression

NewStringExpression creates a new expression holding a constant string.

type FunctionCall

type FunctionCall struct {
	FunctionID string
	Arguments  []*Expression
}

FunctionCall is used to represent the call of a function from a YarnSpinner script.

type IfStatement

type IfStatement struct {
	Clauses []*Clause
}

type JumpStatement

type JumpStatement struct {
	Expression *Expression
}

type LineFormattedText

type LineFormattedText struct {
	Elements []*LineFormattedTextElement
}

type LineFormattedTextElement

type LineFormattedTextElement struct {
	Text       string
	Expression *Expression
}

type LineStatement

type LineStatement struct {
	Text      *LineFormattedText
	Condition *Expression
}

type Node

type Node struct {
	Headers    map[string]string
	Statements []*Statement
}

func (*Node) Title

func (n *Node) Title() string

type SetStatement

type SetStatement struct {
	VariableID      string
	InPlaceOperator int
	Expression      *Expression
}

type ShortcutOption

type ShortcutOption struct {
	LineStatement *LineStatement
	Statements    []*Statement
}

type ShortcutOptionStatement

type ShortcutOptionStatement struct {
	Options []*ShortcutOption
}

type Statement

type Statement struct {
	LineStatement           *LineStatement
	ShortcutOptionStatement *ShortcutOptionStatement
	SetStatement            *SetStatement
	JumpStatement           *JumpStatement
	IfStatement             *IfStatement
	CommandStatement        *CommandStatement
	CallStatement           *CallStatement
	DeclareStatement        *DeclareStatement
}

Jump to

Keyboard shortcuts

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