diff options
Diffstat (limited to 'subex/lex.go')
-rw-r--r-- | subex/lex.go | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/subex/lex.go b/subex/lex.go index f020b23..74bf370 100644 --- a/subex/lex.go +++ b/subex/lex.go @@ -5,11 +5,11 @@ import ( ) const eof rune = -1 -type RuneReader struct { +type StringRuneReader struct { input string pos, width int } -func (l *RuneReader) next() rune { +func (l *StringRuneReader) Next() rune { if l.pos >= len(l.input) { l.width = 0 return eof @@ -19,16 +19,6 @@ func (l *RuneReader) next() rune { l.pos += l.width return r } -func (l *RuneReader) accept(chars string) bool { - r := l.next() - for _, char := range chars { - if char == r { - return true - } - } - l.rewind() - return false -} -func (l *RuneReader) rewind() { +func (l *StringRuneReader) Rewind() { l.pos -= l.width } |