ast

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionAssignment

type AdditionAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateAdditionAssignment

func CreateAdditionAssignment(r *Range, expression Node, value Node) *AdditionAssignment

func (*AdditionAssignment) Range

func (node *AdditionAssignment) Range() *Range

func (*AdditionAssignment) Type

func (node *AdditionAssignment) Type() NodeType

type AdditiveOperator

type AdditiveOperator int
const (
	AdditiveOperatorAddition AdditiveOperator = iota
	AdditiveOperatorSubtraction
)

func (AdditiveOperator) String

func (i AdditiveOperator) String() string

type AliasDeclaration

type AliasDeclaration struct {
	Exported   bool
	Identifier string
	Expression Node
	// contains filtered or unexported fields
}

func CreateAliasDeclaration

func CreateAliasDeclaration(r *Range, exported bool, identifier string, expression Node) *AliasDeclaration

func (*AliasDeclaration) Range

func (node *AliasDeclaration) Range() *Range

func (*AliasDeclaration) Type

func (node *AliasDeclaration) Type() NodeType

type Array

type Array struct {
	Elements []Node
	// contains filtered or unexported fields
}

func CreateArray

func CreateArray(r *Range, elements []Node) *Array

func (*Array) Range

func (node *Array) Range() *Range

func (*Array) Type

func (node *Array) Type() NodeType

type Assignment

type Assignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateAssignment

func CreateAssignment(r *Range, expression Node, value Node) *Assignment

func (*Assignment) Range

func (node *Assignment) Range() *Range

func (*Assignment) Type

func (node *Assignment) Type() NodeType

type Block

type Block struct {
	Statements []Node
	// contains filtered or unexported fields
}

func CreateBlock

func CreateBlock(r *Range, statements []Node) *Block

func (*Block) Range

func (node *Block) Range() *Range

func (*Block) Type

func (node *Block) Type() NodeType

type Boolean

type Boolean struct {
	Value string
	// contains filtered or unexported fields
}

func CreateBoolean

func CreateBoolean(r *Range, value string) *Boolean

func (*Boolean) Range

func (node *Boolean) Range() *Range

func (*Boolean) Type

func (node *Boolean) Type() NodeType

type BreakStatement

type BreakStatement struct {
	Value Node
	// contains filtered or unexported fields
}

func CreateBreakStatement

func CreateBreakStatement(r *Range) *BreakStatement

func (*BreakStatement) Range

func (node *BreakStatement) Range() *Range

func (*BreakStatement) Type

func (node *BreakStatement) Type() NodeType

type Comment

type Comment struct {
	Content string
	// contains filtered or unexported fields
}

func CreateComment

func CreateComment(r *Range, content string) *Comment

func (*Comment) Range

func (node *Comment) Range() *Range

func (*Comment) String

func (node *Comment) String() string

func (*Comment) Type

func (node *Comment) Type() NodeType

type Comparison

type Comparison struct {
	Operator ComparisonOperator
	Left     Node
	Right    Node
	// contains filtered or unexported fields
}

func CreateComparison

func CreateComparison(r *Range, operator ComparisonOperator, left Node, right Node) *Comparison

func (*Comparison) Range

func (node *Comparison) Range() *Range

func (*Comparison) Type

func (node *Comparison) Type() NodeType

type ComparisonOperator

type ComparisonOperator int
const (
	ComparisonOperatorEquals ComparisonOperator = iota
	ComparisonOperatorNotEquals
	ComparisonOperatorLessThan
	ComparisonOperatorLessThanOrEqual
	ComparisonOperatorGreaterThan
	ComparisonOperatorGreaterThanOrEqual
)

func (ComparisonOperator) String

func (i ComparisonOperator) String() string

type Decrement

type Decrement struct {
	Expression Node
	// contains filtered or unexported fields
}

func CreateDecrement

func CreateDecrement(r *Range, expression Node) *Decrement

func (*Decrement) Range

func (node *Decrement) Range() *Range

