From 1bff92c52b27b9a516599e172fe9852c3d99be38 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 2 Apr 2024 11:27:13 +0200 Subject: chore: add linters and some lint fixes (#8) * chore: add linters and some lint fixes Configure some golangci-lint linters to get the code quality right. Apply the first fixes. Next step will be to add github actions to run lint and tests in github CI. * chore: more lint, fixed comments and variable names. no semantic change. * chore: add Makefile This makefile is intended to be used as a local substitute to github actions. --- parser/interpreter.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'parser/interpreter.go') diff --git a/parser/interpreter.go b/parser/interpreter.go index d820416..e6ac95c 100644 --- a/parser/interpreter.go +++ b/parser/interpreter.go @@ -9,15 +9,18 @@ import ( const debug = true +// Interpreter represents the state of an interpreter. type Interpreter struct { *Compiler *vm.Machine } +// NewInterpreter returns a new interpreter state. func NewInterpreter(s *scanner.Scanner) *Interpreter { return &Interpreter{NewCompiler(s), &vm.Machine{}} } +// Eval interprets a src program and return the last produced value if any, or an error. func (i *Interpreter) Eval(src string) (res reflect.Value, err error) { codeOffset := len(i.Code) dataOffset := 0 -- cgit v1.2.3