package errors import "golox/token" type Logger interface { Error(line int, message string) ErrorAtToken(t token.Token, message string) RuntimeError(message string) } type mockErrorLogger struct { Errors []string RuntimeErrors []string } func (el *mockErrorLogger) Error(line int, message string) { el.Errors = append(el.Errors, message) } func (el *mockErrorLogger) ErrorAtToken(t token.Token, message string) { el.Errors = append(el.Errors, message) } func (el *mockErrorLogger) RuntimeError(message string) { el.RuntimeErrors = append(el.RuntimeErrors, message) } func NewMockErrorLogger() *mockErrorLogger { return &mockErrorLogger{[]string{}, []string{}} }