scanner: add an error for unfinished string literals (#6519)

pull/6522/head
Henrixounez 2020-10-01 15:40:59 +02:00 committed by GitHub
parent 11b16a63cf
commit 0f1ed1ca09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View File

@ -0,0 +1,2 @@
vlib/v/checker/tests/unfinished_string.vv:2:1: error: unfinished string literal
1 | a := '

View File

@ -0,0 +1 @@
a := '

View File

@ -1193,7 +1193,7 @@ fn (mut s Scanner) ident_string() string {
for {
s.pos++
if s.pos >= s.text.len {
break
s.error('unfinished string literal')
}
c := s.text[s.pos]
prevc := s.text[s.pos - 1]