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
|
|
@ -36,7 +36,7 @@ func (i *Interpreter) VisitBinaryExpr(b *ast.BinaryExpr) any {
|
|||
areStrings := leftType == LoxTypeString &&
|
||||
rightType == LoxTypeString
|
||||
|
||||
switch b.Operator.Type {
|
||||
switch b.Op.Type {
|
||||
case lexer.TokenTypeMinus:
|
||||
if !areNumbers {
|
||||
// todo: error here
|
||||
|
|
@ -119,7 +119,7 @@ func (i *Interpreter) VisitLiteralExpr(g *ast.LiteralExpr) any {
|
|||
func (i *Interpreter) VisitUnaryExpr(g *ast.UnaryExpr) any {
|
||||
right := i.Evaluate(g.Right)
|
||||
|
||||
switch g.Operator.Type {
|
||||
switch g.Op.Type {
|
||||
case lexer.TokenTypeMinus:
|
||||
if right.Type() != LoxTypeNumber {
|
||||
// todo: error here
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue