mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-27 07:41:36 +00: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)
|
||
|
}
|