Commit Graph

5776 Commits

Author SHA1 Message Date
Qi Xiao
4fc4ca3cc1 Explicitly say that Elvish doesn't eval rc.elv when running scripts. 2022-01-05 00:52:46 +00:00
Qi Xiao
8ed351e386 Add a new "defer" command. 2022-01-05 00:12:35 +00:00
Qi Xiao
84b72af4ca Support using styled text in &display to edit:complex-candidate.
This fixes .
2022-01-03 20:30:00 +00:00
Qi Xiao
38d4553833 Update assignment syntax in docs.
- Also remove the section for the legacy assignment syntax.

- Also add a paragraph to "eval" about upvalues.
2022-01-03 19:45:39 +00:00
Qi Xiao
29fc9a5fe9 website/Makefile: Prevent removal of intermediate targets. 2022-01-03 17:54:06 +00:00
Qi Xiao
4350ad48b1 Remove highlighting for legacy assignment syntax. 2022-01-03 00:59:48 +00:00
Qi Xiao
2bedb5248b Update docs in website/learn to use the new assignment syntax. 2022-01-03 00:57:28 +00:00
Qi Xiao
003557c22a Remove support for the legacy lambda syntax.
This fixes .
2022-01-03 00:47:41 +00:00
Qi Xiao
be1e144b45 Remove support for the "local:", "up:" and ":" special namespaces.
This fixes .
2022-01-03 00:47:41 +00:00
Qi Xiao
3dd3b780b9 Remove legacy assignment syntax.
This fixes .
2022-01-03 00:47:41 +00:00
Qi Xiao
4fcffc5671 Remove most uses of the legacy assignment syntax.
The remaining few uses are in some of the tests, which will be removed later.

This addresses .
2022-01-03 00:47:41 +00:00
Qi Xiao
653c9f9d0f Remove dir-history, deprecated since 0.17.0. 2022-01-03 00:47:41 +00:00
Qi Xiao
3abf7f5510 Deprecate the legacy temporary assignment syntax from 0.18.0.
This addresses .
2022-01-03 00:47:24 +00:00
Qi Xiao
ae1dbb3ff6 Update the "pipelines" ttyshot on homepage.
This fixes .
2022-01-02 23:13:18 +00:00
Qi Xiao
0e48191446 website: Make the @ttyshot dependency more accurate. 2022-01-02 23:12:59 +00:00
Qi Xiao
fb1e807735 Change \xff and \x377 to encode bytes rather than codepoints.
It was an oversight to make them encode codepoints; they were always intended to
be equivalent to their Go counterparts, which encode bytes and can be used to
write arbitrary byte sequences that are not necessarily valid UTF-8 sequences.
2022-01-02 15:44:20 +00:00
Qi Xiao
b664dedece tour.md: Document that Elvish doesn't do $IFS-splitting. 2022-01-02 13:29:05 +00:00
Qi Xiao
6f97ad0e37 website: Remove support for the "all" category from gensite. 2022-01-02 00:51:28 +00:00
Qi Xiao
01d51e9c3f Expand the tour with more correspondence with traditional shells.
Also sneak in the word "translate" to make this doc easier to search.

This addresses .
2022-01-02 00:34:57 +00:00
Qi Xiao
d9eb0928e3 Bind Alt-Enter to inserting "\n". 2022-01-01 23:52:34 +00:00
Qi Xiao
11de899040 Add fuzz test for (*eval.Evaler).Check. 2022-01-01 23:52:08 +00:00
Qi Xiao
04173ee8ab Actually fix the O(2^n) code path.
With the previous fix, the parsing algorithm could still backtrack without
making progress given slightly more sophisticated input (see added testdata for
an example).

Instead of trying to parse a temporary assignment when it *could* be one, only
parse it when we are sure that it is. This should now truly fix the issue.
2022-01-01 22:52:56 +00:00
Qi Xiao
9cda3f643e parse: Fix a O(2^n) code path when input is "(" repeated n times.
The parsing function for Form first tries to parse a temp assignment, and
backtracks when an assignment cannot be parsed. When the input is "(" repeated n
times, each level of Form parsing will first try to parse the rest of the code
as an assignment and then backtrack, without making any progress. This results
in a call tree with a branching factor of 2, hence the O(2^n) complexity.

The fix is to first try to parse a head instead, and only try to parse it as a
temp assignment if it does contain "=". This fixes this particular pathological
case, although I'm not 100% sure it eliminates all possibilities of O(2^n) time
complexity.

With the introduction of the "tmp" special command, the current syntax for
temporary assignments will be deprecated and eventually go away, which will
eliminate all backtracking in the parser. In the meanwhile, this fix may be good
enough.

This case was discovered with fuzzing support in Go 1.18. Also add the fuzzing
test data.
2022-01-01 22:20:03 +00:00
Qi Xiao
1c1227324e website: Revamp the learn index page.
- Split articles into groups.

