42 lines
705 B
Go
42 lines
705 B
Go
package utpl
|
|
|
|
import "fmt"
|
|
|
|
type Position struct {
|
|
Line int
|
|
Column int
|
|
}
|
|
|
|
func (p Position) String() string {
|
|
return fmt.Sprintf("line %d, column %d", p.Line, p.Column)
|
|
}
|
|
|
|
type ParseError struct {
|
|
Message string
|
|
Pos Position
|
|
}
|
|
|
|
func (e ParseError) Error() string {
|
|
return fmt.Sprintf("%s: %s", e.Pos, e.Message)
|
|
}
|
|
|
|
type ExecError struct {
|
|
Pos Position
|
|
Message string
|
|
}
|
|
|
|
func (e ExecError) Error() string {
|
|
return fmt.Sprintf("%s: %s", e.Pos, e.Message)
|
|
}
|
|
|
|
type UnsafeRawError struct {
|
|
Message string
|
|
Pos Position
|
|
Param string
|
|
Value string
|
|
}
|
|
|
|
func (e UnsafeRawError) Error() string {
|
|
return fmt.Sprintf("%s: %s (param: %q, value: %q)", e.Pos, e.Message, e.Param, e.Value)
|
|
}
|