func (*Decrement) Type

func (node *Decrement) Type() NodeType

type DivisionAssignment

type DivisionAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateDivisionAssignment

func CreateDivisionAssignment(r *Range, expression Node, value Node) *DivisionAssignment

func (*DivisionAssignment) Range

func (node *DivisionAssignment) Range() *Range

func (*DivisionAssignment) Type

func (node *DivisionAssignment) Type() NodeType

type Equality

type Equality struct {
	Operator EqualityOperator
	Left     Node
	Right    Node
	// contains filtered or unexported fields
}

func CreateEquality

func CreateEquality(r *Range, operator EqualityOperator, left Node, right Node) *Equality

func (*Equality) Range

func (node *Equality) Range() *Range

func (*Equality) Type

func (node *Equality) Type() NodeType

type EqualityOperator

type EqualityOperator int
const (
	EqualityOperatorOr EqualityOperator = iota
	EqualityOperatorAnd
)

func (EqualityOperator) String

func (i EqualityOperator) String() string

type EvaluatedString

type EvaluatedString struct {
	Parts []Node
	// contains filtered or unexported fields
}

func CreateEvaluatedString

func CreateEvaluatedString(r *Range, parts []Node) *EvaluatedString

func (*EvaluatedString) Range

func (node *EvaluatedString) Range() *Range

func (*EvaluatedString) Type

func (node *EvaluatedString) Type() NodeType

type Factor

type Factor struct {
	Operator MultiplicativeOperator
	Left     Node
	Right    Node
	// contains filtered or unexported fields
}

func CreateFactor

func CreateFactor(r *Range, operator MultiplicativeOperator, left Node, right Node) *Factor

func (*Factor) Range

func (node *Factor) Range() *Range

func (*Factor) Type

func (node *Factor) Type() NodeType

type ForStatement

type ForStatement struct {
	Identifier *Identifier
	Expression Node
	Block      *Block
	// contains filtered or unexported fields
}

func CreateForStatement

func CreateForStatement(r *Range, identifier *Identifier, expression Node, block *Block) *ForStatement

func (*ForStatement) Range

func (node *ForStatement) Range() *Range

func (*ForStatement) Type

func (node *ForStatement) Type() NodeType

type FunctionDeclaration

type FunctionDeclaration struct {
	Exported   bool
	Identifier string
	Signature  *Signature
	Block      *Block
	// contains filtered or unexported fields
}

func CreateFunctionDeclaration

func CreateFunctionDeclaration(r *Range, exported bool, identifier string, signature *Signature, block *Block) *FunctionDeclaration

func (*FunctionDeclaration) Range

func (node *FunctionDeclaration) Range() *Range

func (*FunctionDeclaration) Type

func (node *FunctionDeclaration) Type() NodeType

type Identifier

type Identifier struct {
	Value string
	// contains filtered or unexported fields
}

func CreateIdentifier

func CreateIdentifier(r *Range, value string) *Identifier

func (*Identifier) Range

func (node *Identifier) Range() *Range

func (*Identifier) Type

func (node *Identifier) Type() NodeType

type IfStatement

type IfStatement struct {
	Expression     Node
	PositiveBranch Node
	// May be nil
	NegativeBranch Node
	// contains filtered or unexported fields
}

func CreateIfStatement

func CreateIfStatement(r *Range, expression Node, positiveBranch Node, negativeBranch Node) *IfStatement

func (*IfStatement) Range

func (node *IfStatement) Range() *Range

func (*IfStatement) Type

func (node *IfStatement) Type() NodeType

type ImportSelector

type ImportSelector struct {
	From       string
	Identifier string
	// contains filtered or unexported fields
}

func CreateImportSelector

func CreateImportSelector(r *Range, from string, identifier string) *ImportSelector

func (*ImportSelector) Range

func (node *ImportSelector) Range() *Range

func (*ImportSelector) Type

func (node *ImportSelector) Type() NodeType

type ImportsDeclaration

