Commit Graph

969 Commits

Author SHA1 Message Date
Qi Xiao
ae3f6279af Change the syntax of "use".
Previsouly, use accepts a module name a🅱️x:y, and imports the file
a/b/x/y.elv (under ~/.elvish/lib) as a🅱️x:y. This makes it clumsy to import
modules in deeply nested directories, because the resulting module name is
very long.

Now it is possible to omit some leading path components in the module name by
specifying them using slashes instead of colons. For example, "use a/b/c/x:y"
imports the same file a/b/c/x/y.elv, but as x:y. In other words, the part
before the last slash is used to derive the filename, but not used in the
module name.

The "use" special form used to accept a second argument for an alternative
filename. That argument has been removed to standardize the way the module
file is found. Relavite imports will be introduced some time in future to
compensate some of the lost functionality.
2017-09-20 11:46:35 +01:00
Qi Xiao
9d07cd9eb4 Add -is-dir. 2017-09-19 00:42:38 +01:00
Qi Xiao
e7a8b96d7d Fix readline-binding. 2017-09-17 23:08:15 +01:00
Qi Xiao
85479b09e6 Add tests for the "assoc" builtin. 2017-09-16 17:50:53 +01:00
Qi Xiao
d1b75c7097 Add a "dissoc" builtin. 2017-09-16 17:48:53 +01:00
Qi Xiao
fbdf5427f9 Add builtin for getting name of current source.
This addresses #327.
2017-09-16 17:15:38 +01:00
Qi Xiao
0d51f22cc9 eval: Use Unwrapper in more places. 2017-09-05 00:15:06 +01:00
Qi Xiao
fad0486457 eval: Replace "muster" with "unwrapper". 2017-09-05 01:05:44 +02:00
Qi Xiao
6d56d74696 Test temp assignment of list/map elements. 2017-09-01 01:24:09 +02:00
Qi Xiao
5125ee0dd1 Reimplement element assignment using Assoc.
This resolves #392 and #422.
2017-09-01 01:07:37 +02:00
Qi Xiao
10633878ad EnvPathList -> EnvList; simplify implementation. 2017-09-01 01:07:35 +02:00
Qi Xiao
015cfc98a4 eval: Use a more efficient implementation for Struct. 2017-09-01 01:07:35 +02:00
Qi Xiao
aa2f8a54ee Implement Assoc for several types. 2017-09-01 01:07:34 +02:00
Qi Xiao
6cfca909ec Use persistent hashmap to implement map.
This resolves #414.
2017-09-01 01:07:20 +02:00
Qi Xiao
4f884b6dbf Add Hash to Value interface. 2017-08-30 20:52:27 +02:00
Qi Xiao
f1b9fb0b45 Eq -> Equal. 2017-08-30 19:47:50 +02:00
Qi Xiao
3c8b78e43b eval: Improve readability of eval_test.go. 2017-08-14 23:57:36 +01:00
Qi Xiao
b2ce7b29e5 Add a "drop" builtin. 2017-08-14 23:33:31 +01:00
Diego Zamboni
e4ae5bbd5d Updates and fixes to narrow.elv (#465)
* Updates and fixes to narrow.elv

- Updated to account for recent syntax fixes.
- Added hook capabilities to all three modes, documented in narrow.elv
- Updated embedded module.
- Added bind_keys function to set key bindings

* Addressed style comments and use not-eq

* Updated embedded module
2017-08-13 22:23:33 +01:00
Qi Xiao
fc3ef31eb8 No backquotes for output capture anymore. 2017-08-13 18:41:33 +01:00
Qi Xiao
4159d2d048 Add a "not-eq" builtin. 2017-08-13 00:44:21 +01:00
Qi Xiao
5e5135fb76 Use eval.PCaptureOutputInner to capture arg completer output. 2017-08-13 00:27:04 +01:00
Qi Xiao
cd58ed6be6 Implement output capture with a more flexible inner function. 2017-08-13 00:18:06 +01:00
Qi Xiao
3168afdaa0 eval: Add benchmarks for output capture. 2017-08-13 00:17:41 +01:00
Qi Xiao
e3d93b72de Change signature of splits to match re:split. 2017-08-05 22:51:16 +02:00
Qi Xiao
0effe54af0 Change the argument order of the replaces builtin to match re:replace. 2017-08-05 22:49:31 +02:00
Qi Xiao
2d6bd1f7d1 Compile and evaluate options in lambda signature.
This fixes #82.
2017-08-05 22:29:17 +02:00
Qi Xiao
a48df99361 Parse options in lambda signature. 2017-08-05 21:50:44 +02:00
Qi Xiao
01220cf3df Remove support for $args and positional variables ($0, $1, $2, ...)
The semantics of signatureless lambdas has been changed to mean "no arguments
accepted" rather than "any arguments accepted".

This fixes #397.
2017-08-05 21:50:13 +02:00
Tw
60db045aec add string replace builtin (#463)
Signed-off-by: Tw <tw19881113@gmail.com>
2017-08-05 13:58:15 +01:00
Adam Schwalm
690d40485d Highlight and complete builtin like other namespaces (#457) 2017-07-23 00:40:00 +02:00
Qi Xiao
66b7f997f7 eval/re: Slight improvement. 2017-07-16 10:49:34 +01:00
Adam Schwalm
54a0c176a6 Fix crash in re:find with some patterns (#439) 2017-07-16 10:46:21 +01:00
Qi Xiao
bed9aa373a Implement Eq for all Value types. 2017-07-15 14:19:26 +02:00
Qi Xiao
4a7a4184ed Add an Eqer interface, and implement for many types.
This is to prepare for the transition to using the custom persistent map
implementation, which requires an Eq method for key types.
2017-07-14 01:28:51 +01:00
Qi Xiao
0fa737412f Move binding tables to separate modules.
For instance, the binding table for insert mode used to be
$edit:binding[insert], but is now $edit:insert:binding.

Also, renames: edit:loc -> edit:location, edit:compl -> edit:completion, and
edit:nav -> edit:navigation.

The embedded readline-binding module has been updated accordingly.
2017-07-14 00:08:32 +01:00
Qi Xiao
ec8aca54f5 Enhance ScanIntoOpts, and rename to ScanOptsToStruct. 2017-07-13 22:29:28 +01:00
xofyarg
4051c558de Add eval.ScanIntoOpts and minor changes to narrow mode (#437)
* Add eval.ScanIntoOpts

eval.ScanIntoOpts is similar to eval.ScanOpts, instead of specifying
each option separately, it accepts an option struct and parse the
options according the struct internally.

Options organized as a group in a struct is more readable and could be
extend in the future if the calling function requires many.

* Use eval.ScanIntoOpts to parse options

* Add max-lines options to control the list size

It does not make sense to show a long list of candidates sometimes.
Adding an option to control the list size.

* Remove usused code

Bindings have been moved to the embedded module.
2017-07-13 16:01:34 +01:00
Qi Xiao
27cd957f20 eval: Add a shorthand type BuiltinFnImpl. 2017-07-13 11:35:06 +01:00
Qi Xiao
ac80ec129b Rename the source builtin to "-source".
The builtin has some interesting interactions with the compiler and must be
used with caution.
2017-07-13 10:54:20 +01:00
Qi Xiao
066baa1b22 eval: Remove MapStringString. 2017-07-13 10:47:36 +01:00
Qi Xiao
263f848aca eval: Add IteratePair, both interface and implementations. 2017-07-13 10:47:36 +01:00
Adam Schwalm
9298098ff1 Support user-defined matcher in completion mode.
This fixes #430, and makes it easier to implement #148, #228, #337 and #396.
2017-07-13 10:47:09 +01:00
Rene Kaufmann
ac86bdec68 Add has-{key,value} for testing key/value existence. (#432)
This fixes #407 and #398.
2017-07-13 10:40:04 +01:00
Qi Xiao
695ef1b719 Add a blackhole variable $_.
This fixes #401.
2017-07-12 23:48:37 +01:00
Qi Xiao
4b72779e83 Add builtin assoc for "modifying" lists. 2017-07-12 00:50:11 +01:00
Qi Xiao
55dd5188c3 Drain channel inputs when command exits.
This fixes #389.
2017-07-11 22:44:55 +01:00
xofyarg
bf3c78cb93 Throw error when builtin source failed (#426)
Explicitly warn user of failure when error occur.
2017-07-11 18:59:06 +01:00
Adam Schwalm
85a3c13185 Fixed bug where output capture discarded final line for outputs without newline (#423) 2017-07-10 18:00:32 +01:00
Laria
4e6456d441 Add keys function (#416)
Yields the keys of a map value
2017-07-09 00:35:51 +01:00