@@ -46,7 +46,8 @@ pub mut:
4646 is_print_rel_paths_on_error bool
4747 quote u8 // which quote is used to denote current string: ' or "
4848 inter_quote u8
49- nr_lines int // total number of lines in the source file that were scanned
49+ just_closed_inter bool // if is_enclosed_inter was set to false on the previous character: `}`
50+ nr_lines int // total number of lines in the source file that were scanned
5051 is_vh bool // Keep newlines
5152 is_fmt bool // Used for v fmt.
5253 comments_mode CommentsMode
@@ -836,6 +837,7 @@ fn (mut s Scanner) text_scan() token.Token {
836837 return s.new_token (.string, '' , 1 )
837838 }
838839 s.is_enclosed_inter = false
840+ s.just_closed_inter = true
839841 ident_string := s.ident_string ()
840842 return s.new_token (.string, ident_string, ident_string.len + 2 ) // + two quotes
841843 } else {
@@ -1149,13 +1151,16 @@ fn (mut s Scanner) ident_string() string {
11491151 is_quote := q == scanner.single_quote || q == scanner.double_quote
11501152 is_raw := is_quote && s.pos > 0 && s.text[s.pos - 1 ] == `r` && ! s.is_inside_string
11511153 is_cstr := is_quote && s.pos > 0 && s.text[s.pos - 1 ] == `c` && ! s.is_inside_string
1152- if is_quote {
1154+ // don't interpret quote as "start of string" quote when a string interpolation has
1155+ // just ended on the previous character meaning it's not the start of a new string
1156+ if is_quote && ! s.just_closed_inter {
11531157 if s.is_inside_string || s.is_enclosed_inter || s.is_inter_start {
11541158 s.inter_quote = q
11551159 } else {
11561160 s.quote = q
11571161 }
11581162 }
1163+ s.just_closed_inter = false
11591164 mut n_cr_chars := 0
11601165 mut start := s.pos
11611166 start_char := s.text[start]
0 commit comments