mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-19 05:56:20 +00:00
28 lines
489 B
Go
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...)
|
||
|
}
|