diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2020-09-15 18:05:35 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-09-15 19:34:30 +0200 |
| commit | 712de1c63d9db97c81af68cd0dc4372c53d2e57a (patch) | |
| tree | ae1761fec52c3ae4ddd003a4130ddbda8d0a2d69 /vendor/github.com/quasilyte/regex/syntax/errors.go | |
| parent | 298a69c38dd5c8a9bbd7a022e88f4ddbcf885e16 (diff) | |
vendor/github.com/golangci/golangci-lint: update to v1.31
Diffstat (limited to 'vendor/github.com/quasilyte/regex/syntax/errors.go')
| -rw-r--r-- | vendor/github.com/quasilyte/regex/syntax/errors.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/vendor/github.com/quasilyte/regex/syntax/errors.go b/vendor/github.com/quasilyte/regex/syntax/errors.go new file mode 100644 index 000000000..beefba5f9 --- /dev/null +++ b/vendor/github.com/quasilyte/regex/syntax/errors.go @@ -0,0 +1,27 @@ +package syntax + +type ParseError struct { + Pos Position + Message string +} + +func (e ParseError) Error() string { return e.Message } + +func throw(pos Position, message string) { + panic(ParseError{Pos: pos, Message: message}) +} + +func throwExpectedFound(pos Position, expected, found string) { + throw(pos, "expected '"+expected+"', found '"+found+"'") +} + +func throwUnexpectedToken(pos Position, token string) { + throw(pos, "unexpected token: "+token) +} + +func newPos(begin, end int) Position { + return Position{ + Begin: uint16(begin), + End: uint16(end), + } +} |
