about summary refs log tree commit diff
path: root/src/libexpr/parser.y
AgeCommit message (Collapse)AuthorFilesLines
2011-08-06 * Refactoring: move parseExprFromFile() and parseExprFromString() intoEelco Dolstra1-9/+15
the EvalState class.
2011-07-13 * Allow attribute names to be strings. Based on theEelco Dolstra1-0/+2
allow-arbitrary-strinsg-in-names patch by Marc Weber.
2011-07-13 * Allow a default value in attribute selection by writingEelco Dolstra1-12/+24
x.y.z or default (as originally proposed in https://mail.cs.uu.nl/pipermail/nix-dev/2009-September/002989.html). For instance, an expression like stdenv.lib.attrByPath ["features" "ckSched"] false args can now be written as args.features.ckSched or false
2011-07-06 * Change the right-hand side of the ‘.’ operator from an attribute toEelco Dolstra1-3/+3
an attribute path. This is a refactoring to support default values.
2011-07-06 * In the ‘?’ operator, allow attribute paths. For instance, you canEelco Dolstra1-18/+8
write ‘attrs ? a.b’ to test whether ‘attrs’ has an attribute ‘a’ containing an attribute ‘b’. This is more convenient than ‘attrs ? a && attrs.a ? b’. Slight change in the semantics: it's no longer an error if the left-hand side of ‘?’ is not an attribute set. In that case it just returns false. So, ‘null ? foo’ no longer throws an error.
2010-10-24 * Keep attribute sets in sorted order to speed up attribute lookups.Eelco Dolstra1-17/+15
* Simplify the representation of attributes in the AST. * Change the behaviour of listToAttrs() in case of duplicate names.
2010-10-23 * Optimise string constants by putting them in the symbol table.Eelco Dolstra1-32/+40
2010-10-04 * Make sure that config.h is included before the system headers,Eelco Dolstra1-6/+4
because it defines _FILE_OFFSET_BITS. Without this, on OpenSolaris the system headers define it to be 32, and then the 32-bit stat() ends up being called with a 64-bit "struct stat", or vice versa. This also ensures that we get 64-bit file sizes everywhere. * Remove the redundant call to stat() in parseExprFromFile(). The file cannot be a symlink because that's the exit condition of the loop before.
2010-05-07 * Store position info for inherited attributes.Eelco Dolstra1-2/+3
2010-05-06 * Store attribute positions in the AST and report duplicate attributeEelco Dolstra1-29/+26
errors with position info. * For all positions, use the position of the first character of the first token, rather than the last character of the first token plus one.
2010-04-22 * Check for duplicate attribute names / function arguments. `makeEelco Dolstra1-43/+40
check' now succeeds :-) * An attribute set such as `{ foo = { enable = true; }; foo.port = 23; }' now parses. It was previously rejected, but I'm too lazy to implement the check. (The only reason to reject it is that the reverse, `{ foo.port = 23; foo = { enable = true; }; }', is rejected, which is kind of ugly.)
2010-04-14 * Fix builtins.Eelco Dolstra1-2/+1
2010-04-14 * After parsing, compute level/displacement pairs for each variableEelco Dolstra1-1/+2
use site, allowing environments to be stores as vectors of values rather than maps. This should speed up evaluation and reduce the number of allocations.
2010-04-13 * Evaluate lets directly (i.e. without desugaring to `rec { attrs...;Eelco Dolstra1-1/+1
<let-body> = e; }.<let-body>). This prevents the unnecessary allocation of an attribute set.
2010-04-13 * Use a symbol table to represent identifiers and attribute namesEelco Dolstra1-29/+40
efficiently. The symbol table ensures that there is only one copy of each symbol, thus allowing symbols to be compared efficiently using a pointer equality test.
2010-04-12 * Finished the ATerm-less parser.Eelco Dolstra1-92/+31
2010-04-12 * Indented strings.Eelco Dolstra1-37/+33
2010-04-12 * More missing constructs.Eelco Dolstra1-49/+31
2010-04-12 * Don't use ATerms for the abstract syntax trees anymore. NotEelco Dolstra1-86/+105
finished yet.
2010-04-12 * Don't use ATerms to represent integers in the lexer.Eelco Dolstra1-2/+4
2010-04-01 * Removed the `~' operator.Eelco Dolstra1-1/+0
2010-03-31 * Cache parse trees to prevent repeated parsing of imported NixEelco Dolstra1-6/+0
expressions.
2010-03-29 * Started integrating the new evaluator.Eelco Dolstra1-2/+2
2010-03-25 * Simplify @-patterns: only `{attrs}@name' or `name@{attrs}' are nowEelco Dolstra1-25/+20
allowed. So `name1@name2', `{attrs1}@{attrs2}' and so on are now no longer legal. This is no big loss because they were not useful anyway. This also changes the output of builtins.toXML for @-patterns slightly.
2010-03-14 Merge r20344 & r20346.Nicolas Pierron1-1/+7
2009-05-15 * Change the scoping of "inherit (e) ..." in recs so that theEelco Dolstra1-2/+3
attributes of the rec are in scope of `e'. This is useful in expressions such as rec { lib = import ./lib; inherit (lib) concatStrings; } It does change the semantics of expressions such as let x = {y = 1;}; in rec { x = {y = 2;}; inherit (x) y; }.y This now returns 2 instead of 1. However, no code in Nixpkgs or NixOS seems to rely on the old behaviour.
2009-05-15 * Some syntactic sugar for attribute sets: allow {x.y.z = ...;} as aEelco Dolstra1-25/+80
shorthand for {x = {y = {z = ...;};};}. This is especially useful for NixOS configuration files, e.g. { services = { sshd = { enable = true; port = 2022; }; }; } can now be written as { services.sshd.enable = true; services.sshd.port = 2022; } However, it is currently not permitted to write { services.sshd = {enable = true;}; services.sshd.port = 2022; } as this is considered a duplicate definition of `services.sshd'.
2009-05-14 * Check for duplicate attributes in fixAttrs, rather than doing aEelco Dolstra1-94/+63
separate traversal after parsing. Likewise, check for duplicate pattern variables right away.
2009-05-07 * Remove a right recursion that causes the parser to barf on very longEelco Dolstra1-6/+3
lists. The comment about ATreverse requiring unbounded stack space was unfounded anyway.
2009-04-16 * Fix a few "comparison is always false/true due to limited range ofEelco Dolstra1-1/+1
data type" warnings on 64-bit platforms. The one in parser.y is likely to be a real bug.
2009-01-12 * Make Nix build with Bison 2.4.Eelco Dolstra1-0/+1
2008-08-14 * Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra1-6/+18
in attribute set pattern matches. This allows defining a function that takes *at least* the listed attributes, while ignoring additional attributes. For instance, {stdenv, fetchurl, fuse, ...}: stdenv.mkDerivation { ... }; defines a function that requires an attribute set that contains the specified attributes but ignores others. The main advantage is that we can then write in all-packages.nix aefs = import ../bla/aefs pkgs; instead of aefs = import ../bla/aefs { inherit stdenv fetchurl fuse; }; This saves a lot of typing (not to mention not having to update all-packages.nix with purely mechanical changes). It saves as much typing as the "args: with args;" style, but has the advantage that the function arguments are properly declared (not implicit in what the body of the "with" uses).
2008-08-14 * @-patterns as in Haskell. For instance, in a function definitionEelco Dolstra1-1/+12
f = args @ {x, y, z}: ...; `args' refers to the argument as a whole, which is further pattern-matched against the attribute set pattern {x, y, z}.
2008-08-14 * "pattern" non-terminal.Eelco Dolstra1-5/+8
2008-08-14 * Refactoring: combine functions that take an attribute set andEelco Dolstra1-9/+24
functions that take a single argument (plain lambdas) into one AST node (Function) that contains a Pattern node describing the arguments. Current patterns are single lazy arguments (VarPat) and matching against an attribute set (AttrsPat). This refactoring allows other kinds of patterns to be added easily, such as Haskell-style @-patterns, or list pattern matching.
2008-08-11 * Removed the "valid values" feature. Nobody uses it anyway.Eelco Dolstra1-5/+4
2007-11-30 * Added a new kind of multi-line string literal delimited by twoEelco Dolstra1-3/+104
single quotes. Example (from NixOS): job = '' start on network-interfaces start script rm -f /var/run/opengl-driver ${if videoDriver == "nvidia" then "ln -sf ${nvidiaDrivers} /var/run/opengl-driver" else if cfg.driSupport then "ln -sf ${mesa} /var/run/opengl-driver" else "" } rm -f /var/log/slim.log end script ''; This style has two big advantages: - \, ' and " aren't special, only '' and ${. So you get a lot less escaping in shell scripts / configuration files in Nixpkgs/NixOS. The delimiter '' is rare in scripts (and can usually be written as ""). ${ is also fairly rare. Other delimiters such as <<...>>, {{...}} and <|...|> were also considered but this one appears to have the fewest drawbacks (thanks Martin). - Indentation is intelligently stripped so that multi-line strings can follow the nesting structure of the containing Nix expression. E.g. in the example above 6 spaces are stripped from the start of each line. This prevents unnecessary indentation in generated files (which sometimes even breaks things). See tests/lang/eval-okay-ind-string.nix for some examples.
2007-08-07 * Don't allocate input files on the stack.Eelco Dolstra1-14/+2
2007-05-15 * Allow empty argument lists in function definitions (e.g., `{}:Eelco Dolstra1-0/+1
bla'). Also allow trailing commas (`{x, y,}: ...') as a unintented consequence. Hopefully the reduce/reduce conflict won't cause any problems.
2007-01-15 * Handle multiple indirect symlinks when loading a Nix expression.Eelco Dolstra1-3/+6
2006-12-02 * Remove SwitchToOriginalUser, we're not going to need it anymore.Eelco Dolstra1-2/+0
2006-10-16 * Big cleanup of the semantics of paths, strings, contexts, stringEelco Dolstra1-2/+2
concatenation and string coercion. This was a big mess (see e.g. NIX-67). Contexts are now folded into strings, so that they don't cause evaluation errors when they're not expected. The semantics of paths has been clarified (see nixexpr-ast.def). toString() and coerceToString() have been merged. Semantic change: paths are now copied to the store when they're in a concatenation (and in most other situations - that's the formalisation of the meaning of a path). So "foo " + ./bla evaluates to "foo /nix/store/hash...-bla", not "foo /path/to/current-dir/bla". This prevents accidental impurities, and is more consistent with the treatment of derivation outputs, e.g., `"foo " + bla' where `bla' is a derivation. (Here `bla' would be replaced by the output path of `bla'.)
2006-10-11 * Removed URIs from the evaluator (NIX-66). They are now just anotherEelco Dolstra1-2/+2
kind of notation for strings.
2006-10-02 * Finally, a real "let" syntax: `let x = ...; ... z = ...; in ...'.Eelco Dolstra1-1/+3
2006-10-02 * Hack for Bison 2.3 compatability.Eelco Dolstra1-2/+13
2006-09-04 * Remove unnecessary inclusions of aterm2.h.Eelco Dolstra1-5/+4
2006-09-04 * Compile the lexer as C++ code. Remove all the redundant C/C++Eelco Dolstra1-21/+191
marshalling code.
2006-09-04 * Use a proper namespace.Eelco Dolstra1-17/+30
* Optimise header file usage a bit. * Compile the parser as C++.
2006-07-24 * New language feature: domain checks, which check whether a functionEelco Dolstra1-1/+1
argument has a valid value, i.e., is in a certain domain. E.g., { foo : [true false] , bar : ["a" "b" "c"] }: ... This previously could be done using assertions, but domain checks will allow the buildfarm to automatically extract the configuration space from functions.
2006-07-24 * Refactoring to support domain checks.Eelco Dolstra1-2/+5