type ImportsDeclaration struct {
	Imports []*EvaluatedString
	// contains filtered or unexported fields
}

func CreateImportsDeclaration

func CreateImportsDeclaration(r *Range, imports []*EvaluatedString) *ImportsDeclaration

func (*ImportsDeclaration) Range

func (node *ImportsDeclaration) Range() *Range

func (*ImportsDeclaration) Type

func (node *ImportsDeclaration) Type() NodeType

type Increment

type Increment struct {
	Expression Node
	// contains filtered or unexported fields
}

func CreateIncrement

func CreateIncrement(r *Range, expression Node) *Increment

func (*Increment) Range

func (node *Increment) Range() *Range

func (*Increment) Type

func (node *Increment) Type() NodeType

type Index

type Index struct {
	Operand    Node
	Expression Node
	// contains filtered or unexported fields
}

func CreateIndex

func CreateIndex(r *Range, operand Node, expression Node) *Index

func (*Index) Range

func (node *Index) Range() *Range

func (*Index) Type

func (node *Index) Type() NodeType

type Integer

type Integer struct {
	Value string
	// contains filtered or unexported fields
}

func CreateInteger

func CreateInteger(r *Range, value string) *Integer

func (*Integer) Range

func (node *Integer) Range() *Range

func (*Integer) Type

func (node *Integer) Type() NodeType

type Invocation

type Invocation struct {
	Operand   Node
	Arguments []Node
	// contains filtered or unexported fields
}

func CreateInvocation

func CreateInvocation(r *Range, operand Node, arguments []Node) *Invocation

func (*Invocation) Range

func (node *Invocation) Range() *Range

func (*Invocation) Type

func (node *Invocation) Type() NodeType

type LooseAssignment

type LooseAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateLooseAssignment

func CreateLooseAssignment(r *Range, expression Node, value Node) *LooseAssignment

func (*LooseAssignment) Range

func (node *LooseAssignment) Range() *Range

func (*LooseAssignment) Type

func (node *LooseAssignment) Type() NodeType

type ModuloAssignment

type ModuloAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateModuloAssignment

func CreateModuloAssignment(r *Range, expression Node, value Node) *ModuloAssignment

func (*ModuloAssignment) Range

func (node *ModuloAssignment) Range() *Range

func (*ModuloAssignment) Type

func (node *ModuloAssignment) Type() NodeType

type MultiplicationAssignment

type MultiplicationAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateMultiplicationAssignment

func CreateMultiplicationAssignment(r *Range, expression Node, value Node) *MultiplicationAssignment

func (*MultiplicationAssignment) Range

func (node *MultiplicationAssignment) Range() *Range

func (*MultiplicationAssignment) Type

func (node *MultiplicationAssignment) Type() NodeType

type MultiplicativeOperator

type MultiplicativeOperator int
const (
	MultiplicativeOperatorMultiplication MultiplicativeOperator = iota
	MultiplicativeOperatorDivision
	MultiplicativeOperatorModulo
)

func (MultiplicativeOperator) String

func (i MultiplicativeOperator) String() string

type Node

type Node interface {
	Type() NodeType
	Range() *Range
}

type NodeType

type NodeType int
const (
	NodeTypeSourceFile NodeType = iota
	NodeTypePackageDeclaration
	NodeTypeImportsDeclaration
	NodeTypeComment
	NodeTypeInterpretedString
	NodeTypeRawString
	NodeTypeVariableDeclaration
	NodeTypeIdentifier
	NodeTypeInteger
	NodeTypeSignature
	NodeTypeFunctionDeclaration
	NodeTypeRuleFunctionDeclaration
	NodeTypeBlock
	NodeTypeSelector
	NodeTypeImportSelector
	NodeTypeIndex
	NodeTypeInvocation
	NodeTypeIncrement
	NodeTypeDecrement
	NodeTypeLooseAssignment
	NodeTypeAdditionAssignment
	NodeTypeSubtractionAssignment
	NodeTypeMultiplicationAssignment
	NodeTypeDivisionAssignment
	NodeTypeShellStatement
	NodeTypeAssignment
	NodeTypeComparison
	NodeTypeEquality
	NodeTypeFactor
	NodeTypePrimary
	NodeTypeTerm
	NodeTypeUnary
	NodeTypeAliasDeclaration
	NodeTypeRuleDeclaration
	NodeTypeReturnStatement
	NodeTypeIfStatement
	NodeTypeEvaluatedString
	NodeTypeStringPart
	NodeTypeForStatement
	NodeTypeModuloAssignment
	NodeTypeObject
	NodeTypeBreakStatement
)

