From c2a7a84c725f503ad7a6a20b6553ddb49aef6907 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 17 Jun 2021 10:29:14 +0300 Subject: [PATCH] v.parser: support for [if expr], part 1 Enables bootstrapping. Supports the new [if x?] syntax, without using it. --- vlib/v/parser/parser.v | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vlib/v/parser/parser.v b/vlib/v/parser/parser.v index 18eea763aa..60585c69f2 100644 --- a/vlib/v/parser/parser.v +++ b/vlib/v/parser/parser.v @@ -1524,6 +1524,12 @@ fn (mut p Parser) parse_attr() ast.Attr { kind = .comptime_define p.next() 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 } else if p.tok.kind == .string { name = p.tok.lit