parser: fix interpolation error

pull/4480/head
yuyi 2020-04-18 06:22:03 +08:00 committed by GitHub
parent 0f9322bf36
commit 5374899f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -18,6 +18,7 @@ struct Parser {
file_name_dir string // "/home/user"
mut:
tok token.Token
prev_tok token.Token
peek_tok token.Token
table &table.Table
is_c bool
@ -228,6 +229,7 @@ fn (p mut Parser) next_with_comment() {
}
*/
fn (var p Parser) next() {
p.prev_tok = p.tok
p.tok = p.peek_tok
p.peek_tok = p.scanner.scan()
/*
@ -571,9 +573,7 @@ pub fn (var p Parser) name_expr() ast.Expr {
}
}
// Raw string (`s := r'hello \n ')
if p.tok.lit in ['r', 'c', 'js'] && p.peek_tok.kind == .string {
// QTODO
// && p.prev_tok.kind != .str_dollar {
if p.tok.lit in ['r', 'c', 'js'] && p.peek_tok.kind == .string && p.prev_tok.kind != .str_dollar {
return p.string_expr()
}
known_var := p.scope.known_var(p.tok.lit)