Commit Graph

54 Commits

Author SHA1 Message Date
Joe Hermaszewski c0ed91f8c2
Merge pull request #744 from expipiplus1/joe-sourcepos-whitespace
Use pre-whitespace position for source end locations
2020-11-01 11:46:38 +08:00
Joe Hermaszewski 6b9d4d1890 Restrict type of parens and brackets to prevent negative use of NExprLoc
it is not generally appropriate to have higher-order parsers operate on
annotated locations as they are liable to perform changes to the parser which
are not captured in the annotation.

See https://github.com/haskell-nix/hnix/pull/739 and
https://github.com/haskell-nix/hnix/pull/744 for examples.
2020-10-29 15:28:02 +02:00
Joe Hermaszewski dba7650bc5 Correct location annotation for parenthesized expressions
At the moment parentheses are not included in the location annotation
for nix expressions. This changes the code to include any parentheses in
the SrcSpan of the underlying expression. Information which is difficult
to recover otherwise.
2020-10-29 15:28:02 +02:00
Joe Hermaszewski 731ed878e1 Use pre-whitespace position for source end locations
Fixes https://github.com/haskell-nix/hnix/issues/743
2020-10-25 17:47:11 +08:00
Anton-Latukha 0cb3946ee7
clean-up: (return -> pure)
M  main/Main.hs
M  main/Repl.hs
M  src/Nix/Builtins.hs
M  src/Nix/Convert.hs
M  src/Nix/Effects.hs
M  src/Nix/Effects/Basic.hs
M  src/Nix/Eval.hs
M  src/Nix/Exec.hs
M  src/Nix/Expr/Types.hs
M  src/Nix/Json.hs
M  src/Nix/Lint.hs
M  src/Nix/Normal.hs
M  src/Nix/Options/Parser.hs
M  src/Nix/Parser.hs
M  src/Nix/Scope.hs
M  src/Nix/String.hs
M  src/Nix/TH.hs
M  src/Nix/Thunk/Basic.hs
M  src/Nix/Utils.hs
M  src/Nix/Value.hs
M  src/Nix/Value/Equal.hs
M  src/Nix/XML.hs
M  tests/EvalTests.hs
M  tests/Main.hs
M  tests/NixLanguageTests.hs
M  tests/ParserTests.hs
M  tests/TestCommon.hs
2020-09-21 01:57:52 +03:00
Simon Jakobi 1a2d627a58 Use prettyprinter-1.7.0
Changelog:
http://hackage.haskell.org/package/prettyprinter-1.7.0/changelog

hnix is likely to be affected by this change:

> Use floor instead of round to compute ribbon width.

…due to its use of custom `LayoutOptions`.
2020-08-07 12:21:12 +03:00
Anton-Latukha 20667e55c6
src/Nix/Parser.hs: clean-up imports
M  src/Nix/Parser.hs
2020-06-03 02:37:39 +03:00
Silvan Mosberger 82b2d8af7f Use NSet for both recursive and non-recursive sets
Simplifies the AST
2019-07-25 14:10:44 -07:00
Silvan Mosberger 90f6a61a84 Fix nixUri source span
Previously it would include the spacing after the URI in the source
span.
2019-05-13 07:34:54 -07:00
John Wiegley 77c52fd43c Revise Nix.Standard 2019-03-23 00:49:03 -07:00
John Wiegley 9b046a80c7
Remove unnecessary trailing space 2019-03-18 21:41:27 -07:00
John Wiegley 94e0be3882
Reformat all sources with Brittany, to restore consistency 2019-03-17 14:47:38 -07:00
Madeline Haraj 28ab983408
Add syntactic holes 2019-03-10 10:23:28 -07:00
Vaibhav Sagar 017ce7667a Bump Megaparsec to 7.0.4 2018-11-22 01:16:11 -05:00
John Ericson f227911ce0 Merge remote-tracking branch 'origin/master' into prettyprinter 2018-11-20 18:23:15 -05:00
John Ericson 04abd357bd Switch to prettyprinter 2018-11-17 12:02:26 -05:00
Ryan Trinkle e6b189e69b Eliminate MonadIO from MonadEffects instance for Lazy 2018-11-16 21:30:55 -05:00
Silvan Mosberger 08326ce34a
Parser: export symbol and whiteSpace 2018-09-10 05:10:35 +02:00
Silvan Mosberger 9a74e0cd99
Parser: Export useful partial parsers 2018-09-10 04:28:33 +02:00
Silvan Mosberger c01fa83cb6
Parser: Unify parser names 2018-09-10 04:10:53 +02:00
Silvan Mosberger 67934d030a
Parser: Make Result Functior 2018-09-10 03:30:15 +02:00
John Wiegley 1af979e836
true and false shouldn't be in the reservedNames list
Fixes #343
2018-08-05 12:20:00 -04:00
John Wiegley 84ebf8d9ae
A fix to the way inherit is parsed 2018-05-13 14:10:02 -07:00
John Wiegley d805fa3627
Preserve attr name positions in attrSetAlter 2018-05-10 00:09:42 -07:00
John Wiegley 15baa5c8b8
Track attribute source positions in the binding, not the key name 2018-05-09 01:25:01 -07:00
John Wiegley 449d6611df
Remove the Uri type, it's just sugar
Fixes #308
2018-05-08 12:15:50 -07:00
John Wiegley ce3b0d70e9
Move all of the parsing code into a single module, for optimization 2018-05-07 12:06:56 -07:00
Kaushik Chakraborty bbb72654d7
Parser: support tilde in paths 2018-04-21 11:47:57 +05:30
John Wiegley 47e8829a28 Rename Nix.StringOperations to Nix.Strings 2018-04-20 17:05:21 -07:00
John Wiegley 4163d35a09 nixpkgs allows let with no bindings in some places
At the beginning of arangodb/default.nix:

