minio/vendor/github.com/alecthomas/participle/lexer/errors.go
Aditya Manthramurthy 2786055df4 Add new SQL parser to support S3 Select syntax (#7102)
- New parser written from scratch, allows easier and complete parsing
  of the full S3 Select SQL syntax. Parser definition is directly
  provided by the AST defined for the SQL grammar.

- Bring support to parse and interpret SQL involving JSON path
  expressions; evaluation of JSON path expressions will be
  subsequently added.

- Bring automatic type inference and conversion for untyped
  values (e.g. CSV data).
2019-01-28 17:59:48 -08:00

27 lines
607 B
Go

package lexer
import "fmt"
// Error represents an error while parsing.
type Error struct {
Message string
Pos Position
}
// Errorf creats a new Error at the given position.
func Errorf(pos Position, format string, args ...interface{}) *Error {
return &Error{
Message: fmt.Sprintf(format, args...),
Pos: pos,
}
}
// Error complies with the error interface and reports the position of an error.
func (e *Error) Error() string {
filename := e.Pos.Filename
if filename == "" {
filename = "<source>"
}
return fmt.Sprintf("%s:%d:%d: %s", filename, e.Pos.Line, e.Pos.Column, e.Message)
}