parser: fix silent parsing examples/vmod.v (#7264)
parent
74dc57e678
commit
9c1a5c5117
|
@ -611,3 +611,4 @@ jobs:
|
|||
./v test-parser examples/fibonacci.v
|
||||
./v test-parser examples/cli.v
|
||||
./v test-parser examples/json.v
|
||||
./v test-parser examples/vmod.v
|
||||
|
|
|
@ -1140,7 +1140,7 @@ pub fn (mut p Parser) name_expr() ast.Expr {
|
|||
p.check(.dot)
|
||||
p.expr_mod = mod
|
||||
}
|
||||
lit0_is_capital := if p.tok.kind != .eof { p.tok.lit[0].is_capital() } else { false }
|
||||
lit0_is_capital := if p.tok.kind != .eof && p.tok.lit.len > 0 { p.tok.lit[0].is_capital() } else { false }
|
||||
// use heuristics to detect `func<T>()` from `var < expr`
|
||||
is_generic_call := !lit0_is_capital && p.peek_tok.kind == .lt && (match p.peek_tok2.kind {
|
||||
.name {
|
||||
|
|
|
@ -763,8 +763,11 @@ fn (mut s Scanner) text_scan() token.Token {
|
|||
return s.new_token(.comma, '', 1)
|
||||
}
|
||||
`@` {
|
||||
mut name := ''
|
||||
if nextc != `\0` {
|
||||
s.pos++
|
||||
name := s.ident_name()
|
||||
name = s.ident_name()
|
||||
}
|
||||
if s.is_fmt {
|
||||
return s.new_token(.name, '@' + name, name.len + 1)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue