From 01d21262c722819266593700638e34944d44093d Mon Sep 17 00:00:00 2001 From: Yingchi Long Date: Sun, 17 Sep 2023 15:24:57 +0800 Subject: [PATCH] nixd/Syntax: action for binds --- nixd/include/nixd/Syntax/Nodes.inc | 2 +- nixd/lib/Syntax/Parser/Parser.y | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nixd/include/nixd/Syntax/Nodes.inc b/nixd/include/nixd/Syntax/Nodes.inc index 7b19b14ba..28876f114 100644 --- a/nixd/include/nixd/Syntax/Nodes.inc +++ b/nixd/include/nixd/Syntax/Nodes.inc @@ -22,7 +22,7 @@ NODE(With, { Node *Attrs; Node *Body; }) -NODE(Binds, {}) +NODE(Binds, { std::vector Attributes; }) NODE(Let, { Node *Binds; Node *Body; diff --git a/nixd/lib/Syntax/Parser/Parser.y b/nixd/lib/Syntax/Parser/Parser.y index affbf0722..1155a8bd7 100644 --- a/nixd/lib/Syntax/Parser/Parser.y +++ b/nixd/lib/Syntax/Parser/Parser.y @@ -379,9 +379,15 @@ identifier binds - : binds attribute - | binds inherited_attribute - | + : binds attribute { + $$->Attributes.emplace_back($2); + $$->Range = mkRange(yylloc, *Data); + } + | binds inherited_attribute { + $$->Attributes.emplace_back($2); + $$->Range = mkRange(yylloc, *Data); + } + | { $$ = decorateNode(new Binds, yylloc, *Data); } // Nixd extension inherited_attribute