Merge pull request #98 from stakhiv/fix-consumed

Do not run lexer.Consumed if there's an error.
This commit is contained in:
Sergey Kamardin
2017-02-16 16:37:11 +03:00
committed by GitHub
+1 -1
View File
@@ -589,7 +589,7 @@ func (r *Lexer) IsStart() bool {
// Consumed reads all remaining bytes from the input, publishing an error if
// there is anything but whitespace remaining.
func (r *Lexer) Consumed() {
if r.pos > len(r.Data) {
if r.pos > len(r.Data) || !r.Ok() {
return
}