From ac19b333b38b2ac4b633bc1203e59c153bbb5c91 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 2 Oct 2006 15:52:44 +0000 Subject: * Finally, a real "let" syntax: `let x = ...; ... z = ...; in ...'. --- src/libexpr/lexer.l | 1 + src/libexpr/parser.y | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'src/libexpr') diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 5db13a71699b..df30a5ed0713 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -91,6 +91,7 @@ else { return ELSE; } assert { return ASSERT; } with { return WITH; } let { return LET; } +in { return IN; } rec { return REC; } inherit { return INHERIT; } diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index e4b220e04fb8..f5c3435e5f45 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -123,7 +123,7 @@ static void freeAndUnprotect(void * p) %type expr_app expr_select expr_simple bind inheritsrc formal %type binds ids expr_list formals string_parts %token ID INT STR PATH URI -%token IF THEN ELSE ASSERT WITH LET REC INHERIT EQ NEQ AND OR IMPL +%token IF THEN ELSE ASSERT WITH LET IN REC INHERIT EQ NEQ AND OR IMPL %token DOLLAR_CURLY /* == ${ */ %nonassoc IMPL @@ -152,6 +152,8 @@ expr_function { $$ = makeAssert($2, $4, CUR_POS); } | WITH expr ';' expr_function { $$ = makeWith($2, $4, CUR_POS); } + | LET binds IN expr_function + { $$ = makeSelect(fixAttrs(1, ATinsert($2, makeBind(toATerm(""), $4, CUR_POS))), toATerm("")); } | expr_if ; -- cgit 1.4.1