Documentation
¶
Index ¶
- func AcceptExpr[T any](expr Expr, v ExpressionVisitor) T
- func AcceptStmt[T any](stmt Statement, v StatementVisitor) T
- type Accessor
- type BinaryExpr
- type BlockStmt
- type CallExpr
- type DotAccessExpr
- type ExecStmt
- type Expr
- type ExpressionStmt
- type ExpressionVisitor
- type FieldAccessor
- type FunctionDeclarationStmt
- func (f FunctionDeclarationStmt) Accept(visitor StatementVisitor) any
- func (f FunctionDeclarationStmt) GetSourceLocation() interfaces.SourceLocation
- func (f FunctionDeclarationStmt) HasArg(arg string) bool
- func (f FunctionDeclarationStmt) ToString() string
- func (f FunctionDeclarationStmt) Type() NodeType
- type GroupingExpr
- type IfStmt
- type ImportStmt
- type IndexAccessor
- type ListExpr
- type LiteralExpr
- type LogicalExpr
- type Node
- type NodeType
- type ResolvedType
- type ReturnStmt
- type SetReturnFlagStmt
- type SliceExpr
- type Source
- type Statement
- type StatementVisitor
- type StructDeclarationStmt
- type UnaryExpr
- type VariableAssignmentStmt
- type VariableDeclarationStmt
- type VariableExpr
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AcceptExpr ¶
func AcceptExpr[T any](expr Expr, v ExpressionVisitor) T
func AcceptStmt ¶
func AcceptStmt[T any](stmt Statement, v StatementVisitor) T
Types ¶
type BinaryExpr ¶
type BinaryExpr struct { Left Expr Operator tokens.Token Right Expr ResolvedType }
func (*BinaryExpr) Accept ¶
func (b *BinaryExpr) Accept(v ExpressionVisitor) any
func (*BinaryExpr) GetSourceLocation ¶
func (b *BinaryExpr) GetSourceLocation() interfaces.SourceLocation
func (*BinaryExpr) ToString ¶
func (b *BinaryExpr) ToString() string
func (*BinaryExpr) Type ¶
func (b *BinaryExpr) Type() NodeType
type BlockStmt ¶
type BlockStmt struct { interfaces.SourceLocation Statements []Statement }
func (BlockStmt) Accept ¶
func (b BlockStmt) Accept(visitor StatementVisitor) any
func (BlockStmt) GetSourceLocation ¶
func (b BlockStmt) GetSourceLocation() interfaces.SourceLocation
type CallExpr ¶
type CallExpr struct { interfaces.SourceLocation Source Expr Arguments []Expr ResolvedType // contains filtered or unexported fields }
func (*CallExpr) Accept ¶
func (f *CallExpr) Accept(visitor ExpressionVisitor) any
func (*CallExpr) GetResolvedName ¶
func (*CallExpr) GetSourceLocation ¶
func (f *CallExpr) GetSourceLocation() interfaces.SourceLocation
func (*CallExpr) SetResolvedName ¶
type DotAccessExpr ¶
type DotAccessExpr struct { interfaces.SourceLocation Source Expr Name tokens.Token ResolvedType }
func (*DotAccessExpr) Accept ¶
func (v *DotAccessExpr) Accept(visitor ExpressionVisitor) any
func (*DotAccessExpr) GetSourceLocation ¶
func (v *DotAccessExpr) GetSourceLocation() interfaces.SourceLocation
func (*DotAccessExpr) ToString ¶
func (v *DotAccessExpr) ToString() string
func (*DotAccessExpr) Type ¶
func (v *DotAccessExpr) Type() NodeType
type ExecStmt ¶
type ExecStmt struct { SourceLocation interfaces.SourceLocation Expression Expr ResolvedType }
func (ExecStmt) Accept ¶
func (e ExecStmt) Accept(visitor StatementVisitor) any
func (ExecStmt) GetSourceLocation ¶
func (e ExecStmt) GetSourceLocation() interfaces.SourceLocation
type ExpressionStmt ¶
type ExpressionStmt struct {
Expression Expr
}
func (ExpressionStmt) Accept ¶
func (e ExpressionStmt) Accept(visitor StatementVisitor) any
func (ExpressionStmt) GetSourceLocation ¶
func (e ExpressionStmt) GetSourceLocation() interfaces.SourceLocation
func (ExpressionStmt) ToString ¶
func (e ExpressionStmt) ToString() string
func (ExpressionStmt) Type ¶
func (e ExpressionStmt) Type() NodeType
type ExpressionVisitor ¶
type ExpressionVisitor interface { VisitBinary(b *BinaryExpr) any VisitGrouping(g *GroupingExpr) any VisitLiteral(l *LiteralExpr) any VisitUnary(u *UnaryExpr) any VisitVariable(v *VariableExpr) any VisitDotAccess(v *DotAccessExpr) any VisitCall(f *CallExpr) any VisitLogical(l *LogicalExpr) any VisitSlice(s *SliceExpr) any VisitList(s *ListExpr) any }
type FieldAccessor ¶
FieldAccessor holds a parsed field name (foo.bar).
func (FieldAccessor) GetSourceLocation ¶
func (f FieldAccessor) GetSourceLocation() interfaces.SourceLocation
func (FieldAccessor) ToString ¶
func (f FieldAccessor) ToString() string
func (FieldAccessor) Type ¶
func (f FieldAccessor) Type() NodeType
type FunctionDeclarationStmt ¶
type FunctionDeclarationStmt struct { Name tokens.Token Parameters []VariableDeclarationStmt Body BlockStmt ReturnType types.ValueType Autogenerated bool }
func (FunctionDeclarationStmt) Accept ¶
func (f FunctionDeclarationStmt) Accept(visitor StatementVisitor) any
func (FunctionDeclarationStmt) GetSourceLocation ¶
func (f FunctionDeclarationStmt) GetSourceLocation() interfaces.SourceLocation
func (FunctionDeclarationStmt) HasArg ¶
func (f FunctionDeclarationStmt) HasArg(arg string) bool
func (FunctionDeclarationStmt) ToString ¶
func (f FunctionDeclarationStmt) ToString() string
func (FunctionDeclarationStmt) Type ¶
func (f FunctionDeclarationStmt) Type() NodeType
type GroupingExpr ¶
type GroupingExpr struct { Expression Expr ResolvedType }
func (*GroupingExpr) Accept ¶
func (g *GroupingExpr) Accept(v ExpressionVisitor) any
func (*GroupingExpr) GetSourceLocation ¶
func (g *GroupingExpr) GetSourceLocation() interfaces.SourceLocation
func (*GroupingExpr) ToString ¶
func (g *GroupingExpr) ToString() string
func (*GroupingExpr) Type ¶
func (g *GroupingExpr) Type() NodeType
type IfStmt ¶
func (IfStmt) Accept ¶
func (i IfStmt) Accept(visitor StatementVisitor) any
func (IfStmt) GetSourceLocation ¶
func (i IfStmt) GetSourceLocation() interfaces.SourceLocation
type ImportStmt ¶
type ImportStmt struct { interfaces.SourceLocation Path string SymbolNames map[string]tokens.Token }
func (ImportStmt) Accept ¶
func (i ImportStmt) Accept(visitor StatementVisitor) any
func (ImportStmt) GetSourceLocation ¶
func (i ImportStmt) GetSourceLocation() interfaces.SourceLocation
func (ImportStmt) ToString ¶
func (i ImportStmt) ToString() string
func (ImportStmt) Type ¶
func (i ImportStmt) Type() NodeType
type IndexAccessor ¶
type IndexAccessor struct {
Index Expr
}
IndexAccessor holds a parsed index expression (foo[expr]).
func (IndexAccessor) GetSourceLocation ¶
func (i IndexAccessor) GetSourceLocation() interfaces.SourceLocation
func (IndexAccessor) ToString ¶
func (i IndexAccessor) ToString() string
func (IndexAccessor) Type ¶
func (i IndexAccessor) Type() NodeType
type ListExpr ¶
type ListExpr struct { interfaces.SourceLocation Elements []Expr ValueType types.ValueType ResolvedType }
func (*ListExpr) Accept ¶
func (l *ListExpr) Accept(v ExpressionVisitor) any
func (*ListExpr) GetSourceLocation ¶
func (l *ListExpr) GetSourceLocation() interfaces.SourceLocation
type LiteralExpr ¶
type LiteralExpr struct { interfaces.SourceLocation Value nbt.Value ResolvedType }
func NewLiteralExpr ¶
func NewLiteralExpr(value nbt.Value, typ types.ValueType, source interfaces.SourceLocation) *LiteralExpr
func (*LiteralExpr) Accept ¶
func (l *LiteralExpr) Accept(v ExpressionVisitor) any
func (*LiteralExpr) GetSourceLocation ¶
func (l *LiteralExpr) GetSourceLocation() interfaces.SourceLocation
func (*LiteralExpr) ToString ¶
func (l *LiteralExpr) ToString() string
func (*LiteralExpr) Type ¶
func (l *LiteralExpr) Type() NodeType
type LogicalExpr ¶
type LogicalExpr struct { Left Expr Operator tokens.Token Right Expr ResolvedType }
func (*LogicalExpr) Accept ¶
func (l *LogicalExpr) Accept(v ExpressionVisitor) any
func (*LogicalExpr) GetSourceLocation ¶
func (l *LogicalExpr) GetSourceLocation() interfaces.SourceLocation
func (*LogicalExpr) ToString ¶
func (l *LogicalExpr) ToString() string
func (*LogicalExpr) Type ¶
func (l *LogicalExpr) Type() NodeType
type Node ¶
type Node interface { Type() NodeType GetSourceLocation() interfaces.SourceLocation }
type NodeType ¶
type NodeType string
const ( BinaryExpression NodeType = "BinaryExpression" GroupingExpression NodeType = "GroupingExpression" LiteralExpression NodeType = "LiteralExpression" UnaryExpression NodeType = "UnaryExpression" FieldAccessExpression NodeType = "FieldAccessExpression" VariableExpression NodeType = "VariableExpression" FunctionCallExpression NodeType = "FunctionCallExpression" LogicalExpression NodeType = "LogicalExpression" SliceExpression NodeType = "SliceExpression" ListExpression NodeType = "ListExpression" ExpressionStatement NodeType = "ExpressionStatement" VariableDeclarationStatement NodeType = "VariableDeclarationStatement" FunctionDeclarationStatement NodeType = "FunctionDeclarationStatement" StructDeclarationStatement NodeType = "StructDeclarationStatement" VariableAssignmentStatement NodeType = "VariableAssignmentStatement" BlockStatement NodeType = "BlockStatement" WhileStatement NodeType = "WhileStatement" IfStatement NodeType = "IfStatement" ReturnStatement NodeType = "ReturnStatement" SetReturnFlagStatement NodeType = "SetReturnFlagStatement" ImportStatement NodeType = "ImportStatement" ExecStatement NodeType = "ExecStatement" IndexAccessorType NodeType = "IndexAccessorType" FieldAccessorType NodeType = "FieldAccessorType" )
type ResolvedType ¶
type ResolvedType struct {
// contains filtered or unexported fields
}
func (*ResolvedType) GetResolvedType ¶
func (r *ResolvedType) GetResolvedType() types.ValueType
func (*ResolvedType) SetResolvedType ¶
func (r *ResolvedType) SetResolvedType(typ types.ValueType)
type ReturnStmt ¶
type ReturnStmt struct { interfaces.SourceLocation Expression Expr }
func (ReturnStmt) Accept ¶
func (s ReturnStmt) Accept(v StatementVisitor) any
func (ReturnStmt) GetSourceLocation ¶
func (s ReturnStmt) GetSourceLocation() interfaces.SourceLocation
func (ReturnStmt) ToString ¶
func (s ReturnStmt) ToString() string
func (ReturnStmt) Type ¶
func (s ReturnStmt) Type() NodeType
type SetReturnFlagStmt ¶
type SetReturnFlagStmt struct { }
func (SetReturnFlagStmt) Accept ¶
func (s SetReturnFlagStmt) Accept(v StatementVisitor) any
func (SetReturnFlagStmt) GetSourceLocation ¶
func (s SetReturnFlagStmt) GetSourceLocation() interfaces.SourceLocation
func (SetReturnFlagStmt) ToString ¶
func (s SetReturnFlagStmt) ToString() string
func (SetReturnFlagStmt) Type ¶
func (s SetReturnFlagStmt) Type() NodeType
type SliceExpr ¶
type SliceExpr struct { StartIndex Expr EndIndex Expr TargetExpr Expr interfaces.SourceLocation ResolvedType }
func (*SliceExpr) Accept ¶
func (s *SliceExpr) Accept(v ExpressionVisitor) any
func (*SliceExpr) GetSourceLocation ¶
func (s *SliceExpr) GetSourceLocation() interfaces.SourceLocation
type StatementVisitor ¶
type StatementVisitor interface { VisitExpression(ExpressionStmt) any VisitVariableDeclaration(VariableDeclarationStmt) any VisitFunctionDeclaration(FunctionDeclarationStmt) any VisitVariableAssignment(VariableAssignmentStmt) any VisitStructDeclaration(StructDeclarationStmt) any VisitBlock(BlockStmt) any VisitWhile(WhileStmt) any VisitIf(IfStmt) any VisitReturn(ReturnStmt) any VisitSetReturnFlag(SetReturnFlagStmt) any VisitImport(ImportStmt) any VisitExec(ExecStmt) any }
type StructDeclarationStmt ¶
type StructDeclarationStmt struct { Name tokens.Token StructType types.StructTypeStruct }
func (StructDeclarationStmt) Accept ¶
func (s StructDeclarationStmt) Accept(visitor StatementVisitor) any
func (StructDeclarationStmt) GetSourceLocation ¶
func (s StructDeclarationStmt) GetSourceLocation() interfaces.SourceLocation
func (StructDeclarationStmt) ToString ¶
func (s StructDeclarationStmt) ToString() string
func (StructDeclarationStmt) Type ¶
func (s StructDeclarationStmt) Type() NodeType
type UnaryExpr ¶
type UnaryExpr struct { Operator tokens.Token Expression Expr ResolvedType }
func (*UnaryExpr) Accept ¶
func (u *UnaryExpr) Accept(v ExpressionVisitor) any
func (*UnaryExpr) GetSourceLocation ¶
func (u *UnaryExpr) GetSourceLocation() interfaces.SourceLocation
func (*UnaryExpr) ReturnType ¶
type VariableAssignmentStmt ¶
func (VariableAssignmentStmt) Accept ¶
func (v VariableAssignmentStmt) Accept(visitor StatementVisitor) any
func (VariableAssignmentStmt) GetSourceLocation ¶
func (v VariableAssignmentStmt) GetSourceLocation() interfaces.SourceLocation
func (VariableAssignmentStmt) ToString ¶
func (v VariableAssignmentStmt) ToString() string
func (VariableAssignmentStmt) Type ¶
func (v VariableAssignmentStmt) Type() NodeType
type VariableDeclarationStmt ¶
type VariableDeclarationStmt struct { Name tokens.Token Initializer Expr ValueType types.ValueType }
func (VariableDeclarationStmt) Accept ¶
func (v VariableDeclarationStmt) Accept(visitor StatementVisitor) any
func (VariableDeclarationStmt) GetSourceLocation ¶
func (v VariableDeclarationStmt) GetSourceLocation() interfaces.SourceLocation
func (VariableDeclarationStmt) ToString ¶
func (v VariableDeclarationStmt) ToString() string
func (VariableDeclarationStmt) Type ¶
func (v VariableDeclarationStmt) Type() NodeType
type VariableExpr ¶
type VariableExpr struct { Name tokens.Token ResolvedType }
func (*VariableExpr) Accept ¶
func (v *VariableExpr) Accept(visitor ExpressionVisitor) any
func (*VariableExpr) GetSourceLocation ¶
func (v *VariableExpr) GetSourceLocation() interfaces.SourceLocation
func (*VariableExpr) ToString ¶
func (v *VariableExpr) ToString() string
func (*VariableExpr) Type ¶
func (v *VariableExpr) Type() NodeType
type WhileStmt ¶
func (WhileStmt) Accept ¶
func (w WhileStmt) Accept(v StatementVisitor) any
func (WhileStmt) GetSourceLocation ¶
func (w WhileStmt) GetSourceLocation() interfaces.SourceLocation
Source Files
¶
- binaryExpression.go
- blockStatement.go
- dotAccessExpression.go
- execStatement.go
- expressionStatement.go
- expressions.go
- functionDeclarationStatement.go
- functionExpression.go
- groupingExpression.go
- ifStatement.go
- importStatement.go
- listExpression.go
- literalExpression.go
- logicalExpression.go
- node.go
- returnStatement.go
- setReturnFlagStatement.go
- sliceExpression.go
- statements.go
- structDeclarationStatement.go
- unaryExpression.go
- variableAssignmentStatement.go
- variableDeclarationStatement.go
- variableExpression.go
- whileStatement.go
Click to show internal directories.
Click to hide internal directories.