2017-08-06 06:31:35 +02:00
|
|
|
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 {
|
2017-08-06 07:43:23 +02:00
|
|
|
if p.pos > len(p.input) {
|
|
|
|
return ""
|
2017-08-06 06:31:35 +02:00
|
|
|
}
|
2017-08-06 07:43:23 +02:00
|
|
|
return p.input[p.pos:]
|
2017-08-06 06:31:35 +02:00
|
|
|
}
|