John Wiegley
852aff04e7
Break apart MonadNix, to allow greater flexibility in evaluators
2018-03-31 14:53:38 -07:00
John Wiegley
b89b795abe
Some improvements to error traces
2018-03-30 23:10:44 -07:00
John Wiegley
d08ca26da0
Add informative backtraces on evaluation failure
2018-03-30 23:10:44 -07:00
John Wiegley
74cc1a2ad5
Split MonadNix into evaluation and environmental effects
2018-03-30 14:25:03 -07:00
John Wiegley
9f6c2ba948
Move a lot of code around into new modules
2018-03-30 14:08:38 -07:00
John Wiegley
0b812d5c94
Correctly support 'with' by distinguishing weak scopes from non-weak
2018-03-30 13:18:24 -07:00
John Wiegley
a4a2fc0659
Move the linting code into its own module
2018-03-30 12:45:23 -07:00
John Wiegley
22924a591f
Implement getEnv, set TEST_VAR=foo for the language tests
2018-03-30 02:16:52 -07:00
John Wiegley
c234849fd6
Fix a few tests by making a small change to printNix
2018-03-30 02:07:08 -07:00
John Wiegley
8e944cc223
Fix the tests
2018-03-30 02:00:36 -07:00
John Wiegley
b456eba4d6
Add some test files
2018-03-30 01:14:06 -07:00
John Wiegley
4e698d76fa
More fixes to lazy evaluation and scoping
2018-03-30 01:11:27 -07:00
John Wiegley
8f24c7b645
Implement laziness, although without support for concurrency
2018-03-29 15:35:12 -07:00
John Wiegley
84918aa1d3
Remove the MonadFix requirement, it was not needed; fix NRecSet
2018-03-28 23:52:07 -07:00
John Wiegley
d77e52e9d4
Don't run the language tests (say, on Travis) unless LANGUAGE_TESTS=yes
2018-03-28 16:30:54 -07:00
John Wiegley
dfee8cd2b8
Add checkExpr, which checks for errors in Nix expressions
...
This allows us to pass 10 more of the NixLanguageTests, so that after parsing
a file containing "x: y", we can report that y is undefined.
2018-03-28 16:27:35 -07:00
John Wiegley
39f772ef3c
Restore monadic abstraction (to support importFile), fix attribute sets
2018-03-28 14:45:10 -07:00
John Wiegley
124530c9a9
Fix at-right patterns
2018-03-27 22:53:52 -07:00
John Wiegley
3a29249e43
Normalize import statements, add option parsing
2018-03-27 21:59:27 -07:00
John Wiegley
1e0e47d064
Remove monadic context from evalExpr: we weren't using it!
2018-03-27 19:07:08 -07:00
John Wiegley
278916a9ab
Further work on argument evaluation
2018-03-27 18:42:31 -07:00
John Wiegley
ecd18e3da3
Merge branch 'master' into fix-recursive-argument-set
2018-03-27 14:34:28 -07:00
Georges Dubus
2e26bd75a5
Fix a bug where defaultargs are absent from the atpattern argument
2018-03-11 12:15:33 +01:00
Georges Dubus
0f7332636e
Add support for variadic parameters
...
Everything was already in place, but not used for variadic parameters.
On the other hand fixed parameters sets are currently bugged, as they don't
reject extra arguments (they act like variadic parameters set). This commit adds
a TODO mentionning that.
2018-03-09 14:09:43 +01:00
Kosyrev Serge
0693768550
Fix #93 : true/false being mis-parsed when part of an attribute name.
2018-03-06 04:14:16 +03:00
Georges Dubus
6a8ae208b4
Use environment in evaluation of function definitions
2018-03-01 20:04:54 +01:00
Allen Nelson
46bb504ccc
whack that mole
2018-02-28 11:45:34 -06:00
Allen Nelson
cbee241685
remove mkDots test, no longer necessary
2018-02-28 10:59:53 -06:00
John Wiegley
f2ceb7513d
Merge pull request #82 from layus/nix-test
...
Run nix language tests from upstream
2018-02-20 16:07:41 -08:00
Guillaume Maudoux
25f1da3408
Run lang tests from upstream
2018-02-15 12:06:09 +01:00
Georges Dubus
e73fc5d196
More WIP
2018-02-13 15:49:46 +01:00
Guillaume Maudoux
0914047115
Handle let { body = ... }
expressions
2018-02-10 13:30:33 +01:00
Georges Dubus
7b651303e2
WIP fix recursive default args
2018-01-29 19:56:58 +01:00
Georges Dubus
b61b5791bb
Change the environment in evaluation to be a Map Text (NValue m)
...
Currently, the environment is passed as a `NValue m`, but is assumed to be
a set every single time it is used. This commit changes it `Map Text (NValue
m)`. Since this is used a lot, it defines a new type alias:
```
type ValueSet m = Map.Map Text (NValue m)
```
This has multiples benefits:
- Simplify some code by removing all the checks that the env is indeed a set
- Simplify the usage of the module by making clear that we need a set as the
environment. (I especially like this, since it took me a while to figure out
what that argument was supposed to be the first time).
- Make it simple to inject functions in the environment (for example to have
builtins) since now the function definition doesn't need to unwrap the set.
2018-01-28 23:27:33 +01:00
Rhys
0d456691b5
Escape ${ but not plain $ in indented strings
...
Includes some very basic regression tests, but no change for
non-indented strings.
2017-05-31 21:24:43 +10:00
Profpatsch
8b4c137a3b
Shorthands.hs, mkDot/mkDots: automatically quote non-symbols
...
Nix can accept (nearly?) arbitrary values as attributes, if they are quoted in
strings. So generating “dots” should always result in valid nix attributes.
This uses the same regex as the nix lexer (as of 1.11).
Also add a few tests whether it correctly generates symbol/non-symbol
attributes.
2017-04-21 03:54:06 +02:00
Rhys
c15de4532a
Correctly parse identifiers with reserved word prefixes
2017-04-17 19:33:57 +10:00
Allen Nelson
99b52fe48e
separate expr into types and shorthands
2016-01-25 01:00:27 -06:00
Allen Nelson
f04ccf9476
use KeyName list instead of AttrPath list
2016-01-24 18:01:45 -06:00
Allen Nelson
80a7dcb684
bump version, separate back out different kinds of params
2016-01-23 18:11:26 -06:00
Allen Nelson
29acdfe988
remove types for rec/nonrec, make unit tests pass
2016-01-23 17:32:45 -06:00
Allen Nelson
50a3d0d0db
make tests pass
2016-01-23 15:51:34 -06:00
Allen Nelson
d3a1e7207f
split into more modules, rename some things, add docs
2016-01-23 15:23:18 -06:00
Anders Papitto
00d7f06dd0
add some evaluation tests and fix bug
2015-12-20 22:17:34 -08:00
Allen Nelson
9765256ab4
parsing variadic functions, avoiding empty list error
2015-06-23 19:19:46 -05:00
Benno Fünfstück
1b82727a17
Use data-fix for Fix and fix path parsing bug
2014-09-27 20:12:30 +02:00
Benno Fünfstück
c89db27dd9
Add some more tests for edge cases
2014-08-31 18:06:55 +02:00
Benno Fünfstück
94b7e4b1d7
tests for comment parsing and parser benchmarks
2014-08-27 23:54:31 +02:00
Benno Fünfstück
3a08227c0c
Parse double unary - correctly and improve perf
...
We now don't use `buildExpressionParser` from parsers because it cannot
deal with double unary `-`, as in `--a`. Because nix doesn't have
operators which have the same precendence but different associativities,
we can greatly simplify the operator parser. This also has the effect of
improving performance and the error messages a bit.
2014-08-27 22:12:12 +02:00
Benno Fünfstück
f3ec70192c
parse // in paths correctly as update operator
2014-08-20 15:47:41 +02:00