about summary refs log tree commit diff
path: root/src/libexpr/lexer.l
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-02-02T21·39+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-02-02T21·39+0000
commit1c9c0a5a46822be60c999f0196567c9e17cf5fa3 (patch)
tree6783413d7fd353fdd7562f47a2dc0aac132cd04d /src/libexpr/lexer.l
parentd9f30fe7c74ae8518a575c0d15ee00aa46a2229a (diff)
* Added syntactic sugar to the construction of attribute sets to
  `inherit' variables from the surrounding lexical scope.

  E.g.,

    {stdenv, libfoo}: derivation {
      builder = ./bla;
      inherit stdenv libfoo;
      xyzzy = 1;
    }

  is equivalent to

    {stdenv, libfoo}: derivation {
      builder = ./bla;
      stdenv = stdenv;
      libfoo = libfoo;
      xyzzy = 1;
    }

  Note that for mutually recursive attribute set definitions (`rec
  {...}'), this also works, that is, `rec {inherit x;}' is equivalent
  to `let {fresh = x; body = rec {x = fresh;};}', *not*
  `rec {x = x}'.

Diffstat (limited to 'src/libexpr/lexer.l')
-rw-r--r--src/libexpr/lexer.l1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l
index 3b6e0bb657..853362cd0b 100644
--- a/src/libexpr/lexer.l
+++ b/src/libexpr/lexer.l
@@ -50,6 +50,7 @@ else        { return ELSE; }
 assert      { return ASSERT; }
 let         { return LET; }
 rec         { return REC; }
+inherit     { return INHERIT; }
 
 \=\=        { return EQ; }
 \!\=        { return NEQ; }