demizer/go-rst

DRY: Lexing a token of the current line

demizer opened this issue · 1 comments

Many of the lexing function contain this block:

TestLexCommentInDefinitionGood0400
    for {
        l.next()
        if l.isEndOfLine() && l.mark == utf8.RuneError {
            l.emit(itemTerm)
            break
        }
    }

This should be reduced down to a function: emitCurrentLine(t token) or something.

There is some variance between the checks, doesn't make since to write this into a general function.