func (NodeType) String

func (i NodeType) String() string

type Object

type Object struct {
	Pairs map[*Identifier]Node
	// contains filtered or unexported fields
}

func CreateObject

func CreateObject(r *Range, pairs map[*Identifier]Node) *Object

func (*Object) Range

func (node *Object) Range() *Range

func (*Object) Type

func (node *Object) Type() NodeType

type PackageDeclaration

type PackageDeclaration struct {
	Identifier string
	// contains filtered or unexported fields
}

func CreatePackageDeclaration

func CreatePackageDeclaration(r *Range, identifier string) *PackageDeclaration

func (*PackageDeclaration) Range

func (node *PackageDeclaration) Range() *Range

func (*PackageDeclaration) Type

func (node *PackageDeclaration) Type() NodeType

type Position

type Position struct {
	// Line is the zero-based line number
	Line int
	// Character is the zero-based unicode character index
	Character int
	// Offset is the offset from the start of the text, in bytes
	Offset int
}

Position describes a position in a text

func (Position) String

func (p Position) String() string

type Primary

type Primary struct {
	Operand Node
	// contains filtered or unexported fields
}

func CreatePrimary

func CreatePrimary(r *Range, operator PrimaryOperator, operand Node) *Primary

func (*Primary) Range

func (node *Primary) Range() *Range

func (*Primary) Type

func (node *Primary) Type() NodeType

type PrimaryOperator

type PrimaryOperator int

type Range

type Range struct {
	// Start is the inclusive start of the range
	Start Position
	// End is the inclusive end of the range
	End Position
}

Range describes a range of a text

func CreateRange

func CreateRange(start Position, end Position) *Range

func (Range) String

func (r Range) String() string

type RawString

type RawString struct {
	Content string
	// contains filtered or unexported fields
}

func CreateRawString

func CreateRawString(r *Range, content string) *RawString

func (*RawString) Range

func (node *RawString) Range() *Range

func (*RawString) String

func (node *RawString) String() string

func (*RawString) Type

func (node *RawString) Type() NodeType

type ReturnStatement

type ReturnStatement struct {
	Value Node
	// contains filtered or unexported fields
}

func CreateReturnStatement

func CreateReturnStatement(r *Range, value Node) *ReturnStatement

func (*ReturnStatement) Range

func (node *ReturnStatement) Range() *Range

func (*ReturnStatement) Type

func (node *ReturnStatement) Type() NodeType

type RuleDeclaration

type RuleDeclaration struct {
	Outputs      []Node
	Dependencies []Node
	// May be nil
	Derived Node
	// May be nil if Derived is not nil
	Block *Block
	// contains filtered or unexported fields
}

func CreateRuleDeclaration

func CreateRuleDeclaration(r *Range, outputs []Node, dependencies []Node, derived Node, block *Block) *RuleDeclaration

func (*RuleDeclaration) Range

func (node *RuleDeclaration) Range() *Range

func (*RuleDeclaration) Type

func (node *RuleDeclaration) Type() NodeType

type RuleFunctionDeclaration

type RuleFunctionDeclaration struct {
	Exported   bool
	Identifier string
	// Signature may be nil
	Signature *Signature
	Block     *Block
	// contains filtered or unexported fields
}

func CreateRuleFunctionDeclaration