```
{ stdenv, fetchFromGitHub
, openssl, zlib, python2Packages, readline, cmake, python }:

let
in stdenv.mkDerivation rec {
  version = "3.3.4";
  name    = "arangodb-${version}";
```
2018-04-18 23:42:13 -07:00
John Wiegley a3c4bbfb76 Use NonEmpty for let bindings and attribute selector paths
Note that Nix allows inherit; and inherit (foo);, so we cannot make the list
of inherited names non-empty, even though the former constructions have no
meaning.
2018-04-17 12:46:41 -07:00
John Wiegley c9158273a4 Change all builtins to go from m (NValue m) -> m (NValue m)
This avoids a needless thunk encapsulation.
2018-04-16 21:39:41 -07:00
John Wiegley 8c4b134622 A minor simplification in the parser 2018-04-16 18:45:28 -07:00
John Wiegley 70cebb2aa4 Minor simplifications in the parser 2018-04-12 21:20:03 -07:00
John Wiegley 8068c7b43e Remove some unnecessary uses of "try" 2018-04-10 23:40:32 -07:00
John Wiegley cab50333a1 Minor changes to Parser.hs 2018-04-10 23:26:00 -07:00
John Wiegley 01d1ae99a7 Fix ind-string-14 2018-04-10 18:45:57 -07:00
John Wiegley 48fe7bc698 Further corrections to select and reserved word parsing 2018-04-10 18:02:31 -07:00
John Wiegley 94836d4dad Delete some out-of-sync debug code 2018-04-10 13:13:58 -07:00
John Wiegley a7e7e84795 Drop dependency on insert-ordered-containers
Fixes #161
2018-04-10 11:58:08 -07:00
John Wiegley 23ffa24a59 Fix a Haddock error 2018-04-10 11:46:44 -07:00
John Wiegley 36772456bb Reduce the number of places where top-level forms are tried
This can be significant, since failing to parse a lambda requires a lot of
backtracking, especially in the case where it was actually just a set.
2018-04-10 10:51:46 -07:00
John Wiegley a96b433471 Change pathChar into a predicate 2018-04-10 09:45:04 -07:00
John Wiegley a2391deedf Fix a warning 2018-04-10 09:44:52 -07:00
John Wiegley 12b1a79a2c More corrections to the parser 2018-04-10 09:03:18 -07:00
John Wiegley 8b3c183f9c Remove an unneeded try 2018-04-10 08:35:18 -07:00
John Wiegley 2694f6ffaf More work on the megaparsec parser 2018-04-10 08:34:21 -07:00
John Wiegley 4f9dec43cd More work on the megaparsec parser 2018-04-10 00:40:11 -07:00
John Wiegley 70f21d30ae Passing all the basic parser and evaluation tests now 2018-04-09 23:34:21 -07:00
John Wiegley 8f37f37986 Down to 16 basic test failures with megaparsec 2018-04-09 21:35:46 -07:00