mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-12 11:36:29 +00:00
c28f7cb29f
Initial part of #435
27 lines
489 B
Go
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...)
|
|
}
|