Documentation
¶
Index ¶
- type Accessor
- type BlockStmt
- type ExpressionStmt
- type FieldAccessor
- type FunctionDeclarationStmt
- type IfStmt
- type IndexAccessor
- type ReturnStmt
- type ScoreStmt
- type SetReturnFlagStmt
- type Stmt
- type StmtType
- type StmtVisitor
- type StructDeclarationStmt
- type VarDef
- type VariableAssignmentStmt
- type VariableDeclarationStmt
- type WhileStmt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Accessor ¶ added in v0.0.8
type Accessor interface {
ToString() string
}
Accessor is one step in an L-value chain: either [expr] or .field
type BlockStmt ¶
func (BlockStmt) Accept ¶
func (b BlockStmt) Accept(visitor StmtVisitor) interfaces.IRCode
type ExpressionStmt ¶
type ExpressionStmt struct {
Stmt
Expression expressions.Expr
}
func (ExpressionStmt) Accept ¶
func (e ExpressionStmt) Accept(visitor StmtVisitor) interfaces.IRCode
func (ExpressionStmt) StmtType ¶ added in v0.0.8
func (e ExpressionStmt) StmtType() StmtType
func (ExpressionStmt) ToString ¶ added in v0.1.0
func (e ExpressionStmt) ToString() string
type FieldAccessor ¶ added in v0.0.8
FieldAccessor holds a parsed field name (foo.bar).
func (FieldAccessor) ToString ¶ added in v0.0.14
func (f FieldAccessor) ToString() string
type FunctionDeclarationStmt ¶
type FunctionDeclarationStmt struct {
Stmt
Name tokens.Token
Parameters []interfaces.TypedIdentifier
ReturnType types.ValueType
Body BlockStmt
Autogenerated bool
}
func (FunctionDeclarationStmt) Accept ¶
func (f FunctionDeclarationStmt) Accept(visitor StmtVisitor) interfaces.IRCode
func (FunctionDeclarationStmt) HasArg ¶
func (f FunctionDeclarationStmt) HasArg(arg string) bool
func (FunctionDeclarationStmt) StmtType ¶ added in v0.0.8
func (f FunctionDeclarationStmt) StmtType() StmtType
func (FunctionDeclarationStmt) ToString ¶ added in v0.1.0
func (f FunctionDeclarationStmt) ToString() string
type IfStmt ¶
type IfStmt struct {
Stmt
Condition expressions.Expr
ThenBranch BlockStmt
ElseBranch *BlockStmt
}
func (IfStmt) Accept ¶
func (i IfStmt) Accept(visitor StmtVisitor) interfaces.IRCode
type IndexAccessor ¶ added in v0.0.8
type IndexAccessor struct {
Index expressions.Expr
}
IndexAccessor holds a parsed index expression (foo[expr]).
func (IndexAccessor) ToString ¶ added in v0.0.14
func (i IndexAccessor) ToString() string
type ReturnStmt ¶
type ReturnStmt struct {
Stmt
Expression expressions.Expr
}
func (ReturnStmt) Accept ¶
func (s ReturnStmt) Accept(v StmtVisitor) interfaces.IRCode
func (ReturnStmt) StmtType ¶ added in v0.0.8
func (s ReturnStmt) StmtType() StmtType
func (ReturnStmt) ToString ¶ added in v0.1.0
func (s ReturnStmt) ToString() string
type ScoreStmt ¶ added in v0.1.0
func (ScoreStmt) Accept ¶ added in v0.1.0
func (s ScoreStmt) Accept(visitor StmtVisitor) interfaces.IRCode
type SetReturnFlagStmt ¶ added in v0.1.0
type SetReturnFlagStmt struct {
Stmt
}
func (SetReturnFlagStmt) Accept ¶ added in v0.1.0
func (s SetReturnFlagStmt) Accept(v StmtVisitor) interfaces.IRCode
func (SetReturnFlagStmt) StmtType ¶ added in v0.1.0
func (s SetReturnFlagStmt) StmtType() StmtType
func (SetReturnFlagStmt) ToString ¶ added in v0.1.0
func (s SetReturnFlagStmt) ToString() string
type Stmt ¶
type Stmt interface {
Accept(StmtVisitor) interfaces.IRCode
StmtType() StmtType
ToString() string
}
type StmtType ¶
type StmtType string
const ( ExpressionStmtType StmtType = "Expression" VariableDeclarationStmtType StmtType = "VariableDeclaration" FunctionDeclarationStmtType StmtType = "FunctionDeclaration" StructDeclarationStmtType StmtType = "StructDeclaration" VariableAssignmentStmtType StmtType = "VariableAssignment" BlockStmtType StmtType = "Block" WhileStmtType StmtType = "While" IfStmtType StmtType = "If" ReturnStmtType StmtType = "Return" ScoreStmtType StmtType = "Score" SetReturnFlagStmtType StmtType = "SetReturnFlag" )
type StmtVisitor ¶
type StmtVisitor interface {
VisitExpression(ExpressionStmt) interfaces.IRCode
VisitVariableDeclaration(VariableDeclarationStmt) interfaces.IRCode
VisitFunctionDeclaration(FunctionDeclarationStmt) interfaces.IRCode
VisitVariableAssignment(VariableAssignmentStmt) interfaces.IRCode
VisitStructDeclaration(StructDeclarationStmt) interfaces.IRCode
VisitBlock(BlockStmt) interfaces.IRCode
VisitWhile(WhileStmt) interfaces.IRCode
VisitIf(IfStmt) interfaces.IRCode
VisitReturn(ReturnStmt) interfaces.IRCode
VisitScore(ScoreStmt) interfaces.IRCode
VisitSetReturnFlag(SetReturnFlagStmt) interfaces.IRCode
}
type StructDeclarationStmt ¶ added in v0.0.8
type StructDeclarationStmt struct {
Stmt
Name tokens.Token
StructType types.StructTypeStruct
}
func (StructDeclarationStmt) Accept ¶ added in v0.0.8
func (s StructDeclarationStmt) Accept(visitor StmtVisitor) interfaces.IRCode
func (StructDeclarationStmt) StmtType ¶ added in v0.0.8
func (s StructDeclarationStmt) StmtType() StmtType
func (StructDeclarationStmt) ToString ¶ added in v0.1.0
func (s StructDeclarationStmt) ToString() string
type VariableAssignmentStmt ¶
type VariableAssignmentStmt struct {
Stmt
Name tokens.Token
Accessors []Accessor
Value expressions.Expr
}
func (VariableAssignmentStmt) Accept ¶
func (v VariableAssignmentStmt) Accept(visitor StmtVisitor) interfaces.IRCode
func (VariableAssignmentStmt) StmtType ¶ added in v0.0.8
func (v VariableAssignmentStmt) StmtType() StmtType
func (VariableAssignmentStmt) ToString ¶ added in v0.1.0
func (v VariableAssignmentStmt) ToString() string
type VariableDeclarationStmt ¶
type VariableDeclarationStmt struct {
Stmt
Name tokens.Token
Type types.ValueType
Initializer expressions.Expr
}
func (VariableDeclarationStmt) Accept ¶
func (v VariableDeclarationStmt) Accept(visitor StmtVisitor) interfaces.IRCode
func (VariableDeclarationStmt) StmtType ¶ added in v0.0.8
func (v VariableDeclarationStmt) StmtType() StmtType
func (VariableDeclarationStmt) ToString ¶ added in v0.1.0
func (v VariableDeclarationStmt) ToString() string
type WhileStmt ¶
type WhileStmt struct {
Stmt
Condition expressions.Expr
Body BlockStmt
}
func (WhileStmt) Accept ¶
func (w WhileStmt) Accept(v StmtVisitor) interfaces.IRCode
Click to show internal directories.
Click to hide internal directories.