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

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

This commit is contained in:
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 { for {
s.pos++ s.pos++
if s.pos >= s.text.len { if s.pos >= s.text.len {
break s.error('unfinished string literal')
} }
c := s.text[s.pos] c := s.text[s.pos]
prevc := s.text[s.pos - 1] prevc := s.text[s.pos - 1]