summaryrefslogtreecommitdiff
path: root/nodes.go
diff options
context:
space:
mode:
authorAdam Scarr <adam@vektah.net>2017-08-06 15:43:23 +1000
committerAdam Scarr <adam@vektah.net>2017-08-06 15:43:23 +1000
commit8b343d6360d0edc065b9b62ab5e708e907b45a92 (patch)
treed58b76b21e5a369e25e7c3807f5f466cbcd849ad /nodes.go
parent68cde88125e1f016c5706ca8d0b3db6ba06624a2 (diff)
Clean up Pointer
Diffstat (limited to 'nodes.go')
-rw-r--r--nodes.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/nodes.go b/nodes.go
index c51db6f..410fa7e 100644
--- a/nodes.go
+++ b/nodes.go
@@ -1,5 +1,7 @@
package parsec
+import "fmt"
+
type Node interface {
Pos() int
}
@@ -16,11 +18,12 @@ func NewToken(pos int, value string) Token {
}
type Error struct {
- pos int
- Error string
+ pos int
+ Message string
}
-func (e Error) Pos() int { return e.pos }
+func (e Error) Pos() int { return e.pos }
+func (e Error) Error() string { return fmt.Sprintf("offset %d: %s", e.pos, e.Message) }
func NewError(pos int, message string) Error {
return Error{pos, message}