umx_compiler

UMX virtual machine "Monkey" interpreter / bytecode compiler
git clone git://bsandro.tech/umx_compiler
Log | Files | Refs

commit ec7026cf5c8286da007b17f2dda38a32050fbb14
parent 45420a626bbd8fa777c8cadbb7b24646db156a58
Author: bsandro <email@bsandro.tech>
Date:   Mon, 13 Jun 2022 23:22:04 +0300

go fmt

Diffstat:
Mast/ast.go | 5+++--
Mparser/parser.go | 2+-
Mparser/parser_test.go | 6+++---
3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/ast/ast.go b/ast/ast.go @@ -21,10 +21,11 @@ type Expression interface { } type PrefixExpression struct { - Token token.Token + Token token.Token Operator string - Right Expression + Right Expression } + func (pe *PrefixExpression) expressionNode() {} func (pe *PrefixExpression) TokenLiteral() string { return pe.Token.Literal diff --git a/parser/parser.go b/parser/parser.go @@ -184,7 +184,7 @@ func (p *Parser) noPrefixParseFnError(t token.TokenType) { func (p *Parser) parsePrefixExpression() ast.Expression { expression := &ast.PrefixExpression{ - Token: p.curToken, + Token: p.curToken, Operator: p.curToken.Literal, } p.nextToken() diff --git a/parser/parser_test.go b/parser/parser_test.go @@ -1,10 +1,10 @@ package parser import ( + "fmt" "interp/ast" "interp/lexer" "testing" - "fmt" ) func TestLetStatements(t *testing.T) { @@ -168,8 +168,8 @@ func TestIntegerLiteralExpression(t *testing.T) { } func TestParsingPrefixExpressions(t *testing.T) { - prefixTests := []struct{ - input string + prefixTests := []struct { + input string operator string intValue int64 }{