mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-10 19:22:00 -08:00
22 lines
359 B
Go
22 lines
359 B
Go
|
package parser
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/d5/tengo/compiler/source"
|
||
|
)
|
||
|
|
||
|
// Error represents a parser error.
|
||
|
type Error struct {
|
||
|
Pos source.FilePos
|
||
|
Msg string
|
||
|
}
|
||
|
|
||
|
func (e Error) Error() string {
|
||
|
if e.Pos.Filename != "" || e.Pos.IsValid() {
|
||
|
return fmt.Sprintf("Parse Error: %s\n\tat %s", e.Msg, e.Pos)
|
||
|
}
|
||
|
|
||
|
return fmt.Sprintf("Parse Error: %s", e.Msg)
|
||
|
}
|