woodpecker/vendor/github.com/quasilyte/regex/syntax/errors.go
Lukas c28f7cb29f
Add golangci-lint (#502)
Initial part of #435
2021-11-14 21:01:54 +01:00

27 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...)
}