package basic import ( "errors" "asciigoat.org/core/lexer" ) var ( errInvalidToken = errors.New("invalid token") ) func newError(pos lexer.Position, content, hint string, err error) *lexer.Error { return &lexer.Error{ Line: pos.Line, Column: pos.Column, Content: content, Hint: hint, Err: err, } } func newErrInvalidToken(t *token) *lexer.Error { return newError(t.pos, t.value, "", errInvalidToken) } func (dec *decoder) OnError(pos lexer.Position, content string, err error) error { err = newError(pos, content, "", err) dec.executeFinal() return err }