mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-12-02 02:16:15 +02:00
* "pattern" non-terminal.
This commit is contained in:
parent
efe4b690ae
commit
e818838412
1 changed files with 8 additions and 5 deletions
|
@ -211,7 +211,7 @@ static void freeAndUnprotect(void * p)
|
||||||
}
|
}
|
||||||
|
|
||||||
%type <t> start expr expr_function expr_if expr_op
|
%type <t> start expr expr_function 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 pattern
|
||||||
%type <ts> binds ids expr_list formals string_parts ind_string_parts
|
%type <ts> binds ids expr_list formals string_parts ind_string_parts
|
||||||
%token <t> ID INT STR IND_STR PATH URI
|
%token <t> ID INT STR IND_STR PATH URI
|
||||||
%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL
|
%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL
|
||||||
|
@ -236,10 +236,8 @@ start: expr { data->result = $1; };
|
||||||
expr: expr_function;
|
expr: expr_function;
|
||||||
|
|
||||||
expr_function
|
expr_function
|
||||||
: '{' formals '}' ':' expr_function
|
: pattern ':' expr_function
|
||||||
{ $$ = makeFunction(makeAttrsPat($2), $5, CUR_POS); }
|
{ $$ = makeFunction($1, $3, CUR_POS); }
|
||||||
| ID ':' expr_function
|
|
||||||
{ $$ = makeFunction(makeVarPat($1), $3, CUR_POS); }
|
|
||||||
| ASSERT expr ';' expr_function
|
| ASSERT expr ';' expr_function
|
||||||
{ $$ = makeAssert($2, $4, CUR_POS); }
|
{ $$ = makeAssert($2, $4, CUR_POS); }
|
||||||
| WITH expr ';' expr_function
|
| WITH expr ';' expr_function
|
||||||
|
@ -320,6 +318,11 @@ ind_string_parts
|
||||||
| { $$ = ATempty; }
|
| { $$ = ATempty; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
pattern
|
||||||
|
: ID { $$ = makeVarPat($1); }
|
||||||
|
| '{' formals '}' { $$ = makeAttrsPat($2); }
|
||||||
|
;
|
||||||
|
|
||||||
binds
|
binds
|
||||||
: binds bind { $$ = ATinsert($1, $2); }
|
: binds bind { $$ = ATinsert($1, $2); }
|
||||||
| { $$ = ATempty; }
|
| { $$ = ATempty; }
|
||||||
|
|
Loading…
Reference in a new issue