From 0026b228c3d8cd85d9b2b52e32608657e502ca1a Mon Sep 17 00:00:00 2001 From: Henrixounez Date: Fri, 28 Jun 2019 16:15:28 +0200 Subject: [PATCH] scanner: fix on single letter variable declaration on first line --- compiler/scanner.v | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/scanner.v b/compiler/scanner.v index 4ffaf09781..bcdf9dcd93 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -213,6 +213,11 @@ fn (s mut Scanner) scan() ScanRes { s.dollar_end = true 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) } // number, `.123`