aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/lexer.l
AgeCommit message (Collapse)Author
2016-02-24Throw a specific error for incomplete parse errors.Scott Olson
`nix-repl` will use this for deciding whether to keep waiting for input or error out right away.
2016-02-12Merge pull request #762 from ctheune/ctheune-floatsEelco Dolstra
Implement floats
2016-01-20Revert "Revert "next try for "don't abort when given unmatched '}' with ↵Eelco Dolstra
'start-condition stack underflow'. This fixes #751""" This reverts commit b669d3d2e83d3c50238751b57cff3ed0ca39bc8a.
2016-01-20Revert "next try for "don't abort when given unmatched '}' with ↵Eelco Dolstra
'start-condition stack underflow'. This fixes #751"" This reverts commit ed23c8568e10d15196bb4ff2b79fc14191d28109. Let's merge this *after* the 1.11.1 release.
2016-01-19next try for "don't abort when given unmatched '}' with 'start-condition ↵Fabian Schmitthenner
stack underflow'. This fixes #751" This reverts commit 8120b6fb8a4924f8ae717bba9bbda4a2f89e2141 and fixes the regression introduced in 8d22b26448a091c76ab972c0b0603daac5e255e4.
2016-01-19Revert "don't abort when given unmatched '}' with 'start-condition stack ↵Eelco Dolstra
underflow'. This fixes #751" This reverts commit 8d22b26448a091c76ab972c0b0603daac5e255e4. It breaks Nixpkgs: $ nix-env -qa error: syntax error, unexpected IND_STR, expecting '}', at /home/eelco/Dev/nixpkgs-stable/pkgs/top-level/python-packages.nix:7605:8
2016-01-12don't abort when given unmatched '}' with 'start-condition stack underflow'. ↵Fabian Schmitthenner
This fixes #751
2016-01-05Edge condition: parser did not pick up floats starting exactly with 0.Christian Theune
2016-01-05Fix up float parsing.Christian Theune
2016-01-05Try a simplified version of float lexing that didn't work.Christian Theune
The last one I tried was botchered anyway ...
2016-01-05First hit at providing support for floats in the language.Christian Theune
2015-07-03Fix the parsing of "$"'s in strings.Guillaume Maudoux
2015-07-03Fix the hack that resets the scanner state.Guillaume Maudoux
2015-02-19Allow the leading component of a path to be a ~Shea Levy
2014-08-20Use proper quotes everywhereEelco Dolstra
2014-01-14Allow "bare" dynamic attrsShea Levy
Now, in addition to a."${b}".c, you can write a.${b}.c (applicable wherever dynamic attributes are valid). Signed-off-by: Shea Levy <shea@shealevy.com>
2013-09-02Fix whitespaceEelco Dolstra
2013-08-19Store Nix integers as longsEelco Dolstra
So on 64-bit systems, integers are now 64-bit. Fixes #158.
2013-08-02Add comparison operators ‘<’, ‘<=’, ‘>’ and ‘>=’Eelco Dolstra
2013-03-14Fix building against Bison 2.6Eelco Dolstra
2012-09-27Allow dashes in identifiersEelco Dolstra
In Nixpkgs, the attribute in all-packages.nix corresponding to a package is usually equal to the package name. However, this doesn't work if the package contains a dash, which is fairly common. The convention is to replace the dash with an underscore (e.g. "dbus-lib" becomes "dbus_glib"), but that's annoying. So now dashes are valid in variable / attribute names, allowing you to write: dbus-glib = callPackage ../development/libraries/dbus-glib { }; and buildInputs = [ dbus-glib ]; Since we don't have a negation or subtraction operation in Nix, this is unambiguous.
2011-08-06* Add a Nix expression search path feature. Paths between angleEelco Dolstra
brackets, e.g. import <nixpkgs/pkgs/lib> are resolved by looking them up relative to the elements listed in the search path. This allows us to get rid of hacks like import "${builtins.getEnv "NIXPKGS_ALL"}/pkgs/lib" The search path can be specified through the ‘-I’ command-line flag and through the colon-separated ‘NIX_PATH’ environment variable, e.g., $ nix-build -I /etc/nixos ... If a file is not found in the search path, an error message is lazily thrown.
2011-07-13* Allow a default value in attribute selection by writingEelco Dolstra
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
2010-10-23* Optimise string constants by putting them in the symbol table.Eelco Dolstra
2010-05-06* Store attribute positions in the AST and report duplicate attributeEelco Dolstra
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-21* Fix the interpretation of ''\<character> in indented strings.Eelco Dolstra
2010-04-12* Indented strings.Eelco Dolstra
2010-04-12* More missing constructs.Eelco Dolstra
2010-04-12* Don't use ATerms for the abstract syntax trees anymore. NotEelco Dolstra
finished yet.
2010-04-12* Don't use ATerms to represent integers in the lexer.Eelco Dolstra
2008-08-14* Added an experimental feature suggested by Andres: ellipses ("...")Eelco Dolstra
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-02-05* Fix the parsing ofEelco Dolstra
'' '${foo}' '' where the antiquote should work as expected, instead of giving the string "'${foo}'".
2007-12-06* Syntax to escape '', ${.Eelco Dolstra
2007-11-30* Added a new kind of multi-line string literal delimited by twoEelco Dolstra
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.
2006-10-16* Big cleanup of the semantics of paths, strings, contexts, stringEelco Dolstra
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-02* Finally, a real "let" syntax: `let x = ...; ... z = ...; in ...'.Eelco Dolstra
2006-10-02* Hack for Bison 2.3 compatability.Eelco Dolstra
2006-09-04* Compile the lexer as C++ code. Remove all the redundant C/C++Eelco Dolstra
marshalling code.
2006-09-04* Use a proper namespace.Eelco Dolstra
* Optimise header file usage a bit. * Compile the parser as C++.
2006-09-01* Allow "$" in strings as long as they are not followed by "{". (TooEelco Dolstra
bad flex doesn't have lexical restrictions, the current solution isn't quite right...)
2006-08-16* Handle carriage returns. Fixes NIX-53.Eelco Dolstra
2006-05-01* Disallow unescaped $ in string literals.Eelco Dolstra
2006-05-01* String interpolation. Expressions likeEelco Dolstra
"--with-freetype2-library=" + freetype + "/lib" can now be written as "--with-freetype2-library=${freetype}/lib" An arbitrary expression can be enclosed within ${...}, not just identifiers. * Escaping in string literals: \n, \r, \t interpreted as in C, any other character following \ is interpreted as-is. * Newlines are now allowed in string literals.
2005-07-25* Added a list concatenation operator:Eelco Dolstra
[1 2 3] ++ [4 5 6] => [1 2 3 4 5 6]
2004-10-27* Bug fix in parsing of /* ... */ comments; due to longest matchEelco Dolstra
regexp there could be only one such comment per file.
2004-10-25* New language feature: with expressions.Eelco Dolstra
The expression `with E1; E2' evaluates to E2 with all bindings in the attribute set E1 substituted. E.g., with {x = 123;}; x evaluates to 123. That is, the attribute set E1 is in scope in E2. This is particularly useful when importing files containing lots definitions. E.g., instead of let { inherit (import ./foo.nix) a b c d e f; body = ... a ... f ...; } we can now say with import ./foo.nix; ... a ... f ... I.e., we don't have to say what variables should be brought into scope.
2004-03-28* Added plain lambdas, e.g., `let { id = x: x; const = x: y: x; }'.Eelco Dolstra
`bla:' is now no longer parsed as a URL. * Re-enabled support for the `args' attribute in derivations to specify command line arguments to the builder, e.g., ... builder = /usr/bin/python; args = ["-c" ./builder.py]; ...
2004-02-04* An attribute set update operator (//). E.g.,Eelco Dolstra
{x=1; y=2; z=3;} // {y=4;} => {x=1; y=4; z=3;}
2004-02-02* Added syntactic sugar to the construction of attribute sets toEelco Dolstra
`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}'.
2004-01-30* Parser numbers again.Eelco Dolstra
* Include missing files in distributions.