From 267d95e390338958842af590389058aa8a4f859d Mon Sep 17 00:00:00 2001 From: Hidetatz Yaginuma Date: Sun, 3 Sep 2023 23:27:52 +0900 Subject: [PATCH] add comment for clarity --- parse.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parse.go b/parse.go index ef6c122..87fa264 100644 --- a/parse.go +++ b/parse.go @@ -821,6 +821,9 @@ func (p *parser) primary() node { // struct initialize. // ident{varname: value, ...} // this is parsed as ident + dict + // Because we need to determine "{" belongs to struct initialization or block statement, + // we try to read as dict first, then return as struct init if succeeds. + // If fail, return just ident assuming "{" belongs to block. if d := p.try(p.dict); d != nil { return &ndStructInit{tok: p.cur, name: i, values: d} }