mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
21 lines
305 B
Go
21 lines
305 B
Go
package expr
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
type syntaxError struct {
|
|
message string
|
|
input string
|
|
pos int
|
|
}
|
|
|
|
func (e *syntaxError) Error() string {
|
|
snippet := ""
|
|
if len(e.input) > 0 {
|
|
snippet = fmt.Sprintf("\n%s\n%s", e.input, strings.Repeat("-", e.pos)+"^")
|
|
}
|
|
return e.message + snippet
|
|
}
|