summaryrefslogtreecommitdiff
path: root/vendor/github.com/tdewolff/parse/v2/error.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-07-19 15:21:17 +0200
committerLibravatar GitHub <noreply@github.com>2022-07-19 15:21:17 +0200
commitc84384e6608368a13a774d6d33a8cc32da7cf209 (patch)
treea18aa9c1ced1299d2682c1993e1ba38f46448dba /vendor/github.com/tdewolff/parse/v2/error.go
parent[chore] use our own logging implementation (#716) (diff)
downloadgotosocial-c84384e6608368a13a774d6d33a8cc32da7cf209.tar.xz
[bugfix] html escape special characters in text instead of totally removing them (#719)
* remove minify dependency * tidy up some tests * remove pre + postformat funcs * rework sanitization + formatting * update tests * add some more markdown tests
Diffstat (limited to 'vendor/github.com/tdewolff/parse/v2/error.go')
-rw-r--r--vendor/github.com/tdewolff/parse/v2/error.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/vendor/github.com/tdewolff/parse/v2/error.go b/vendor/github.com/tdewolff/parse/v2/error.go
deleted file mode 100644
index f6657f711..000000000
--- a/vendor/github.com/tdewolff/parse/v2/error.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package parse
-
-import (
- "bytes"
- "fmt"
- "io"
-)
-
-// 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
- Column int
- Context string
-}
-
-// NewError creates a new error
-func NewError(r io.Reader, offset int, message string, a ...interface{}) *Error {
- line, column, context := Position(r, offset)
- if 0 < len(a) {
- message = fmt.Sprintf(message, a...)
- }
- return &Error{
- Message: message,
- Line: line,
- Column: column,
- Context: context,
- }
-}
-
-// NewErrorLexer creates a new error from an active Lexer.
-func NewErrorLexer(l *Input, message string, a ...interface{}) *Error {
- r := bytes.NewBuffer(l.Bytes())
- offset := l.Offset()
- return NewError(r, offset, message, a...)
-}
-
-// Position returns 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) {
- return e.Line, e.Column, e.Context
-}
-
-// Error returns the error string, containing the context and line + column number.
-func (e *Error) Error() string {
- return fmt.Sprintf("%s on line %d and column %d\n%s", e.Message, e.Line, e.Column, e.Context)
-}