Commit graph

526 commits

Author SHA1 Message Date
JT
7eb022b58c Adapt tk's work for a source command 2021-10-06 15:29:05 +13:00
Tanishq Kancharla
d481d5ca96 Merge branch 'main' of https://github.com/nushell/engine-q into source-command 2021-10-05 22:16:07 -04:00
Tanishq Kancharla
996ee363b7 comments 2021-10-05 22:03:18 -04:00
Tanishq Kancharla
011ad2e4e6 Merge branch 'source-command' of https://github.com/moonrise-tk/engine-q into source-command 2021-10-05 21:59:26 -04:00
Tanishq Kancharla
d6d0bad7aa reverted 2021-10-05 21:59:16 -04:00
JT
e1ebd461d2
Bump to 0.28 (#4064) 2021-10-06 06:35:25 +13:00
JT
535ece4e76 Add unit parsing and eval support 2021-10-05 15:27:39 +13:00
JT
26166192e5
Merge pull request #89 from kubouch/hide-import-patterns
Add import patterns to 'hide'
2021-10-05 10:44:13 +13:00
Jakub Žádník
6f5f1fa43a Clippy 2021-10-04 22:37:43 +03:00
JT
a88058006a Add path completions 2021-10-05 08:21:31 +13:00
Jakub Žádník
4dacfaa44a Add import pattern support to 'hide' 2021-10-04 20:08:24 +03:00
Tanishq Kancharla
dfd321a679
Merge branch 'main' into source-command 2021-10-03 14:25:00 -04:00
Tanishq Kancharla
909b7d2160 no-op 2021-10-03 14:23:23 -04:00
Jakub Žádník
81cd03626d
Merge branch 'main' into module-export 2021-10-02 18:53:35 +03:00
JT
5843acec02 Add wrap and get and cell_path parsing 2021-10-02 15:59:11 +13:00
Tanishq Kancharla
8ef16c6da6 add source command 2021-10-01 22:25:35 -04:00
Tanishq Kancharla
e1a0ad2987 fix more merge conflicts 2021-10-01 22:24:43 -04:00
Tanishq Kancharla
16c60f44d5 merge w/ upstream 2021-10-01 22:09:16 -04:00
Tanishq Kancharla
adb92b970e nothing 2021-10-01 22:07:17 -04:00
Jakub Žádník
6595c06598 Relax panic into error
Convert the panic when declaration cannot find predeclaration into an
error. This error is already covered and reported in the predeclaration
phase.
2021-10-02 03:42:35 +03:00
Jakub Žádník
25b05dec9e Fix panic on double def; Tests; Double def error
* Fixes a panic with defining two commands with the same name caused by
  declaration not found after predeclaration.
* Adds a new error if a custom command is defined more than once in one
  block.
* Add some tests
2021-10-01 23:25:24 +03:00
Jakub Žádník
2af8116f50 Fix hiding logic; Fix hiding with predecls
* Hiding logic is simplified and fixed so you can hide and unhide the
  same def repeatedly.
* Separates predeclared ids into its own data structure to protect them
  from hiding. Otherwise, you could hide the predeclared variable and
  the actual def would panic.
2021-10-01 23:24:57 +03:00
Jakub Žádník
7488254cca Implement a rough version of 'hide'
'hide' command is used to undefine custom commands
2021-10-01 23:24:54 +03:00
Jakub Žádník
3cbf99053f Throw an error if using export outside of module 2021-10-01 23:21:30 +03:00
Jakub Žádník
93521da9d8 Add 'export def' command 2021-10-01 23:21:28 +03:00
Jakub Žádník
561feff365 Introduce 'export' keyword 2021-10-01 23:19:39 +03:00
Jakub Žádník
1b89ccf25b Add comment 2021-10-01 23:19:39 +03:00
Tanishq Kancharla
e00755a2e9 fix compile errors 2021-09-30 23:04:56 -04:00
Squirrel
4e0d7bc77c
Less deps (#4038)
* compiles on nightly now. (breaking change)

* less deps

* Switch over to new resolver

(it's been stable for a while.)

* let's leave num-format for another PR
2021-09-28 07:17:00 +13:00
Tanishq Kancharla
719920fa37 tried to move source command into parser (still doesn't compile) 2021-09-27 08:10:18 -04:00
JT
84d0e0a059 More forgiving def parse 2021-09-27 14:03:50 +13:00
JT
0a48bc973d
Merge pull request #72 from nushell/import_patterns
Add import lists
2021-09-27 13:32:36 +13:00
JT
0108a935ed add import lists 2021-09-27 13:23:22 +13:00
Jakub Žádník
9ee4dc49ee Fix wrong error span 2021-09-27 00:02:20 +03:00
JT
abb0d7bd22 Add support for module imports 2021-09-27 07:39:19 +13:00
Jakub Žádník
f57f7b2def Allow adding definitions from module into scope 2021-09-26 13:53:52 +03:00
Jakub Žádník
9e176674a5 Start parsing 'use'; Add Use command 2021-09-26 13:25:52 +03:00
Jakub Žádník
12cf1a8f83 Allow adding module blocks to engine state 2021-09-26 12:12:32 +03:00
Jakub Žádník
e9f1575924 Add a module command 2021-09-26 01:59:18 +03:00
Jakub Žádník
a176f12c9e Start simple module parsing 2021-09-25 17:14:20 +03:00
Kat Marchán
5d442a287f
deps: bump to miette 3.0 mainline 2021-09-22 16:50:57 -07:00
JT
0ccbebee7a multiline validation 2021-09-22 17:29:53 +12:00
Kat Marchán
2553da3dc4
bump miette to fix multi-file rendering bug 2021-09-21 17:57:16 -07:00
Kat Marchán
32f39c2fb8
use miette's new panic hook 2021-09-21 12:47:52 -07:00
Kat Marchán
c87414e462
Fix issue with unexpected EOF rendering in miette 2021-09-21 09:30:43 -07:00
JT
3c18cac134 use the fancy 2021-09-21 16:10:29 +12:00
JT
4841d62d76 Add some improvements to errors 2021-09-21 16:03:06 +12:00
Kat Marchán
a1d6cefdf8
replace codespan-reporting with miette 3.0 2021-09-20 17:14:20 -07:00
Jakub Žádník
349af05da8
Do not throw error for files not found in lib_dirs (#4029) 2021-09-20 13:44:47 -05:00
JT
8581bec891
bump 0.37.1 (#4019) 2021-09-16 13:32:22 +12:00
JT
1d80a68f4c
bump to 0.37 (#4006) 2021-09-15 06:44:24 +12:00
JT
b4f918b889 Very early proof-of-concept git branch completion 2021-09-14 16:59:46 +12:00
Fernando Herrera
7aa1d8ac2a error check on def and alias 2021-09-13 20:59:11 +01:00
JT
d7a3c7522b Fix test 2021-09-13 20:19:05 +12:00
JT
4dfde7393b Merge branch 'main' into block_param_types 2021-09-13 19:59:18 +12:00
JT
32c1f0c8d4 better it detection and block params in shapes 2021-09-13 19:54:13 +12:00
JT
eb67eab122 WIP 2021-09-13 19:31:11 +12:00
JT
d88e46d2d1
Merge pull request #45 from kubouch/left-unbounded-ranges
Allow parsing left-unbounded range (..10)
2021-09-13 05:01:07 +12:00
JT
caa6236f1f
Merge pull request #44 from kubouch/float-ranges
Floating point ranges
2021-09-13 04:59:51 +12:00
JT
f459f77335
Merge pull request #40 from elferherrera/parse-error
Parse errors for def, let and alias
2021-09-13 04:58:25 +12:00
Fernando Herrera
66c58217af change message 2021-09-12 16:36:16 +01:00
Jakub Žádník
e6a2e27e33 Fix failing compilation after rebase 2021-09-12 15:57:49 +03:00
Jakub Žádník
8577d3ff41 Check for left-unbounded range before external cmd 2021-09-12 15:56:58 +03:00
Jakub Žádník
78054a5352 Allow parsing left-unbounded range (..10)
It is implemented as a preliminary check when parsing a call and relies
on a fact that a token that successfully parses as a range is unlikely
to be a valid path or command name.
2021-09-12 15:56:58 +03:00
Jakub Žádník
ce0b5bf4ab Add test for float ranges 2021-09-12 15:36:54 +03:00
Jakub Žádník
cc5c4d38bb
Small fixes and refactors to paths & source command (#3998)
* Expand path when converting value -> PathBuf

Also includes Tagged<PathBuf>.

Fixes #3605

* Expand path for PATH env. variable

Fixes #1834

* Remove leftover Cows after nu-path refactor

There were some unnecessary Cow conversions leftover from the old
nu-path implementation.

* Use canonicalize in source command; Improve errors

Previously, `source` used `expand_path()` which does not follow
symlinks.

As a follow up, I improved the source error messages so they now tell
why the source file could not be canonicalized or read into string.
2021-09-12 02:36:14 +03:00
JT
648fe052db Merge branch 'main' into wip 2021-09-12 09:26:47 +12:00
JT
55aa70c88a WIP 2021-09-12 09:26:35 +12:00
Fernando Herrera
9c98783917 clippy correcgtions 2021-09-11 13:16:40 +01:00
Fernando Herrera
4b8ba29cdb check for = before internal parsing 2021-09-11 13:07:19 +01:00
Jakub Žádník
4749776984 Add stepping to ranges & enable reverse ranges
Follows the following syntax: <start>..<next-value>..<end>
2021-09-11 14:28:46 +03:00
Fernando Herrera
47ee50072e Merge branch 'main' of https://github.com/nushell/engine-q into parse-error 2021-09-11 08:26:29 +01:00
Fernando Herrera
198c884158 change name in error 2021-09-11 08:22:41 +01:00
JT
bfd05772ef Improve completions inside of a pipeline 2021-09-10 20:07:18 +12:00
Fernando Herrera
9a16a8fd06 corrected error check 2021-09-10 08:44:31 +01:00
Fernando Herrera
2ea19aeac0 Merge branch 'main' of https://github.com/nushell/engine-q into parse-error 2021-09-10 08:28:58 +01:00
Fernando Herrera
0794ebf5fa error parsing for def, alias and let 2021-09-10 08:28:43 +01:00
Tom Panton
55eafadf02
Improve error message when bash-style alias syntax is mistakenly used (#3995) 2021-09-10 10:44:55 +12:00
Marcin Puc
51c74eebd0
Add general refactorings (#3996) 2021-09-10 10:44:22 +12:00
JT
bb6781a3b1 Add row conditions 2021-09-10 09:47:20 +12:00
JT
2d7192e390 Add parser README, some parser fixups 2021-09-09 06:54:27 +12:00
JT
6dd9f05ea1 Add an experimental record iteration 2021-09-08 10:00:20 +12:00
JT
b0ab78a767 Switch tables to list/streams of records 2021-09-07 19:07:11 +12:00
JT
e00da070fd Fail more gently for bad list/table parses 2021-09-07 15:56:30 +12:00
JT
bdce34676a Allow rest vars to have a custom name 2021-09-07 15:37:02 +12:00
JT
3b7d7861e3 Add cell paths 2021-09-07 10:02:24 +12:00
Fernando Herrera
f7a19d37c6 one parser function 2021-09-06 21:41:30 +01:00
JT
979faf853a Block params 2021-09-06 14:20:02 +12:00
JT
aaee3a8b61 WIP 2021-09-06 11:16:27 +12:00
JT
57677a50b5 Fix #15 2021-09-06 06:44:18 +12:00
JT
6ebc97dec2
Update parser.rs 2021-09-06 06:09:36 +12:00
Jakub Žádník
56c8987e0f Add '.' and '-' to restricted characters
This means that commands cannot start with these characters.
However, we get the following benefits:
* Negative numbers               > -10
* Ranges with negative numbers   > -10..-1
* Left-unbounded ranges          > ..10
2021-09-05 20:33:53 +03:00
Jakub Žádník
7ae4ca88b6 "Fix" failing CI 2021-09-05 11:03:04 +03:00
Jakub Žádník
f0d469f1d4 Fix clippy warnings 2021-09-05 01:40:15 +03:00
Jakub Žádník
6b4fee88c9 Fmt 2021-09-05 01:35:08 +03:00
Jakub Žádník
672fa852b3 Add some tests to range parsing 2021-09-05 01:25:31 +03:00
Jakub Žádník
0b412cd6b3 Add support for positive integer ranges
Including support for variables and subexpressions as range bounds.
2021-09-05 00:52:57 +03:00
Fernando Herrera
ab307c8d38 Merge branch 'main' of https://github.com/jonathandturner/engine-q into similar-name 2021-09-04 09:10:38 +01:00
Fernando Herrera
a3d4794341 moved test to protocol 2021-09-04 09:10:31 +01:00
JT
25c7d8ead6
Merge pull request #13 from jntrnr/ci
Add CI
2021-09-04 20:09:05 +12:00
JT
d9cff4238d clippy 2021-09-04 19:59:38 +12:00
Fernando Herrera
ca8d311c78 Merge branch 'main' of https://github.com/jonathandturner/engine-q into similar-name 2021-09-04 08:45:55 +01:00
Fernando Herrera
acc035dbef signature check for similar name 2021-09-04 08:45:49 +01:00
JT
5e33b8536b Add discrete list/table 2021-09-04 18:52:28 +12:00
JT
74bb2af3e1 Fix up block parse recovery 2021-09-04 08:58:44 +12:00
JT
b20c4047d4 Some cleanup, better subexpressions 2021-09-03 19:35:29 +12:00
JT
bc3f820227
Merge pull request #10 from jntrnr/value_streams_in_value
Value streams in value
2021-09-03 15:49:27 +12:00
JT
df63490266 Fix up calls and pipelines 2021-09-03 14:15:01 +12:00
JT
7c8504ea24 Add commands 2021-09-03 10:58:15 +12:00
JT
94687a7603 Back to working state 2021-09-03 06:21:37 +12:00
JT
e1be8f61fc WIP 2021-09-02 20:25:22 +12:00
JT
3d252a9797 Add nu-protocol 2021-09-02 13:29:43 +12:00
Fernando Herrera
4ed79614ac removed unused empty function 2021-09-01 21:34:16 +01:00
Fernando Herrera
73f6a57b12 upper comments get attached to command 2021-09-01 21:05:37 +01:00
Fernando Herrera
5da2ab1b7d comments with a newline dont get together 2021-08-31 20:33:41 +01:00
JT
d0be193307
Merge pull request #7 from elferherrera/tests
Tests for lex and lite parser
2021-08-31 12:07:46 +12:00
Fernando Herrera
b3fb106cce tests for lex and lite parser 2021-08-30 19:36:07 +01:00
JT
46d2efca13 Fix table parsing 2021-08-29 07:17:30 +12:00
Jakub Žádník
d95375d494
nu-path crate refactor (#3730)
* Resolve rebase artifacts

* Remove leftover dependencies on removed feature

* Remove unnecessary 'pub'

* Start taking notes and fooling around

* Split canonicalize to two versions; Add TODOs

One that takes `relative_to` and one that doesn't.
More TODO notes.

* Merge absolutize to and rename resolve_dots

* Add custom absolutize fn and use it in path expand

* Convert a couple of dunce::canonicalize to ours

* Update nu-path description

* Replace all canonicalize with nu-path version

* Remove leftover dunce dependencies

* Fix broken autocd with trailing slash

Trailing slash is preserved *only* in paths that do not contain "." or
"..". This should be fixed in the future to cover all paths but for now
it at least covers basic cases.

* Use dunce::canonicalize for canonicalizing

* Alow cd recovery from non-existent cwd

* Disable removed canonicalize functionality tests

Remove unused import

* Break down nu-path into separate modules

* Remove unused public imports

* Remove abundant cow mapping

* Fix clippy warning

* Reformulate old canonicalize tests to expand_path

They wouldn't work with the new canonicalize.

* Canonicalize also ~ and ndots; Unify path joining

Also, add doc comments in nu_path::expansions.

* Add comment

* Avoid expanding ndots if path is not valid UTF-8

With this change, no lossy path->string conversion should happen in the
nu-path crate.

* Fmt

* Slight expand_tilde refactor; Add doc comments

* Start nu-path integration tests

* Add tests TODO

* Fix docstring typo

* Fix some doc strings

* Add README for nu-path crate

* Add a couple of canonicalize tests

* Add nu-path integration tests

* Add trim trailing slashes tests

* Update nu-path dependency

* Remove unused import

* Regenerate lockfile
2021-08-28 15:59:09 +03:00
Markus Westerlind
1c1c58e802
Remove duplicate dependencies (#3961)
* chore: Replace surf with reqwest

Removes a lot of older, duplication versions of some dependencies
(roughtly 90 dependencies removed in total)

* chore: Remove syn 0.11

* chore: Remove unnecessary features from ptree

Removes some more duplicate dependencies

* cargo update

* Ensure we run the fetch and post plugins on the tokio runtime

* Fix clippy warning

* fix: Github requires a user agent on requests

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2021-08-28 15:34:11 +12:00
JT
7fe05b8296
bump to 0.36.1 (#3972) 2021-08-27 20:48:58 +12:00
JT
bb9e6731ea More parsing fixes with tests 2021-08-27 11:44:08 +12:00
JT
5dd5a89775 Fix condition parsing for if 2021-08-27 09:48:27 +12:00
Hristo Filaretov
b8e2bdd6b1
Allow different names for ...rest (#3954)
* Allow different names for ...rest

* Resolves #3945

* This change requires an explicit name for the rest argument in `WholeStreamCommand`,
  which is why there are so many changed files.

* Remove redundant clone

* Add tests
2021-08-27 05:58:53 +12:00
Andrés N. Robalino
9d8845d7ad
Allow custom lib dir path for sourcing nu script libraries. (#3940)
Given we can write nu scripts. As the codebase grows, splitting into many smaller nu scripts is necessary.

In general, when we work with paths and files we seem to face quite a few difficulties. Here we just tackle one of them and it involves sourcing
files that also source other nu files and so forth. The current working directory becomes important here and being on a different directory
when sourcing scripts will not work. Mostly because we expand the path on the current working directory and parse the files when a source command
call is done.

For the moment, we introduce a `lib_dirs` configuration value and, unfortunately, introduce a new dependency in `nu-parser` (`nu-data`) to get
a handle of the configuration file to retrieve it. This should give clues and ideas as the new parser engine continues (introduce a way to also know paths)

With this PR we can do the following:

Let's assume we want to write a nu library called `my_library`. We will have the code in a directory called `project`: The file structure will looks like this:

```
project/my_library.nu
project/my_library/hello.nu
project/my_library/name.nu
```

This "pattern" works well, that is, when creating a library have a directory named `my_library` and next to it a `my_library.nu` file. Filling them like this:

```

source my_library/hello.nu
source my_library/name.nu
```

```

def hello [] {
  "hello world"
}
```

```

def name [] {
  "Nu"
end
```

Assuming this `project` directory is stored at `/path/to/lib/project`, we can do:

```
config set lib_dirs ['path/to/lib/project']
```

Given we have this `lib_dirs` configuration value, we can be anywhere while using Nu and do the following:

```
source my_library.nu

echo (hello) (name)

```
2021-08-26 02:04:04 -05:00
JT
35c3622405 Add a few operators. Needs parser work 2021-08-26 07:29:36 +12:00
JT
991a4801b1
Bump to 0.36 (#3963) 2021-08-25 06:01:17 +12:00
Jakub Žádník
e11b400a75
Allow source to accept paths with emojis (#3939)
* Allow sourcing paths with emojis

* Add source command tests for emoji paths

* Fmt

* Disable source tests on Windows with illegal paths

* Test sourcing also ASCII and single-quoted paths
2021-08-19 19:06:18 +12:00
soumil-07
9bd408449e
Add the ability to remove and list aliases (#3879)
* Add the ability to remove and list aliases

* Fix failing unit tests

* Add a test to check unalias shadowing blocks
2021-08-17 08:56:35 -05:00
JT
739425431a improve type inference 2021-08-17 12:26:05 +12:00
JT
dda6554990 Fix up subcommand alias colours 2021-08-17 11:04:45 +12:00
JT
2f43cc353b Fix some expects, add subcommand alias 2021-08-17 11:00:00 +12:00
JT
579814895d Fix up eval params and refactor 2021-08-16 10:33:34 +12:00
JT
1355a5dd33 refactor to subcrates 2021-08-11 06:51:08 +12:00
soumil-07
cd814851da
Use bigdecimal-rs patch (#3905)
* Use bigdecimal-rs patch

* fix nu-serde's bigdecimal dependency
2021-08-07 09:27:19 +12:00
JT
bc682066d8
Bump to 0.35 (#3884) 2021-08-03 20:01:09 +12:00
Lily Mara
762e528ec5
Support equals sign in shorthand environment variable values (#3869)
Some environment variables, such as `RUST_LOG` include equals signs. Nushell
should support this in the shorthand environment variable syntax so that
developers using these variables can control them easily. We accomplish this by
swapping `std::str::split` for `std::str::splitn`, which ensures that we only
consider the first equals sign in the string instead of all of them, which we
did previously.

Closes #3867
2021-07-31 09:10:28 +12:00
Darren Schroeder
1e15f26e98
fix interpolated strings when using unicode (#3866)
* fix interpolated strings when using unicode

* added test case
2021-07-29 19:07:34 -05:00
JT
226739d13f
Bump to 0.34.1 (#3835) 2021-07-25 22:58:33 +12:00
JT
71f4ea9d76
Bump to 0.34.0 (#3766) 2021-07-14 05:57:41 +12:00
Bruce Mitchener
f603b7ef8b
Remove empty trace feature. (#3732)
In `nu-parser`, this was a relic of when nom was used by the parser
and it would enable using `nom-tracable`.
2021-07-06 07:21:28 +12:00
JT
0c82c1920e
Support multiple shorthand env vars (#3692) 2021-06-26 14:15:57 +12:00
JT
b1970f79ee
Add support for arbitrarily nested subcommands (#3688) 2021-06-26 09:09:06 +12:00
Võ Anh Duy
6cdd8a2b07
Fix string interpolation is not working with external command (#3686) 2021-06-26 08:14:54 +12:00
JT
93b5f3f421
Make lexing configurable wrt newlines (#3682) 2021-06-25 17:50:24 +12:00
JT
cac2875c96
Improve def parse errors (#3681) 2021-06-25 17:18:38 +12:00
JT
edbc828fc3
Bump to 0.33.1 (#3671) 2021-06-23 19:57:41 +12:00
Andrés N. Robalino
03c9eaf005
Variable completions. (#3666)
In Nu we have variables (E.g. $var-name) and these contain `Value` types.
This means we can bind to variables any structured data and column path syntax
(E.g. `$variable.path.to`) allows flexibility for "querying" said structures.

Here we offer completions for these. For example, in a Nushell session the
variable `$nu` contains environment values among other things. If we wanted to
see in the screen some environment variable (say the var `SHELL`) we do:

```
> echo $nu.env.SHELL
```

with completions we can now do: `echo $nu.env.S[\TAB]` and we get suggestions
that start at the column path `$nu.env` with vars starting with the letter `S`
in this case `SHELL` appears in the suggestions.
2021-06-23 19:21:39 +12:00
JT
55cab9eb4f
Bump to 0.33 (#3667) 2021-06-22 17:22:33 +12:00
JT
318d13ed58
Add built-in var to refer to pipeline values (#3661) 2021-06-21 12:31:01 +12:00
Niklas Jonsson
a8f6a13239
Move path handling to nu-path (#3653)
* fixes #3616
2021-06-20 11:07:26 +12:00
JT
d9d956e54f
Fix issue in external subexpression paths (#3642)
* Fix issue in external subexpression paths

* new clippy dropped

* clippy
2021-06-18 07:59:58 +12:00
Niklas Jonsson
a59414203f
Only discard command comment if prev token was comment (#3628)
This fixes issues where a file with multiple def commands with their own
doc comments, some of the comments would be discarded.
2021-06-17 14:11:05 +12:00
Andrés N. Robalino
7c8fb060f1
Extract completions into subcrate. (#3631) 2021-06-16 15:20:01 -05:00
Võ Anh Duy
774be79321
Fix syntax hightlight when using Circumflex-Operator (#3613) 2021-06-14 14:21:36 +12:00
JT
fadcdde7f8
Add help flag support to alias (#3595) 2021-06-10 16:28:33 +12:00
JT
d056bf070f
Improve alias highlighting/completions (#3594)
* Improve alias highlighting/completions

* Add example
2021-06-10 13:13:08 +12:00
JT
e8dfd4ba39
Enable syntax/completions for source (#3589) 2021-06-10 09:01:40 +12:00
JT
383e874166
Fix a bunch of future clippy warnings (#3586)
* Fix a bunch of future clippy warnings

* Fix a bunch of future clippy warnings
2021-06-10 07:08:12 +12:00
JT
e8a2250ef8
Improve expr parse (#3584)
* Require '-' to be a number for math

* Add test

* improve parse logic, add test
2021-06-10 05:17:45 +12:00
Jakub Žádník
25ba6ea459
Def cleanup (#3580)
* Remove impossible condition

* Improve def error

* Fmt
2021-06-09 10:06:44 +12:00
JT
16faafb7a8
Rename the use of invocation to subexpression (#3568)
* Rename the use of invocation to subexpression

* Fix test name
2021-06-07 20:08:35 +12:00
JT
c4dc61425d
Simpler parse improvement (#3566) 2021-06-07 18:39:23 +12:00
JT
128f5bce30
Improve partial completion/highlight (#3564) 2021-06-07 16:33:44 +12:00
JT
a2e6f5ebdb
Add hex, octal, binary (#3562) 2021-06-06 17:14:51 +12:00
JT
7d78f40bf6
Bump to 0.32.1 (#3553) 2021-06-04 19:07:50 +12:00
JT
df526f73be
Bump to 0.32 (#3521)
* Bump to 0.32

* Bump to 0.32
2021-06-01 08:14:50 +12:00
Andrés N. Robalino
a5c14ba7d4
Ensure correct partial key=value flag. (#3518) 2021-05-29 23:19:58 -05:00
Andrés N. Robalino
6fdfc84904
Parse key=value named flag support. (#3515) 2021-05-29 20:42:03 -05:00
Jakub Žádník
6ae7884786
Fix path dots expansion (#3491)
* Fix parser expanding dots where it shouldn't

Previously, the parser would expand "a...b" as "a../..b". Now, >2 dots
are only expanded when the whole path component consists of dots (i.e.,
"..." expands to "../.." while "a...b" stays as it is).

* Respect OS separator when expanding >2 dots

"..." now expands to either "../.." or "..\..", based on the host OS.
2021-05-26 20:17:18 +12:00
JT
5fcc7f2328
Fix bad operator (#3479) 2021-05-24 17:27:10 +12:00
Andrés N. Robalino
3bcc2aad80
Pass command's span correctly when reporting unexpected flags. (#3478)
Not all lite command's first part denotes a real command (for cases like sub commands that it's second lite part accounts for the command name). This is important so that we can refer to it's span correctly. Here we fix to include the command's name span correctly whether it's a command or sub command when reporting missing flag errors.
2021-05-23 19:30:30 -05:00
JT
751de20f93
Do a bit more cleanup of block params (#3455)
* Do a bit more cleanup of block params

* Do a bit more cleanup of block params
2021-05-21 19:04:27 +12:00
JT
28388b4e3a
Split unit into duration and filesize (#3453) 2021-05-21 13:21:46 +12:00
JT
4fdbf30308
Paren interpolation (#3452)
* Switch interp to use parens

* improve interp parsing
2021-05-21 10:55:38 +12:00
JT
20f6114617
Improve block params (#3450) 2021-05-20 16:26:54 +12:00
JT
e2973d2176
Add explicit block params (#3444)
* Add explicit block params

* Add explicit block params
2021-05-19 20:23:45 +12:00
JT
d79a3130b8
Make the default int an i64 (#3428)
* Make the default int an i64

* fmt

* Fix random integer

* Treat pids as i64 for now
2021-05-14 20:35:09 +12:00
JT
efac712f62
Fix string interp/shorthand overlap (#3412) 2021-05-12 16:20:29 +12:00
JT
2bb23c57df
Bump to 0.31.1 (#3411) 2021-05-12 15:06:50 +12:00
JT
311c0e3f50
Simplify string interpolation (#3401)
* [DRAFT] simplify string interpolation

* Fix test
2021-05-12 13:53:57 +12:00
JT
25a8caa9b0
Simplify expressions (#3389)
* WIP: experiment with simpler expressions

* fix simple invoke

* update tests

* fix a few tests

* Make paren parsing more robust

* fix external args

* Remove old invocation

* Update tests

* Update tests
2021-05-12 13:01:48 +12:00
JT
48128c9db6
Bump to 0.31.0 (#3405) 2021-05-11 16:44:52 +12:00
onthebridgetonowhere
001123dbd6
Add first prototype of functionality to parse numbers in parantheses (#3209)
* Add first prototype of functionality to parse numbers in parantheses (). Needs testing and more wide-testing+integration

* Fix styling issue

* Try something else by copying existing matching code

* Fix formatting

* Fix the parser to accept numbers in paranthesis. Not really happy with the code, but let's see

* Refactor to only use once the parsing of strings into numbers

* Remove errors that are not used

* Fix formatting

Co-authored-by: Stefan Stanciulescu <contact@stefanstanciulescu.com>
2021-05-06 09:00:55 +12:00
JT
599c43ce04
bump to 0.30.1 (#3348) 2021-04-22 21:07:54 +12:00
JT
3ad4e0348f
Fix external redirect (#3345)
* Fix external redirection

* Fix external redirection
2021-04-22 08:54:34 +12:00
JT
0fc9b6cfa2
Bump to 0.30 (#3333)
* Bump to 0.30

* fix test
2021-04-20 18:34:10 +12:00
JT
61768aa2fd
Fix parsing dot dot path (#3331) 2021-04-20 08:18:29 +12:00
Luccas Mateus
611103d211
Fix Running echo .. starts printing integers forever (#3322) 2021-04-16 07:07:06 +12:00
Jonathan Turner
b791d1ab0d
Move from using a Block to an Arc'd Block (#3289) 2021-04-09 20:12:25 +12:00
Jonathan Turner
81160bcefb
Remove some clones and improve when autoview reads config (#3285) 2021-04-09 07:47:41 +12:00
Jonathan Turner
42fac722bb
Bump to 0.29.2 (#3274)
* Bump to 0.29.2

* Fix test
2021-04-07 08:14:06 +12:00
Mohammed Anas
e5621dea58
Remove yr and mon (#3262)
* Remove `yr` and `mon`

* Remove usage of mon in test

* Fix test
2021-04-05 06:19:33 +12:00
Saeed Rasooli
4c09716ad8
add TiB and PiB (#3257) 2021-04-04 12:08:17 +12:00
Waldir Pimenta
4bc9d9fd3b
Fix typos and capitalization of "Unicode" (#3234)
* Capitalize "Unicode"

* Fix several typos

* Fix mixed whitespace in nu-parser's tests
2021-04-04 07:14:07 +12:00
Luccas Mateus
2146ede15d
Parse decimal units (#3243)
* parse decimal units

* linting

* stop clippy complaining

* Added tests to parsing decimals

* Fixed bug

* Fixed testing and add more
2021-04-03 21:06:13 +13:00
Leonhard Kipp
f03f1949bf
Logs and tests (#3247)
* Add command name to err

* Add var name to error message

* Add test for def comment in test
2021-04-01 17:09:33 -05:00
Jonathan Turner
06b154f4b2
Bump to 0.29.1 (#3232)
* Bump to 0.29.1

* fix test
2021-03-31 20:13:40 +13:00
Jonathan Turner
4faaa5310e
Bump to 0.29 (#3230)
* Bump to 0.29

* fix test
2021-03-30 22:35:21 +13:00
Jonathan Turner
7e184b58b2
Fix warnings for Rust 1.51 (#3214)
* Fix warnings for Rust 1.51

* More fixes

* More fixes
2021-03-26 21:26:57 +13:00