Commit Graph

27 Commits

Author SHA1 Message Date
Qi Xiao
e4564688bf Rename eawk -> re:awk.
Also rename &posix to &sep-posix, and add &sep-longest.

The original eawk name is documented as deprecated but doesn't emit deprecation
warnings during compilation yet; this will be fixed in the next commit.
2024-01-02 15:07:37 +00:00
Olof Salberger
1b6477878e Add separator pattern to eawk
One of the biggest pain points of using elvish
as a shell in practice has been parsing output from
shell commands that return text.

Many CLIs are parseable by AWK. This commit
adds the AWK separator argument to eawk,
which should make it easier to parse the
output of many shell commands.
2023-10-13 00:50:10 +02:00
Qi Xiao
a3f4384495 Move all elvdocs into .d.elv files.
The elvdocs still use the old format (#elvdoc:fn or #elvdoc:var) for now, but
will be changed to "fn" and "var" forms soon.

Also remove the accidentally committed cmd/mvelvdoc. It has been used to perform
the conversion automatically but is not supposed to be committed.
2022-11-20 21:59:45 +00: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
7da4b58f2f Revise doc for the builtin module.
- Revise the introduction section.

- Link to the notes on commands taking value inputs from all such commands.

- Revise the doc on the "all" command.

- Revise references to the builtin module from the language reference.
2021-12-28 12:01:35 +00:00
Qi Xiao
c71f46642b Update eawk's doc.
* Remove a superfluous line break in the equivalent Elvish code.

* Keep code in transcripts on the same line to be correctly highlited.

* Add another example using digit-only argument names.
2021-12-17 19:53:30 +00:00
Kurtis Rader
d4b4edbbbe Replace legacy lambda with new lambda examples
I was surprised to see so many legacy lambda syntax examples in the
documentation. This replaces all of them with the new syntax -- excluding
the handful of cases meant to explicitly verify the legacy form is still
valid. This also adds a link to the issue in the release notes which
documents the change in syntax.

Related #664
2021-11-28 21:30:59 +00:00
Qi Xiao
657b73122f Change all builtin commands writing value output to surface ReaderGone.
Also replace (*Frame).OutputChan with (*Frame).ValueOutput, which returns a
small interface for writing to the value output that is also aware when the
reader is gone.
2021-06-18 00:14:59 +01:00
Qi Xiao
c3594f0670 Fixup for #1322. 2021-06-06 21:59:30 +01:00
Kurtis Rader
3a73babdee Increase eawk test coverage to 100%
Related #1234
2021-06-06 21:56:23 +01:00
Qi Xiao
b53a92b964 Remove all builtin commands deprecated since 0.15.0. 2021-04-08 23:07:50 +01:00
Qi Xiao
4612b58759 Support exact integer and rational numbers. 2021-04-04 00:58:53 +01:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
734eb955e2 pkg/eval: Use exported methods to access ports from builtin functions. 2020-10-10 22:28:13 +01:00
Qi Xiao
9b9a6de2cd pkg/eval: Cause -> Reason. 2020-09-04 21:04:58 +01:00
Qi Xiao
9b2b33b429 pkg/eval: Move elvdoc comments before the implementations. 2020-08-16 18:46:29 +01:00
Qi Xiao
d5df47f986 Deprecate has-{prefix suffix}. 2020-08-16 16:27:24 +01:00
Qi Xiao
bb24b63356 Remove builtin commands deprecated in v0.14.0. 2020-08-16 16:10:58 +01:00
Gabriel Rauter
1124c10b56
Add str:from-utf8-bytes, str:to-utf8-bytes and move builtin ord and chr to str module (#1081)
* pkg/eval/str: move builtin ord and chr to str

Move builtin string function ord and chr to the str module and rename to
to str:to-codepoints and str:from-codepoints respectively as suggested
in #851.

* pkg/eval/str: add from-utf8-bytes & to-utf8-bytes

Add from-utf8-bytes and to-utf8-bytes functions to the str module. This
functions differ from their *-codepoints in that they handle utf8 bytes
instead of whole codepoints. Closes #851

* pkg/eval/str: range check for codepoint and bytes

str:from-codepoints
Add check if arguments codepoints are within valid unicode range, return
an OutOfRange error otherwise. Return a BadValue error if the codepoint
isn't valid. Add/change testcases.

str:from-utf8-bytes
Add check if byte arguments are within valid range, return an OutOfRange
error otherwise. Return a BadValue error if the byte sequence isn't a
valid UTF-8 sequence. Add/change testcases.

Add additional test if piping from str:to-codepoints/str:to-utf8-bytes
to str:from-codpoints/str:from-utf8-bytes returns the original input.
2020-08-13 21:56:28 +01:00
Kurtis Rader
098e0e6880 Document base command 2020-04-27 10:33:02 +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
a36a372624 pkg: Fix small issues found by staticcheck. 2020-04-13 13:56:10 +01:00
Qi Xiao
af6b523e02 pkg/eval: Remove Frame.{eval,Call}. 2020-04-09 21:01:14 +01:00
Qi Xiao
3037f6c8bf pkg/util: Move the wcwidth utilities to a new package, and add more tests.
This addresses #944.
2020-04-06 12:00:01 +01:00
Qi Xiao
41985123d3 Move all docs for builtins to the Go code. 2020-01-18 08:12:50 -05:00
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00