Commit Graph

25 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
3845a2cf7f Expose stack traces in exceptions as opaque values.
Also document the correct way to compare the causes of exceptions.

This fixes #1632.
2023-02-26 23:52:26 +00:00
Qi Xiao
78862465a4 pkg/diag: Include line:col of start position in Error and Show methods.
The Error methods used to show the start and end indices, while the Show methods
used to show line ranges.

Showing line:col of the start position seems to be pretty standard; both Go and
Rust do that.

I tried including the line:col of the end position too, but can't find a good
enough format.
2022-12-08 19:07:18 +00:00
Kurtis Rader
c6e10f12a2 Some minor documentation fixes
Mostly elimination of duplicated words but also a few other fixes such
as the output of commands such as `%`.
2022-08-29 12:04:59 +01:00
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
59459793e3 pkg/persistent: Cons -> Conj.
Cons was a misnomer for the operation of adding an element at the end of a
vector. Follow Clojure's naming here and call this operation Conj.
2022-01-05 22:34:55 +00:00
Qi Xiao
4776c16b2f Add more test for special forms.
Plus some minor test-related changes.
2021-06-20 18:18:45 +01:00
Qi Xiao
91b6f6dd72 Use the integrated persistent package. 2021-05-03 22:17:46 +01:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
b77a052e7e pkg/eval: Make Exception an interface.
This change is a preparation step for refining all *Op types to return Exception
as the error.

Keeping Exception as a struct type will make such a change error-prone, since
a (*Exception)(nil) != error(nil), so if an *Op returns a nil *Exception, it
is not nil if the return value is stored in an error-typed variable.
2021-01-08 00:56:45 +00:00
Qi Xiao
72d7c5c595 pkg/eval: Minor godoc edits. 2020-09-04 22:10:47 +01:00
Qi Xiao
9b9a6de2cd pkg/eval: Cause -> Reason. 2020-09-04 21:04:58 +01:00
Qi Xiao
bb122024dd pkg/eval: Move test framework into new evaltest package. 2020-09-03 06:51:21 +01:00
Qi Xiao
fca1621294 pkg/eval: Export the StackTrace type. 2020-09-03 05:54:32 +01:00
Qi Xiao
853f00c812 pkg/eval: Fix panic on "show $ok".
This fixes #1064.
2020-07-04 19:08:09 +01:00
Qi Xiao
c5c07bbb81 pkg/eval: Do not crash when showing an exception with nil reason.
This fixes #994.
2020-07-01 21:48:03 +01:00
Qi Xiao
1f562505f3 Rework the API for introspecting exception causes.
* Use a "type" field to identify the type, instead of predicates in the exc:
  module.

* Make the reason values behave more like structmaps, including a Repr that
  mimics a map.

This fixes #208.
2020-06-30 22:27:07 +01:00
Qi Xiao
7b9f784cd5 pkg/eval: Rename fields of Exception, and expose fields as a pseudomap. 2020-06-29 21:26:10 +01:00
Qi Xiao
c65e970951 pkg/eval: ComposeExceptionsFromPipeline -> makePipelineError. 2020-04-10 01:25:55 +01:00
Qi Xiao
bc25c6fe1a pkg/eval: Test all Error methods of the error types.
Also fix a bug in Flow.Error that results in infinite recursion.

This addresses #944.
2020-03-31 00:36:55 +01:00
Qi Xiao
c05f11d3dc [cleanup] pkg/diag: PPrint -> Show. 2020-03-31 00:27:08 +01:00
Qi Xiao
d44363d8cd [cleanup]: Move pkg/util/pprinter.go to pkg/diag. 2020-03-30 23:48:22 +01:00
Qi Xiao
0d30e926c9 [cleanup] pkg/eval: Simplify ExternalCmdExit to always contain a PID. 2020-03-30 23:38:40 +01:00
Qi Xiao
9d280e9231 [cleanup] pkg/eval: Small stackTrace cleanup. 2020-03-29 14:53:34 +01:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00