mirror of
https://github.com/miniflux/v2.git
synced 2025-07-27 17:28:38 +00:00
Add FeedIcon API call and update dependencies
This commit is contained in:
parent
231ebf2daa
commit
27196589fb
262 changed files with 83830 additions and 30061 deletions
34
vendor/github.com/tdewolff/parse/error.go
generated
vendored
34
vendor/github.com/tdewolff/parse/error.go
generated
vendored
|
@ -7,29 +7,43 @@ import (
|
|||
"github.com/tdewolff/parse/buffer"
|
||||
)
|
||||
|
||||
// Error is a parsing error returned by parser. It contains a message and an offset at which the error occurred.
|
||||
type Error struct {
|
||||
Message string
|
||||
Line int
|
||||
Col int
|
||||
Context string
|
||||
r io.Reader
|
||||
Offset int
|
||||
line int
|
||||
column int
|
||||
context string
|
||||
}
|
||||
|
||||
// NewError creates a new error
|
||||
func NewError(msg string, r io.Reader, offset int) *Error {
|
||||
line, col, context, _ := Position(r, offset)
|
||||
return &Error{
|
||||
msg,
|
||||
line,
|
||||
col,
|
||||
context,
|
||||
Message: msg,
|
||||
r: r,
|
||||
Offset: offset,
|
||||
}
|
||||
}
|
||||
|
||||
// NewErrorLexer creates a new error from a *buffer.Lexer
|
||||
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)
|
||||
// Positions re-parses the file to determine the line, column, and context of the error.
|
||||
// Context is the entire line at which the error occurred.
|
||||
func (e *Error) Position() (int, int, string) {
|
||||
if e.line == 0 {
|
||||
e.line, e.column, e.context, _ = Position(e.r, e.Offset)
|
||||
}
|
||||
return e.line, e.column, e.context
|
||||
}
|
||||
|
||||
// Error returns the error string, containing the context and line + column number.
|
||||
func (e *Error) Error() string {
|
||||
line, column, context := e.Position()
|
||||
return fmt.Sprintf("parse error:%d:%d: %s\n%s", line, column, e.Message, context)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue