1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-27 17:28:38 +00:00

First commit

This commit is contained in:
Frédéric Guillot 2017-11-19 21:10:04 -08:00
commit 8ffb773f43
2121 changed files with 1118910 additions and 0 deletions

35
vendor/github.com/tdewolff/parse/error.go generated vendored Normal file
View file

@ -0,0 +1,35 @@
package parse
import (
"fmt"
"io"
"github.com/tdewolff/parse/buffer"
)
type Error struct {
Message string
Line int
Col int
Context string
}
func NewError(msg string, r io.Reader, offset int) *Error {
line, col, context, _ := Position(r, offset)
return &Error{
msg,
line,
col,
context,
}
}
func NewErrorLexer(msg string, l *buffer.Lexer) *Error {
r := buffer.NewReader(l.Bytes())
offset := l.Offset()
return NewError(msg, r, offset)
}
func (e *Error) Error() string {
return fmt.Sprintf("parse error:%d:%d: %s\n%s", e.Line, e.Col, e.Message, e.Context)
}