Prerelease for testing. Not published to npm, crates.io or PyPI.
A large round of parsing improvements. Measured on 2,793 real-world zsh files (zsh's own functions, ohmyzsh, prezto, zsh-completions, zinit, powerlevel10k and others), compared with v0.63.5:
| v0.63.5 | 0.64.0-dev.1 | |
|---|---|---|
| files that parse without errors | 2,129 | 2,683 |
| ERROR / MISSING nodes | 25,067 | 7,813 |
| files that ran out of memory | 17 | 0 |
Highlights
- zsh's short
ifform:if [[ … ]] { … } elif (( … )) { … } else { … }, andwhile/untilwith a{ }body. - Modifiers outside braces now parse as modifiers (
$x:h,$x:t:r,$f:s/a/b/,$w:gs/a/A/:gs/b/B/), plus:f,:F:n:and:swith any delimiter (${n:r:fs#/#::#}). - A
$that starts no expansion is literal ("%B$%b",echo $;,${b//$}). - Function names with colons (
zinit::setup(),:helper()); anonymousfunction { … }. - Several assignments on one line no longer swallow the next line;
PATH=/sbin:$PATHand similar values. - Case patterns starting with a string, quotes between pattern pieces, glob groups with empty alternatives, glob flags before expansions, balanced
{…}inside words (find … {} +in a brace group),${x//a/b/c}replacements containing/, and more. - The scanner's state is now consistent: incremental re-parses give the same tree as a fresh parse (now checked in CI), and the context stack no longer leaks.
- The parse table is ~30% smaller (parser.c 50 MB → ~44 MB) despite the additions.
Tree changes that may affect queries
expansion_modifierholds whole tokens (:h,:s/) and, for:s,search/replacefields.- A literal
$is aword(orstring_contentin strings). - The short
if'selif_clause/else_clausesit inside the preceding block'scompound_statement. _statement,_statement_or_commentand_primary_expressionare no longer listed as supertypes (they are inlined; tree-sitter 0.27 ignores them).