diff options
Diffstat (limited to 'vendor/github.com/d5/tengo/compiler/parser/error.go')
-rw-r--r-- | vendor/github.com/d5/tengo/compiler/parser/error.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/vendor/github.com/d5/tengo/compiler/parser/error.go b/vendor/github.com/d5/tengo/compiler/parser/error.go new file mode 100644 index 00000000..80544fbd --- /dev/null +++ b/vendor/github.com/d5/tengo/compiler/parser/error.go @@ -0,0 +1,21 @@ +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) +} |