|
|
|
@ -4,6 +4,7 @@ import (
|
|
|
|
|
"errors" |
|
|
|
|
|
|
|
|
|
"asciigoat.org/core/lexer" |
|
|
|
|
"asciigoat.org/ini/parser" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
var ( |
|
|
|
@ -11,23 +12,11 @@ var (
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func newErrInvalidToken(t *token) *lexer.Error { |
|
|
|
|
err := &lexer.Error{ |
|
|
|
|
Line: t.pos.Line, |
|
|
|
|
Column: t.pos.Column, |
|
|
|
|
Content: t.value, |
|
|
|
|
Err: errInvalidToken, |
|
|
|
|
} |
|
|
|
|
return err |
|
|
|
|
return parser.NewError(t.pos, t.value, "", errInvalidToken) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func (dec *decoder) OnError(pos lexer.Position, content string, err error) error { |
|
|
|
|
err = &lexer.Error{ |
|
|
|
|
Line: pos.Line, |
|
|
|
|
Column: pos.Column, |
|
|
|
|
Content: content, |
|
|
|
|
Err: err, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
err = parser.NewError(pos, content, "", err) |
|
|
|
|
dec.executeFinal() |
|
|
|
|
return err |
|
|
|
|
} |
|
|
|
|