From bfbd3dc9654ba3cef961d585ee555ec733852ddb Mon Sep 17 00:00:00 2001 From: Ryan Burns Date: Sun, 17 Oct 2021 19:49:26 -0700 Subject: [PATCH] RFC 110: Add "inherit-as-list" language construct Initial MVP implementation for [RFC 110](https://github.com/NixOS/rfcs/pull/110) --- src/libexpr/parser.y | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index 8a0a79c964fd..3b238a0c98e0 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -343,6 +343,15 @@ expr_function }); $$ = new ExprLet($2, $4); } + | INHERIT '(' expr ')' '[' attrs ']' + { auto ret = new ExprList; + ret->elems.reserve($6->size()); + /* !!! Should ensure sharing of the expression in $3. */ + for (auto & i : *$6) { + ret->elems.push_back(new ExprSelect(makeCurPos(@6, data), $3, i.symbol)); + } + $$ = ret; + } | expr_if ;