workgroups/vendor/github.com/quasilyte/regex/syntax/errors.go
Marvin Preuss 1d4ae27878
All checks were successful
continuous-integration/drone/push Build is passing
ci: drone yaml with reusable anchors
2021-09-24 17:34:17 +02:00

28 lines
489 B
Go

package syntax
import (
"fmt"
)
type ParseError struct {
Pos Position
Message string
}
func (e ParseError) Error() string { return e.Message }
func throwfPos(pos Position, format string, args ...interface{}) {
panic(ParseError{
Pos: pos,
Message: fmt.Sprintf(format, args...),
})
}
func throwErrorf(posBegin, posEnd int, format string, args ...interface{}) {
pos := Position{
Begin: uint16(posBegin),
End: uint16(posEnd),
}
throwfPos(pos, format, args...)
}