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
|
|
@ -12,7 +12,7 @@ type Printer struct {
|
|||
var _ ExprVisitor = new(Printer)
|
||||
|
||||
func (p *Printer) VisitBinaryExpr(b *BinaryExpr) any {
|
||||
return p.Parenthesize(b.Operator.Lexeme, b.Left, b.Right)
|
||||
return p.Parenthesize(b.Op.Lexeme, b.Left, b.Right)
|
||||
}
|
||||
|
||||
func (p *Printer) VisitGroupingExpr(g *GroupingExpr) any {
|
||||
|
|
@ -38,7 +38,7 @@ func (p *Printer) VisitLiteralExpr(g *LiteralExpr) any {
|
|||
}
|
||||
|
||||
func (p *Printer) VisitUnaryExpr(g *UnaryExpr) any {
|
||||
return p.Parenthesize(g.Operator.Lexeme, g.Right)
|
||||
return p.Parenthesize(g.Op.Lexeme, g.Right)
|
||||
}
|
||||
|
||||
func (p *Printer) Parenthesize(name string, expressions ...Expr) string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue