Commit Graph

4773 Commits

Author SHA1 Message Date
Qi Xiao
0b5b210d24 Add exc:show for showing exceptions.
This addresses #945.
2020-05-02 23:28:42 +01:00
Qi Xiao
bffb74f90a pkg/shell: Use fmt.Println to print the recovered value.
The println function does not handle interface values correctly.
2020-05-02 19:28:46 +01:00
Qi Xiao
52bd0aef41 pkg/shell: Do not spawn the daemon when running a script. 2020-04-28 23:41:34 +01:00
Qi Xiao
620415c87f cmd/website/macros: Small refactors. 2020-04-27 10:49:19 +01:00
Kurtis Rader
eef7aa168c Augment @cf expansion to work outside builtin: NS
The @cf documentation command currently only works correctly for the
builtin namespace. This augments the expansion of @cf arguments so
that an explicit namespace can be included. This makes it possible to
cross-reference between namespaces. For example, `@cf builtin:splits`
and `@cf str:split`.
2020-04-27 10:35:28 +01:00
Kurtis Rader
098e0e6880 Document base command 2020-04-27 10:33:02 +01:00
Qi Xiao
663b10d8e2 Suppress deprecations by default.
The behavior is controlled by a global flag that will be flipped for the release
branch. A flag is available to force deprecations to be shown or hidden.
2020-04-26 21:26:53 +01:00
Qi Xiao
90a34f2d19 pkg/eval: Support specifying a callback for the "time" builtin.
This fixes #295.
2020-04-26 21:11:01 +01:00
Qi Xiao
c211679f0c Move all variable creations to start of lexical scope.
Commit 8c71635ca3 moved the creation to the start
of pipelines; the approach works for simplistic cases like "x = 1 | nop", but
fails in more complex cases, such as "nop (x = 1) | nop".

The correct place to hoist variable creations is the lexical scope, and this
commit implements this approach.

This fixes #623.
2020-04-26 19:05:16 +01:00
Qi Xiao
3e9d5e9e60 pkg/eval/str: Add join, replace and split.
The implementations are mostly copied from the builtin joins, replaces and
splits, with small changes to the error behavior in the join function.

The versions in the builtin module are now deprecated.
2020-04-26 17:01:10 +01:00
Qi Xiao
43054831e6 pkg/eval/vals: Support float64 in Kind. 2020-04-26 15:38:09 +01:00
Qi Xiao
c767f92d01 Support compile-time deprecation.
This fixes #898.
2020-04-26 13:14:51 +01:00
Qi Xiao
cf6e048e58 pkg/eval: Support eval-time deprecation warning.
This addresses #898.
2020-04-26 01:13:05 +01:00
Qi Xiao
3fb0098fed pkg/eval: Support checking stderr in tests. 2020-04-26 00:13:06 +01:00
Qi Xiao
88122a019e pkg: Simplify some APIs by using parse.Tree. 2020-04-25 19:36:35 +01:00
Qi Xiao
4d54943ffb Reintroduce the path field of Source as a deprecated feature. 2020-04-25 19:26:04 +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
13f7b29707 pkg/parse: Add a new Parse function and a Tree type.
This replaces the AsChunk function. All current users of parse.AsChunk has been
changed to use parse.Parse instead.
2020-04-25 19:16:22 +01:00
Qi Xiao
21f5a6f7c3 pkg/parse: Turn most public methods of Node into functions.
This make the godoc of the parse package much cleaner and removes some
boilerplate.
2020-04-25 18:55:44 +01:00
Qi Xiao
4b93d4579d pkg/parse: De-export the pprint functions. 2020-04-25 18:31:49 +01:00
Qi Xiao
b8505c7065 pkg/eval/source.go -> pkg/parse/source.go. 2020-04-25 18:26:17 +01:00
Qi Xiao
bc1978f01c website/blog: Document the breaking change of the src command. 2020-04-25 18:06:14 +01:00
Qi Xiao
53a1eca9af pkg/eval: Remove New*Source functions.
All call sites of such functions are replaced with simple &Source{...}
expressions.
2020-04-25 13:22:07 +01:00
Qi Xiao
c112223611 pkg/eval: Simplify API of "src".
Remove the Type and Root fields, and add a new IsFile field.
2020-04-25 12:50:07 +01:00
Qi Xiao
905447eda5 pkg/prog: Improve error handling of CPU profile, and add tests.
This addresses #944.
2020-04-25 01:04:55 +01:00
Qi Xiao
e6c5ebfc23 pkg/prog: Add tests.
This addresses #944.
2020-04-25 00:57:35 +01:00
Qi Xiao
4ac464a168 Drop the web subprogram from the main program.
An alternative main program that includes the web program is available under
cmd/withweb/elvish.

