v.util: fix handling of "start \u005c${...} end" in cgen (fix #25304) (#25306)

This commit is contained in:
Delyan Angelov 2025-09-15 01:18:40 +03:00 committed by GitHub
parent 0e4078f27d
commit 9f666ad117
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,2 @@
start
done

View File

@ -0,0 +1,6 @@
println('start')
b := 'Hello world!\u004azz\u005cXYZ'
a := 'zzz\u005c${')}}));builtin__println(b);//'}QWE'
_ := a
_ := b
println('done')

View File

@ -0,0 +1,2 @@
start
done

View File

@ -0,0 +1,6 @@
println('start')
b := 'Hello world!'
c := '\u005c${')}}));builtin__println(b);//'}'
_ := b
_ := c
println('done')

View File

@ -114,6 +114,10 @@ pub fn smart_quote(str string, raw bool) string {
skip_next = true
continue
}
// protect against '\u005c${...}'
if next == 0 && current == backslash {
continue
}
if !raw {
if current == `$` {
if last == backslash {