github.com/hirochachacha/plua@v0.0.0-20170217012138-c82f520cc725/compiler/parser/error.go (about) 1 package parser 2 3 import ( 4 "fmt" 5 6 "github.com/hirochachacha/plua/position" 7 ) 8 9 type Error struct { 10 Pos position.Position 11 Err error 12 } 13 14 func (e Error) Error() string { 15 if e.Pos.SourceName != "" || e.Pos.IsValid() { 16 return fmt.Sprintf("compiler/parser: %s: %v", e.Pos, e.Err) 17 } 18 return fmt.Sprintf("compiler/parser: %v", e.Err) 19 }