Skip to content

Commit 8868696

Browse files
committed
repl: fix handling of lines with comments like math.pi // comment (fix #25229)
1 parent 682db66 commit 8868696

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎cmd/tools/vrepl.v‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ fn run_repl(workdir string, vrepl_prefix string) int {
441441
prompt = '... '
442442
}
443443
oline := r.get_one_line(prompt) or { break }
444-
line := oline.trim_space()
444+
line := oline.all_before('//').trim_space()
445445
if line == '' {
446446
continue
447447
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
math.pi
2+
math.pi // some comment
3+
===output===
4+
3.141592653589793
5+
3.141592653589793

0 commit comments

Comments
 (0)