func CreateRuleFunctionDeclaration(r *Range, exported bool, identifier string, signature *Signature, block *Block) *RuleFunctionDeclaration

func (*RuleFunctionDeclaration) Range

func (node *RuleFunctionDeclaration) Range() *Range

func (*RuleFunctionDeclaration) Type

func (node *RuleFunctionDeclaration) Type() NodeType

type Selector

type Selector struct {
	Operand    Node
	Identifier string
	// contains filtered or unexported fields
}

func CreateSelector

func CreateSelector(r *Range, operand Node, identifier string) *Selector

func (*Selector) Range

func (node *Selector) Range() *Range

func (*Selector) Type

func (node *Selector) Type() NodeType

type ShellStatement

type ShellStatement struct {
	Multiline bool
	Parts     []Node
	// contains filtered or unexported fields
}

func CreateShellStatement

func CreateShellStatement(r *Range, multiline bool, parts []Node) *ShellStatement

func (*ShellStatement) Range

func (node *ShellStatement) Range() *Range

func (*ShellStatement) Type

func (node *ShellStatement) Type() NodeType

type Signature

type Signature struct {
	Arguments []*Identifier
	// contains filtered or unexported fields
}

func CreateSignature

func CreateSignature(r *Range, arguments []*Identifier) *Signature

func (*Signature) Range

func (node *Signature) Range() *Range

func (*Signature) Type

func (node *Signature) Type() NodeType

type StringPart

type StringPart struct {
	Content string
	// contains filtered or unexported fields
}

func CreateStringPart

func CreateStringPart(r *Range, content string) *StringPart

func (*StringPart) Range

func (node *StringPart) Range() *Range

func (*StringPart) Type

func (node *StringPart) Type() NodeType

type SubtractionAssignment

type SubtractionAssignment struct {
	Expression Node
	Value      Node
	// contains filtered or unexported fields
}

func CreateSubtractionAssignment

func CreateSubtractionAssignment(r *Range, expression Node, value Node) *SubtractionAssignment

func (*SubtractionAssignment) Range

func (node *SubtractionAssignment) Range() *Range

func (*SubtractionAssignment) Type

func (node *SubtractionAssignment) Type() NodeType

type Term

type Term struct {
	Operator AdditiveOperator
	Left     Node
	Right    Node
	// contains filtered or unexported fields
}

func CreateTerm

func CreateTerm(r *Range, operator AdditiveOperator, left Node, right Node) *Term

func (*Term) Range

func (node *Term) Range() *Range

func (*Term) Type

func (node *Term) Type() NodeType

type TreeError

type TreeError struct {
	Message string
	Range   *Range
}

func CreateTreeError

func CreateTreeError(r *Range, format string, args ...interface{}) *TreeError

func (*TreeError) Error

func (parseError *TreeError) Error() string

func (*TreeError) ErrorWithLine

func (parseError *TreeError) ErrorWithLine(input string) string

type Unary

type Unary struct {
	Operator UnaryOperator
	Primary  Node
	// contains filtered or unexported fields
}

func CreateUnary

func CreateUnary(r *Range, operator UnaryOperator, primary Node) *Unary

func (*Unary) Range

func (node *Unary) Range() *Range

func (*Unary) Type

func (node *Unary) Type() NodeType

type UnaryOperator

type UnaryOperator int
const (
	UnaryOperatorSubtraction UnaryOperator = iota
	UnaryOperatorNot
	UnaryOperatorSpread
)

func (UnaryOperator) String

func (i UnaryOperator) String() string

type VariableDeclaration

type VariableDeclaration struct {
	Identifier string
	Expression Node
	// contains filtered or unexported fields
}

func CreateVariableDeclaration

func CreateVariableDeclaration(r *Range, identifier string, expression Node) *VariableDeclaration

func (*VariableDeclaration) Range

func (node *VariableDeclaration) Range() *Range

func (*VariableDeclaration) Type

func (node *VariableDeclaration) Type() NodeType

Jump to

Keyboard shortcuts

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