mirror of
https://github.com/minio/minio.git
synced 2024-12-28 08:05:55 -05:00
2786055df4
- 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).
27 lines
607 B
Go
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)
|
|
}
|