wrote dsl for ast boiler plate generation
This commit is contained in:
parent
b244f7e3b2
commit
e0dd8ff9d5
16 changed files with 915 additions and 60 deletions
62
ast/expr.go
Normal file
62
ast/expr.go
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
package ast
|
||||
|
||||
// THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT MANUALLY EDIT
|
||||
|
||||
import "git.red-panda.pet/pandaware/lox-go/lexer"
|
||||
|
||||
type ExprVisitor interface {
|
||||
VisitBinaryExpr(v *BinaryExpr) any
|
||||
VisitGroupingExpr(v *GroupingExpr) any
|
||||
VisitLiteralExpr(v *LiteralExpr) any
|
||||
VisitUnaryExpr(v *UnaryExpr) any
|
||||
}
|
||||
|
||||
type Expr interface {
|
||||
Accept(v ExprVisitor) any
|
||||
}
|
||||
|
||||
type BinaryExpr struct {
|
||||
Left Expr
|
||||
|
||||
Op *lexer.Token
|
||||
|
||||
Right Expr
|
||||
}
|
||||
|
||||
func (n *BinaryExpr) Accept(v ExprVisitor) any {
|
||||
return v.VisitBinaryExpr(n)
|
||||
}
|
||||
|
||||
var _ Expr = new(BinaryExpr)
|
||||
|
||||
type GroupingExpr struct {
|
||||
Expr Expr
|
||||
}
|
||||
|
||||
func (n *GroupingExpr) Accept(v ExprVisitor) any {
|
||||
return v.VisitGroupingExpr(n)
|
||||
}
|
||||
|
||||
var _ Expr = new(GroupingExpr)
|
||||
|
||||
type LiteralExpr struct {
|
||||
Value any
|
||||
}
|
||||
|
||||
func (n *LiteralExpr) Accept(v ExprVisitor) any {
|
||||
return v.VisitLiteralExpr(n)
|
||||
}
|
||||
|
||||
var _ Expr = new(LiteralExpr)
|
||||
|
||||
type UnaryExpr struct {
|
||||
Op *lexer.Token
|
||||
|
||||
Right Expr
|
||||
}
|
||||
|
||||
func (n *UnaryExpr) Accept(v ExprVisitor) any {
|
||||
return v.VisitUnaryExpr(n)
|
||||
}
|
||||
|
||||
var _ Expr = new(UnaryExpr)
|
||||
Loading…
Add table
Add a link
Reference in a new issue