1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v.parser: support for [if expr], part 1

Enables bootstrapping.
Supports the new [if x?] syntax, without using it.
This commit is contained in:
Delyan Angelov 2021-06-17 10:29:14 +03:00
parent 6a19a13812
commit c2a7a84c72
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -1524,6 +1524,12 @@ fn (mut p Parser) parse_attr() ast.Attr {
kind = .comptime_define kind = .comptime_define
p.next() p.next()
p.check(.name) p.check(.name)
// TODO: remove this check after bootstrapping
// it is only for compatibility with the new
// [if user_defined?] syntax.
if p.tok.kind == .question {
p.next()
}
name = p.prev_tok.lit name = p.prev_tok.lit
} else if p.tok.kind == .string { } else if p.tok.kind == .string {
name = p.tok.lit name = p.tok.lit