mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
Fix incorrect string open/close check in REPL
This commit is contained in:
parent
52c2763ee3
commit
519028e263
@ -22,7 +22,7 @@ fn (r mut Repl) checks(line string) bool {
|
|||||||
was_indent := r.indent > 0
|
was_indent := r.indent > 0
|
||||||
|
|
||||||
for i := 0; i < line.len; i++ {
|
for i := 0; i < line.len; i++ {
|
||||||
if line[i] == `\'` && (i != 0 && line[i - 1] != `\\`) {
|
if line[i] == `\'` && (i == 0 || line[i - 1] != `\\`) {
|
||||||
in_string = !in_string
|
in_string = !in_string
|
||||||
}
|
}
|
||||||
if line[i] == `{` && !in_string {
|
if line[i] == `{` && !in_string {
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
'abc'
|
'abc'
|
||||||
'abc'+'xyz'
|
'abc'+'xyz'
|
||||||
|
'{'
|
||||||
|
'}'
|
||||||
===output===
|
===output===
|
||||||
abc
|
abc
|
||||||
abcxyz
|
abcxyz
|
||||||
|
{
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user