@@ -48,3 +48,15 @@ func newErrIncomplete(p *TextParser, hint string) *lexer.Error {
|
||||
|
||||
return NewError(pos, s, hint, fs.ErrInvalid)
|
||||
}
|
||||
|
||||
// NewErrInvalidEscapeSequence returns a [lexer.Error] indicating
|
||||
// the specified sequence, at the end of the accepted buffer,
|
||||
// is invalid
|
||||
func NewErrInvalidEscapeSequence(p *TextParser, seq string) *lexer.Error {
|
||||
pos, s := p.Position(), p.String()
|
||||
|
||||
s = s[:len(s)-len(seq)]
|
||||
pos.Add(GetPositionalLength(s))
|
||||
|
||||
return NewError(pos, seq, "invalid escape character", fs.ErrInvalid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user