package ini import ( "errors" "log" "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 (*Decoder) newErrInvalidToken(t *token) *lexer.Error { return newError(t.pos, t.value, "", errInvalidToken) } // parserOnError is the callback for lexer errors func (*Decoder) parserOnError(pos lexer.Position, content string, err error) error { log.Printf("%s: %s %s: %q: %v", "ini", pos, "error", content, err) return newError(pos, content, "", err) }