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

scanner: fix on single letter variable declaration on first line

This commit is contained in:
Henrixounez 2019-06-28 16:15:28 +02:00 committed by Alexander Medvednikov
parent 0b7cc5f01a
commit 0026b228c3

View File

@ -213,6 +213,11 @@ fn (s mut Scanner) scan() ScanRes {
s.dollar_end = true s.dollar_end = true
s.dollar_start = false s.dollar_start = false
} }
if s.pos == 0 && next_char == ` ` {
s.pos++
//If a single letter name at the start of the file, increment
//Otherwise the scanner would be stuck at s.pos = 0
}
return scan_res(NAME, name) return scan_res(NAME, name)
} }
// number, `.123` // number, `.123`