File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -2762,7 +2762,8 @@ fn (mut p Parser) name_expr() ast.Expr {
2762
2762
}
2763
2763
}
2764
2764
// Raw string (`s := r'hello \n ')
2765
- if p.peek_tok.kind == .string && ! p.inside_str_interp && p.peek_token (2 ).kind != .colon {
2765
+ if p.peek_tok.kind == .string && p.tok.line_nr == p.peek_tok.line_nr && ! p.inside_str_interp
2766
+ && p.peek_token (2 ).kind != .colon {
2766
2767
if p.tok.kind == .name && p.tok.lit in ['r' , 'c' , 'js' ] {
2767
2768
return p.string_expr ()
2768
2769
} else {
Original file line number Diff line number Diff line change
1
+ module main
2
+
3
+ fn if_expt (this int ) (string , int ) {
4
+ inc := 1
5
+ mut count := 0
6
+ thing := if this in [0 , 1 , 2 ] {
7
+ count + = 1
8
+ '0..2'
9
+ } else if this in [3 , 4 , 5 ] {
10
+ count + = inc
11
+ '3..5'
12
+ } else {
13
+ 'not 0..5'
14
+ }
15
+ return thing, count
16
+ }
17
+
18
+ fn test_main () {
19
+ a , b := if_expt (1 )
20
+ assert a == '0..2'
21
+ assert b == 1
22
+ c , d := if_expt (4 )
23
+ assert c == '3..5'
24
+ assert d == 1
25
+ e , f := if_expt (7 )
26
+ assert e == 'not 0..5'
27
+ assert f == 0
28
+ }
You can’t perform that action at this time.
0 commit comments