- Add notes besides the entry for fundamentals and quick tour.
2022-01-01 16:34:05 +00:00
Qi Xiao
a5bc536f4d website: Make the tool dependency for %.html more accurate.
Only depend on the tools referenced by tools/md-to-html. This uses "grep -o",
which is not part of POSIX but is supported by both GNU and BSD greps, so widely
enough.
2022-01-01 15:59:56 +00:00
Qi Xiao
7a40cf1fea website: Rename the "genblog" tool to "gensite".
Also rename internal references to the "blog" to "site" when it refers to the site as the whole (instead of https://elv.sh/blog).
2022-01-01 12:10:26 +00:00
Qi Xiao
ae91cf7b1c Fix build on Go 1.16. 2021-12-31 21:13:41 +00:00
Qi Xiao
097e32b375 pkg/eval/vals: Add ReprPlain, Repr without pretty-printing.
Also de-export NoPretty now that it is no longer needed.
2021-12-31 21:05:07 +00:00
Qi Xiao
7ed71323fd Remove a now superfluous variable in tools/imports-graph.elv. 2021-12-31 18:51:19 +00:00
Qi Xiao
32a2c4c73d Use the flag module in tools/imports-graph.elv. 2021-12-31 18:49:59 +00:00
Qi Xiao
5bf688cf4d New flag module. 2021-12-31 18:03:24 +00:00
Qi Xiao
de3ac3166d Add a new conversion utility vals.ScanMapToGo. 2021-12-31 18:00:36 +00:00
Qi Xiao
e134ef51e3 Handle all-cap abbreviations in strutil.CamelToDashed.
Also remove support for the "name" field tag from eval.scanOptions - it's not
used anywhere and the use case it was intended for is handled by CamelToDashed.
2021-12-31 16:54:32 +00:00
Qi Xiao
e01e5dd2f5 pkg/getopt: Revamp the API and implementation.
- Don't require creating a Getopt object in the API.

- Add a new Parse function, and rename the existing method to Complete.

- Add an Unknown field to Option to indicate unknown options.

- Rewrite the tests.

- Numerous stylistic changes.
2021-12-31 14:36:01 +00:00
Qi Xiao
d9e14da0db Export eval.Closure and (*eval.Frame).Fork. 2021-12-31 14:28:30 +00:00
Qi Xiao
4906c4aa28 Fix doc for the call builtin. 2021-12-31 12:46:47 +00:00
Qi Xiao
a8844a34f8 Check that blocks in control flows don't have arguments or options.
It is now a compile-time error if they do. This fixes .
2021-12-30 13:49:48 +00:00
Qi Xiao
de5f0e0d32 Add new util vals.MakeListFromStrings. 2021-12-30 13:09:18 +00:00
Qi Xiao
c46fd60270 Properly clear the filter when ascending or descending in nav mode.
Also add regression tests for this behavior.
2021-12-30 12:58:34 +00:00
Qi Xiao
7da15f48fb pkg/eval/vals: Add more conversion helpers.
Also update the comment in conversion.go.
2021-12-29 22:32:25 +00:00
Qi Xiao
f7b5df5de5 Add a new "call" command. 2021-12-29 01:16:44 +00:00
Qi Xiao
46774d7078 Use (*Evaler).Chdir for changing directory in navigation mode.
This will run the hooks and update $E:PWD correctly.
2021-12-28 17:52:09 +00:00
Qi Xiao
1910948a86 edit.md: Upgrade syntax. 2021-12-28 17:11:59 +00:00
Qi Xiao
d95758fd29 website/template.html: Hide navbar after jumping to an anchor. 2021-12-28 15:56:52 +00:00
Qi Xiao
77897bdaa0 tour.md: Fix format of a key. 2021-12-28 13:36:32 +00:00
Ian Max Andolina
c8fce87de6
Small fixup for Function doc ()
The chunk starting "There must be no space between ] and {; ..." is no longer relevant.
2021-12-28 13:32:30 +00:00
Qi Xiao
603421d8cc Update ttyshots with a comment on how to regenerate.
Also explain in ttyshot/README.md that the output of commands has to be manually appended.
2021-12-28 13:24:33 +00:00
Qi Xiao
71d885c4fa website/Makefile: add @ttyshot dependencies.
Also rename the ref-deps script to extra-deps now that its scope is a bit larger.
2021-12-28 13:13:43 +00:00
Qi Xiao
1ec9c95142 Fix the doc for ttyshots.
- Wrap the command in "print" to get byte output.

- Use global-binding to ensure that the key works in all modes.
2021-12-28 13:01:21 +00:00
Qi Xiao
1d36d299b8 Put flags for prettier in .prettierrc.
Also reformat tools/checkstyle-md.sh.
2021-12-28 12:54:30 +00:00