goparsify/pointer.go
2017-08-06 15:43:23 +10:00

18 lines
247 B
Go

package parsec
type Pointer struct {
input string
pos int
}
func (p Pointer) Advance(i int) Pointer {
return Pointer{p.input, p.pos + i}
}
func (p Pointer) Get() string {
if p.pos > len(p.input) {
return ""
}
return p.input[p.pos:]
}