diff --git a/misc/emacs/nix-mode.el b/misc/emacs/nix-mode.el index f874370a67..d98353177c 100644 --- a/misc/emacs/nix-mode.el +++ b/misc/emacs/nix-mode.el @@ -66,8 +66,8 @@ The hook `nix-mode-hook' is run when Nix mode is started. (defvar nix-keywords - '("\\" "\\" "\\" "\\" - "\\" "\\" "\\" + '("\\" "\\" "\\" "\\" "\\" + "\\" "\\" "\\" "\\" ("\\" . font-lock-builtin-face) ("\\" . font-lock-builtin-face) ("\\" . font-lock-builtin-face) diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 5db13a7169..df30a5ed07 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 e4b220e04f..f5c3435e5f 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 ; diff --git a/tests/lang/eval-okay-new-let.exp b/tests/lang/eval-okay-new-let.exp new file mode 100644 index 0000000000..6960cba1d1 --- /dev/null +++ b/tests/lang/eval-okay-new-let.exp @@ -0,0 +1 @@ +Str("xyzzyfoobar") diff --git a/tests/lang/eval-okay-new-let.nix b/tests/lang/eval-okay-new-let.nix new file mode 100644 index 0000000000..7381231415 --- /dev/null +++ b/tests/lang/eval-okay-new-let.nix @@ -0,0 +1,14 @@ +let + + f = z: + + let + x = "foo"; + y = "bar"; + body = 1; # compat test + in + z + x + y; + + arg = "xyzzy"; + +in f arg