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

scanner: prevent panic with string starting on first character

This commit is contained in:
Henrixounez 2020-04-28 18:57:16 +02:00 committed by GitHub
parent 8c526ad05b
commit 0dc7a57e1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -833,7 +833,7 @@ fn (s &Scanner) count_symbol_before(p int, sym byte) int {
fn (s mut Scanner) ident_string() string {
q := s.text[s.pos]
is_quote := q == single_quote || q == double_quote
is_raw := is_quote && s.text[s.pos - 1] == `r`
is_raw := is_quote && s.pos > 0 && s.text[s.pos - 1] == `r`
if is_quote && !s.is_inside_string {
s.quote = q
}