asciigoat's INI parser
https://asciigoat.org/ini
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
529 B
34 lines
529 B
1 year ago
|
package basic
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
|
||
|
"asciigoat.org/core/lexer"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
errInvalidToken = errors.New("invalid token")
|
||
|
)
|
||
|
|
||
|
func newErrInvalidToken(t *token) *lexer.Error {
|
||
|
err := &lexer.Error{
|
||
|
Line: t.pos.Line,
|
||
|
Column: t.pos.Column,
|
||
|
Content: t.value,
|
||
|
Err: errInvalidToken,
|
||
|
}
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
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,
|
||
|
}
|
||
|
|
||
|
dec.executeFinal()
|
||
|
return err
|
||
|
}
|