This addresses #375.

RAM consumption measured by 5 executions of `elvish -c 'ps -orss $pid'`:

* w/ web  = 9530 KB

* w/o web = 9319 KB, 211 KB or 2.2% smaller.

Binary size:

* w/ web  = 14361610 bytes

* w/o web = 13810355 bytes, 538 KB or 3.8% smaller
2020-04-25 00:26:40 +01:00
Qi Xiao
78cae6a695 pkg/prog/{shell,web} -> pkg/{shell,web}. 2020-04-25 00:12:18 +01:00
Qi Xiao
928949077b pkg/prog: Move all Program implementations into own packages.
This fixes #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
5b88057c94 pkg/prog: Remove Main; expose Run.
This is to prepare moving all the Program implementations into their respective
packages.

This addresses #985.
2020-04-25 00:12:18 +01:00
Qi Xiao
be471ec761 pkg/program -> pkg/prog. 2020-04-25 00:12:18 +01:00
Qi Xiao
f209ffc7c4 pkg/program: Rewrite test with progtest. 2020-04-25 00:12:18 +01:00
Qi Xiao
be0502368d pkg/program/progtest: New package for program test utilities.
The code is inherited from the test fixture code in pkg/program/shell.
2020-04-25 00:12:18 +01:00
Kurtis Rader
4bfb6e2aad Fix how [ctrl-v] works on BSD systems
On BSD systems iexten has to be explicitly disabled. Whereas on Linux
systems it is implicitly ignored if icanon is disabled.

Fixes #917
2020-04-24 21:41:35 +01:00
Qi Xiao
17419d1ca3 pkg/program: Refactor the subprogram API.
This is in preparation for #985.
2020-04-24 20:30:04 +01:00
Qi Xiao
6938c8d117 pkg/program/shell: Increment $E:SHLVL.
This fixes #834.
2020-04-20 00:09:18 +01:00
Qi Xiao
212a21d051 website/blog: Add unpublished 0.14 release notes. 2020-04-19 23:33:16 +01:00
Qi Xiao
28a7ca5a15 Document read-upto.
This fixes #938.
2020-04-19 14:28:37 +01:00
Qi Xiao
5cdff82883 pkg/eval: Fix stack trace, and add tests. 2020-04-18 00:28:48 +01:00
Kurtis Rader
ab3e7d6169 Implement the three inverse hyperbolic functions
Related #727
2020-04-17 22:08:17 +01:00
Qi Xiao
9869557aee pkg/eval: Add a few tests for builtin string functions.
This addresses #944.
2020-04-17 01:15:45 +01:00
Qi Xiao
cfe6fc2cab pkg/program/shell: Only run the daemon connection test on Unix. 2020-04-17 00:59:58 +01:00
Qi Xiao
e8368127b7 pkg/eval: Add more tests against glob.go.
This addresses #944.
2020-04-17 00:47:00 +01:00
Qi Xiao
fbc18ba55d pkg/eval: Rewrite glob tests. 2020-04-17 00:40:47 +01:00
Qi Xiao
c9458344f1 pkg/eval: Remove unneeded methods of GlobPattern. 2020-04-17 00:20:30 +01:00
Qi Xiao
dc564dbffb pkg/parse: Add more test against error cases in parse.go.
Also clean up a few small historical artifacts in parse.go.
2020-04-17 00:14:10 +01:00
Qi Xiao
ba554bfc1e pkg/parse: Make TestParseError much more rigorous. 2020-04-16 23:19:23 +01:00
Qi Xiao
224a0df825 pkg/parse: Remove ExitusNode.
This construct is no longer compiled or evaluated.
2020-04-16 22:29:49 +01:00
Qi Xiao
96f6738720 pkg/program/shell: Improve test for interact.go.
This addresses #944.
2020-04-16 22:02:05 +01:00
Qi Xiao
0475a0abbc pkg/program/shell: Test basic daemon connection logic.
This addresses #944.
2020-04-16 21:48:56 +01:00