fix: parser keyword position, ${VAR}/nested $(), lexer comments & fd-redirects, env-prefix#3
Merged
Merged
Conversation
… vars
- ${VAR} brace expansion now works (bare, inline, and with suffix)
- $(...) uses a balanced-paren scanner so nested $(echo $(echo x)) works
(the whole group is handed to the shell, which evaluates the inner one)
- double-quoted undefined var "$X" yields "" instead of being dropped;
unquoted undefined var is still removed (word removal)
- '#' at a word boundary starts a comment (literal inside words/quotes) - numbered fd redirect '1>' / '1>>' map to stdout '>' / '>>' - '&>' redirects both streams (emits '>' plus a trailing '2>&1') - a token mixing single + double quotes now carries the double sentinel so the $VAR portion is still expanded - extract repeated quote-prefix logic into Tokenizer._quote_prefix
`if`, `while`, `for`, `until`, `case`, `select` now start a compound statement only at statement start (current_statement_tokens empty). Mid-statement they are ordinary arguments, so `grep if file` and `echo for while done` parse as a single command instead of splitting.
…etup - `FOO=bar builtin` now applies the env prefix while the builtin/function runs (parent process), restoring prior values afterwards via _temp_env - kishi_setup: the Windows success messages were unreachable (mis-indented inside the except block after `return 1`); moved to the success path Note: the kishi_setup branch is Windows-only and not exercised by the Linux CI; the change is a straightforward control-flow correction.
ozhangebesoglu
added a commit
that referenced
this pull request
May 21, 2026
Tier 2 bugfix release: parser keyword position, ${VAR}/nested $()
expansion, lexer comments & fd-redirects, mixed-quote tokens, and
VAR=value env prefix on builtins (PR #3).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Özet
Denetimde kalan 9 bug, TDD ile düzeltildi (273 test geçiyor, sıfır regresyon). Tier 1 (PR #2) ile birlikte mimari denetimindeki 13 bug'ın tamamı kapandı.
parser
if/while/for/until/case/select) artık yalnızca komut pozisyonunda keyword →grep if file,echo for donetek komut olarak parse edilir.expander
${VAR}brace genişletme (bare, inline, suffix'li)$(...)dengeli-parantez tarayıcı → iç içe$(echo $(echo x))çalışır"$X"→""(düşürülmüyor); tırnaksız hâlâ word-removallexer
#yorum (kelime sınırında; kelime/tırnak içinde literal)1>/1>>numaralı fd-redirect;&>her iki akışı yönlendirir'a'"$b") double sentinel taşır →$bexpand edilir_quote_prefixhelper'ına çıkarıldıexecutor
FOO=bar builtinenv-prefix builtin/function çalışırken geçici uygulanır (_temp_env)kishi_setupiçinde ulaşılamaz Windows mesajları başarı yoluna taşındıTest
273 passed— 22 yeni test + 251 mevcut. Çapraz platform (saf Python).