mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
* Extended the `inherit' syntax to optionally select attributes from
other attribute sets, rather than the current scope. E.g., {inherit (pkgs) gcc binutils;} is equivalent to {gcc = pkgs.gcc; binutils = pkgs.binutils;} I am not so happy about the syntax.
This commit is contained in:
parent
9d25466b34
commit
d445da7a7b
2 changed files with 18 additions and 8 deletions
|
@ -33,7 +33,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, void * data, char * s)
|
|||
}
|
||||
|
||||
%type <t> start expr expr_function expr_assert expr_op
|
||||
%type <t> expr_app expr_select expr_simple bind formal
|
||||
%type <t> expr_app expr_select expr_simple bind inheritsrc formal
|
||||
%type <ts> binds ids expr_list formals
|
||||
%token <t> ID INT STR PATH URI
|
||||
%token IF THEN ELSE ASSERT LET REC INHERIT EQ NEQ AND OR IMPL
|
||||
|
@ -114,8 +114,13 @@ binds
|
|||
bind
|
||||
: ID '=' expr ';'
|
||||
{ $$ = ATmake("Bind(<term>, <term>)", $1, $3); }
|
||||
| INHERIT ids ';'
|
||||
{ $$ = ATmake("Inherit(<term>)", $2); }
|
||||
| INHERIT inheritsrc ids ';'
|
||||
{ $$ = ATmake("Inherit(<term>, <term>)", $2, $3); }
|
||||
;
|
||||
|
||||
inheritsrc
|
||||
: '(' expr ')' { $$ = $2; }
|
||||
| { $$ = ATmake("Scope"); }
|
||||
;
|
||||
|
||||
ids: ids ID { $$ = ATinsert($1, $2); } | { $$ = ATempty; };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue