1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

scanner: fix special case - 0 at the end

This commit is contained in:
SleepyRoy
2020-02-25 01:01:51 +08:00
committed by GitHub
parent aae14f4eb4
commit 96da5b33c0
2 changed files with 2 additions and 2 deletions

View File

@ -354,7 +354,7 @@ fn (s mut Scanner) scan() ScanRes {
}
mut prefix_zero_num := start_pos - s.pos // how many prefix zeros should be jumped
// for 0b, 0o, 0x the heading zero shouldn't be jumped
if c == `0` && start_pos < s.text.len && !s.text[start_pos].is_digit() {
if start_pos == s.text.len || (c == `0` && !s.text[start_pos].is_digit()) {
prefix_zero_num--
}
s.pos += prefix_zero_num // jump these zeros