Browse Source

scanner.Scanner: Add .NewLine() helper to increment line of the cursor

Signed-off-by: Alejandro Mery <amery@geeks.cl>
v0.2.x
Alejandro Mery 10 years ago
parent
commit
f9405e7fe1
  1. 6
      scanner/scanner.go

6
scanner/scanner.go

@ -74,6 +74,12 @@ func (l *Scanner) Skip() {
l.runes = 0 l.runes = 0
} }
// Count NewLine
func (l *Scanner) NextLine() {
l.cursor.Line++
l.cursor.Column = 1
}
// Return the next rune but not moving the cursor // Return the next rune but not moving the cursor
func (l *Scanner) Peek() (rune, uint) { func (l *Scanner) Peek() (rune, uint) {
if l.cursor.Offset == uint(len(l.input)) { if l.cursor.Offset == uint(len(l.input)) {

Loading…
Cancel
Save