mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 16:26:18 +02:00
* Resolve an ambiguity between ifs and attribute selection, e.g., `if
b then x else y.z'.
This commit is contained in:
parent
86b7efbdbe
commit
dbf547645d
1 changed files with 7 additions and 3 deletions
|
@ -32,7 +32,7 @@ void yyerror(YYLTYPE * loc, yyscan_t scanner, void * data, char * s)
|
||||||
ATermList ts;
|
ATermList ts;
|
||||||
}
|
}
|
||||||
|
|
||||||
%type <t> start expr expr_function expr_assert expr_op
|
%type <t> start expr expr_function expr_assert expr_if expr_op
|
||||||
%type <t> expr_app expr_select expr_simple bind inheritsrc formal
|
%type <t> expr_app expr_select expr_simple bind inheritsrc formal
|
||||||
%type <ts> binds ids expr_list formals
|
%type <ts> binds ids expr_list formals
|
||||||
%token <t> ID INT STR PATH URI
|
%token <t> ID INT STR PATH URI
|
||||||
|
@ -60,6 +60,12 @@ expr_function
|
||||||
expr_assert
|
expr_assert
|
||||||
: ASSERT expr ';' expr_assert
|
: ASSERT expr ';' expr_assert
|
||||||
{ $$ = ATmake("Assert(<term>, <term>)", $2, $4); }
|
{ $$ = ATmake("Assert(<term>, <term>)", $2, $4); }
|
||||||
|
| expr_if
|
||||||
|
;
|
||||||
|
|
||||||
|
expr_if
|
||||||
|
: IF expr THEN expr ELSE expr
|
||||||
|
{ $$ = ATmake("If(<term>, <term>, <term>)", $2, $4, $6); }
|
||||||
| expr_op
|
| expr_op
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -102,8 +108,6 @@ expr_simple
|
||||||
| '{' binds '}'
|
| '{' binds '}'
|
||||||
{ $$ = fixAttrs(0, $2); }
|
{ $$ = fixAttrs(0, $2); }
|
||||||
| '[' expr_list ']' { $$ = ATmake("List(<term>)", $2); }
|
| '[' expr_list ']' { $$ = ATmake("List(<term>)", $2); }
|
||||||
| IF expr THEN expr ELSE expr
|
|
||||||
{ $$ = ATmake("If(<term>, <term>, <term>)", $2, $4, $6); }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
binds
|
binds
|
||||||
|
|
Loading…
Reference in a new issue