Commit Graph

30 Commits

Author SHA1 Message Date
Qi Xiao
6992c0b693 Make pseudomaps print like [^tag &key=value].
Also make file:pipe output a struct map rather than a pseudomap.
2023-07-17 23:41:43 +01:00
Qi Xiao
d48b6f1843 pkg/eval/vals: Replace MakeListFromStrings with a generic MakeListSlice. 2022-06-17 16:50:38 +01:00
Qi Xiao
f42c2dda61 Make init value of $f~ actually identical to $nop~.
This fixes #1519.
2022-06-07 20:20:00 +01:00
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
d9e14da0db Export eval.Closure and (*eval.Frame).Fork. 2021-12-31 14:28:30 +00:00
Qi Xiao
de5f0e0d32 Add new util vals.MakeListFromStrings. 2021-12-30 13:09:18 +00:00
Qi Xiao
973fe39798 Implement the tmp special command.
This addresses #1114.
2021-12-09 22:12:38 +00:00
Qi Xiao
14a81d12f8 pkg/eval: Initialize ns variables to an empty ns, rather than nil.
This fixes #1257.
2021-12-06 00:18:09 +00:00
Qi Xiao
6a92571a23 Check assignments to read-only variable during compilation. 2021-10-13 23:57:14 +01:00
Kurtis Rader
9a576529a3 Replace ErrArgs with more specific errors
This also replaces the slightly awkward "arguments here" reason with
"argument count" as the "what" for a typical errs.ArityMismatch
exception. It also reformats most of the constructors so that the "what"
is on the same line. This makes `grep errs.ArityMismatch **.go` more
useful as a result.
2021-06-13 22:42:04 +01:00
Qi Xiao
91b6f6dd72 Use the integrated persistent package. 2021-05-03 22:17:46 +01:00
Kurtis Rader
e2759f777b Initialize a command var to $nop~
You cannot assign $nil to a command var so that should not be the initial
value of `var x~`. Instead, assign $builtin:nop~.

Fixes #1248
2021-03-28 22:51:30 -07:00
Qi Xiao
e4fa1cf452 Run gofmt -s on pkg/eval/closure.go. 2021-01-27 01:44:28 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
d97c989219 Introduce edit:add-var and edit:add-vars.
This addresses #1138.
2021-01-17 01:33:25 +00:00
Qi Xiao
56ceeedd21 pkg/eval: Store variable deletion information in *Ns.
This fixes #1213.
2021-01-10 00:54:02 +00:00
Qi Xiao
9af4c83bf6 pkg/eval: Minor cleanups. 2021-01-05 16:05:34 +00:00
Qi Xiao
01612e291b pkg/eval: Clean up closure call implementation.
- Remove reliance on scopeOp, concentrating all the scope for creating the local
  scope in (*closure).call.

- Check options at the very beginning, and include all unsupported options in the
  error.
2021-01-04 13:46:00 +00:00
Qi Xiao
6419f4524a Implement namespaces using slices instead of maps.
More related improvements and cleanups will be done in followup commits.

This fixes #1139.
2020-12-25 17:46:46 +00:00
Qi Xiao
2af7361bd5 pkg/eval: De-export Closure. 2020-09-04 22:18:50 +01:00
Qi Xiao
b04ea12d48 pkg/eval: Refactor effectOp and valuesOp, remove lvaluesOp.
* Make effectOp and valuesOp interfaces - implementations now handle the
  range information themselves.

* Remove lvaluesOp; it is no longer used.
2020-08-22 19:57:11 +01:00
Qi Xiao
1e2ead56e2 pkg/eval: Rewrite the lvalue parsing code.
Also lift the restriction on rest variables and rest arguments - they may now
appear anywhere, as long as there is only one.
2020-08-20 13:15:00 +01:00
Qi Xiao
5874863991 pkg/eval: Use pseudo-structmap to implement closure introspection. 2020-06-29 00:32:00 +01:00
Qi Xiao
20979b44a2 pkg/parse: Use Source values, not pointers.
The Source type is small enough that using values is likely more efficient.
2020-04-25 19:22:38 +01:00
Qi Xiao
b8505c7065 pkg/eval/source.go -> pkg/parse/source.go. 2020-04-25 18:26:17 +01:00
Qi Xiao
07a9e781a6 pkg/eval: Report detailed ArityMismatch errors. 2020-04-13 00:47:33 +01:00
Qi Xiao
ffa9727f14 pkg/eval: Remove Frame.srcRange.
Maintaining a state of current range is error-prone. Instead, always keep track
of range information explicitly.
2020-04-09 20:44:09 +01:00
Qi Xiao
11919e83ec [cleanup] pkg/eval: use diag.Ranging in op types. 2020-03-28 21:33:55 +00:00
Qi Xiao
b3a48ed510 pkg/eval: Revamp Source. 2020-01-11 03:01:30 +00:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00