diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index b88b1bb905..5608996559 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -2195,7 +2195,7 @@ pub fn (mut p Parser) name_expr() ast.Expr { } // Raw string (`s := r'hello \n ') if p.peek_tok.kind == .string && !p.inside_str_interp && p.peek_token(2).kind != .colon { - if p.tok.lit in ['r', 'c', 'js'] && p.tok.kind == .name { + if p.tok.kind == .name && p.tok.lit in ['r', 'c', 'js'] { return p.string_expr() } else { // don't allow any other string prefix except `r`, `js` and `c` @@ -2203,7 +2203,7 @@ pub fn (mut p Parser) name_expr() ast.Expr { } } // don't allow r`byte` and c`byte` - if p.tok.lit in ['r', 'c'] && p.peek_tok.kind == .chartoken { + if p.peek_tok.kind == .chartoken && p.tok.lit.len == 1 && p.tok.lit[0] in [`r`, `c`] { opt := if p.tok.lit == 'r' { '`r` (raw string)' } else { '`c` (c string)' } return p.error('cannot use $opt with `byte` and `rune`') }