Commit Graph

149 Commits

Author SHA1 Message Date
JT
1949ba080e Add env shorthand 2021-11-04 15:32:35 +13:00
JT
5e42b14026 Documenting some code and doing cleanups 2021-11-03 08:53:48 +13:00
JT
d856cebebd Add a simple scope variable 2021-11-02 16:08:05 +13:00
JT
3176f60b5b
Merge pull request #243 from kubouch/module-files
Loading modules from files
2021-11-01 11:08:03 +13:00
Jakub Žádník
7112664b3f Fix wrong spans of multiple files
The introduction of `use <file.nu>` added the possibility of calling
`working_set.add_file()` more than once per parse pass. Some of the
logic handling the file contents offsets prevented it from working and
hopefully, this commit fixes it.
2021-10-31 17:22:10 +02:00
JT
cf3f3fde92 Add some support for 2021-10-30 07:15:17 +13:00
JT
bac8b8a450 Add initial ctrl-c support 2021-10-28 17:13:10 +13:00
JT
85a69c0a45 WIP 2021-10-26 10:14:21 +13:00
JT
d29208dd9e WIP 2021-10-26 09:04:23 +13:00
JT
f84582ca2b WIP 2021-10-26 06:46:26 +13:00
JT
5d19017603 WIP 2021-10-26 05:58:58 +13:00
JT
baac60a5a7 WIP 2021-10-25 19:42:38 +13:00
JT
b5965ee8ef WIP 2021-10-25 19:31:39 +13:00
JT
b6d269e90a WIP 2021-10-25 17:01:02 +13:00
JT
6024a001b4 Clarify todo/fixmes 2021-10-13 06:44:23 +13:00
Jakub Žádník
77c520e10b Make predeclarations scoped; Add hiding tests
In some rare cases, the global predeclarations would clash, for example:

  > module spam { export def foo [] { "foo" } }; def foo [] { "bar" }

In the example, the `foo [] { "bar" }` would get predeclared first, then
the predeclaration would be overwritten and consumed by `foo [] {"foo"}`
inside the module, then when parsing the actual `foo [] { "bar" }`, it
would not find its predeclaration.
2021-10-10 14:31:13 +03:00
Jakub Žádník
40741254f6 Rewrite hiding system
Hiding definitions now should work correctly with repeated use of 'use',
'def' and 'hide' keywords.

The key change is that 'hide foo' will hide all definitions of foo
that were defined/used within the scope (those from other scopes are
still available). This makes the logic simpler and I found it leads to a
simpler mental map: you don't need to remember the order of defined/used
commands withing the scope -- it just hides all.
2021-10-10 13:18:47 +03:00
JT
4ddc953e38 Port help and start porting split 2021-10-09 14:02:01 +13:00
JT
31ce8c1e33 Variable completions and better ls 2021-10-05 15:46:24 +13:00
Jakub Žádník
9737d4a614 Change comments 2021-10-04 20:33:27 +03:00
JT
1d7ab28a0f
Merge pull request #74 from kubouch/module-export
Modules: export & hide
2021-10-03 06:25:43 +13:00
Jakub Žádník
81cd03626d
Merge branch 'main' into module-export 2021-10-02 18:53:35 +03:00
Fernando Herrera
03339beae1 prompt with env variable 2021-10-02 14:10:28 +01:00
JT
c5e9ff5f14 add ps and early help 2021-10-02 10:53:13 +13:00
Jakub Žádník
fb0f83e574 Disallow hiding the same def twice; Add tests
Tests got removed after rebase.
2021-10-02 00:12:30 +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
JT
47421e9ca7
Merge pull request #69 from kubouch/simple-module
Primitive module implementation
2021-09-27 05:14:23 +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
Fernando Herrera
d9c42eb194 contents declaration 2021-09-25 17:28:15 +01:00
Kat Marchán
a7ecf7af90
add magical debugging code to SourceCode impl for future debugging 2021-09-21 17:54:20 -07: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
Fernando Herrera
bafc50fd5c external command 2021-09-19 20:29:58 +01:00
Fernando Herrera
8f07f40f22 external call 2021-09-12 16:34:43 +01:00
JT
abda6f148c Finish up completions 2021-09-10 10:09:40 +12:00
Tanishq Kancharla
ecbe7bf8d7 move value into its own folder 2021-09-07 22:26:57 -04:00
JT
a8646f94ab Add cell paths for streams 2021-09-07 19:35:59 +12:00
JT
b0ab78a767 Switch tables to list/streams of records 2021-09-07 19:07:11 +12:00
JT
4ce9a5c894 Make variable assignment convert streams to full values 2021-09-07 06:05:46 +12: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
d9cff4238d clippy 2021-09-04 19:59:38 +12:00
JT
750502c870 Fix up for_in 2021-09-03 14:57:18 +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