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.
|
|
|
package basic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"asciigoat.org/core/lexer"
|
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
errInvalidToken = errors.New("invalid token")
|
|
|
|
)
|
|
|
|
|
|
|
|
func newError(pos lexer.Position, content, hint string, err error) *lexer.Error {
|
|
|
|
return &lexer.Error{
|
|
|
|
Line: pos.Line,
|
|
|
|
Column: pos.Column,
|
|
|
|
Content: content,
|
|
|
|
Hint: hint,
|
|
|
|
Err: err,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func newErrInvalidToken(t *token) *lexer.Error {
|
|
|
|
return newError(t.pos, t.value, "", errInvalidToken)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (dec *decoder) OnError(pos lexer.Position, content string, err error) error {
|
|
|
|
err = newError(pos, content, "", err)
|
|
|
|
dec.executeFinal()
|
|
|
|
return err
|
|
|
|
}
|