Merge pull request #100 from shmel1k/feature/addnonfatal

Added AddNonFatalError func
This commit is contained in:
Victor Starodub
2017-01-31 18:07:56 +04:00
committed by GitHub
+8
View File
@@ -1026,6 +1026,14 @@ func (r *Lexer) AddError(e error) {
}
}
func (r *Lexer) AddNonFatalError(e error) {
r.addNonfatalError(&LexerError{
Offset: r.start,
Data: string(r.Data[r.start:r.pos]),
Reason: e.Error(),
})
}
func (r *Lexer) addNonfatalError(err *LexerError) {
if r.UseMultipleErrors {
// We don't want to add errors with the same offset.