scanner: minor optimization in `text_scan()` (#7172)

pull/7180/head
yuyi 2020-12-07 13:33:41 +08:00 committed by GitHub
parent 14887304d8
commit f377710c0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -532,8 +532,9 @@ fn (mut s Scanner) text_scan() token.Token {
// }
if s.is_started {
s.pos++
}
} else {
s.is_started = true
}
if s.pos >= s.text.len {
return s.end_of_file()
}