Conversation
- Add colon_variant flag to ParameterExpansion AST to distinguish :- from - (unset-or-empty vs unset-only) - Add resolve_param_expansion_name() for array subscripts and special params - Add expand_operand() for lazy evaluation of operand expressions - Rewrite apply_parameter_op() with proper colon/no-colon semantics - Fix set -- encoding to preserve empty positional parameters - Remove 14 skip markers from var-op-test.test.sh Closes #358 https://claude.ai/code/session_01QbjrsMFJbHy5XfHCzA6TjM
- Apply IFS word splitting to unquoted variable/command/arithmetic expansions in command arguments and for/select loops - Implement POSIX-compliant ifs_split() with proper handling of: - IFS whitespace chars (collapse, strip leading/trailing) - IFS non-whitespace chars (produce empty fields between adjacent) - Mixed IFS (<ws><nws><ws> = single delimiter) - Empty IFS (no splitting) and unset IFS (default space/tab/newline) - Add proper $@/$* field expansion in expand_word_to_fields: - "$@" preserves individual positional params - "$*" joins with first char of IFS - Unquoted $@/$* subject to IFS splitting - Skip IFS splitting for assignment-like words (e.g., result="$1") - Remove 10 skip markers from word-split.test.sh Closes #352 https://claude.ai/code/session_01QbjrsMFJbHy5XfHCzA6TjM
…ucts (#360) - Reject empty bodies in brace groups, while/until/for/select loops, and if/elif/else clauses - Detect unterminated single and double quoted strings in lexer via Token::Error variant - Add check_error_token() to parser for propagating lexer errors - Remove skip markers from 7 spec tests that now pass - Add 9 unit tests for new error detection https://claude.ai/code/session_01QbjrsMFJbHy5XfHCzA6TjM
#354) Add support for bash nameref variables via local -n, declare -n, and typeset -n. Namerefs create aliases that redirect reads/writes to the target variable. Changes: - local handler: parse -n flag, store _NAMEREF_ marker + local scope - declare/typeset: handle +n to remove nameref, -n without =value uses existing variable value as target - unset: resolve nameref (unset target), -n flag removes nameref itself - ${!ref}: for namerefs returns target name (bash inversion behavior) - ArrayAccess: resolve nameref for array names, handle a[N] targets - Array writes: resolve nameref for assignment target array names - for loop: use set_variable to respect nameref on loop variable - expand_variable: handle resolved names containing array index (a[2]) 13 of 14 nameref tests now pass. 1 skipped due to pre-existing parser limitation with local arr=(...) syntax. https://claude.ai/code/session_01QbjrsMFJbHy5XfHCzA6TjM
Add alias/unalias builtins and alias expansion to the interpreter: - aliases HashMap on Interpreter for storing alias definitions - alias builtin: define (alias name=value), list (alias), query (alias name) - unalias builtin: remove single alias or all (-a) - Alias expansion in execute_simple_command: when expand_aliases shopt is enabled, unquoted literal command names are checked against aliases and expanded by re-parsing the substituted command string - Recursion prevention via expanding_aliases HashSet (handles alias echo='echo foo' without infinite loop) - Trailing space chaining: alias values ending in space trigger alias expansion of the next word - Only plain literal words are alias-expanded (not $var or $(cmd)) - Pipeline stdin forwarded through alias expansion - Subshell save/restore of aliases 14 of 15 alias spec tests now pass. 1 skipped due to pre-existing lexer limitation (single-quote context lost in mid-word tokens). https://claude.ai/code/session_01QbjrsMFJbHy5XfHCzA6TjM
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.
Summary
This PR bundles five bug-fix issues, resolving 58 previously-skipped spec tests:
#358 - Variable operators on $@ and arrays (14 unskipped)
colon_variantflag to distinguish:- :+ := :?from- + = ?resolve_param_expansion_name()for array subscripts and special paramsexpand_operand()for lazy evaluation of operand expressionsapply_parameter_op()with proper colon/no-colon semanticsset --encoding to preserve empty positional parameters#352 - IFS-based word splitting (10 unskipped)
ifs_split()(whitespace collapse, non-ws delimiters, mixed IFS)$@/$*field expansion ("$@"preserves params,"$*"joins with IFS)#360 - Parser syntax error detection (7 unskipped)
Token::Errorvariant for lexer error reporting#354 - Nameref variables (13 unskipped)
local -n/declare -n/typeset -nnameref support${!ref}expansionforloop variable nameref,unset -n#355 - Alias expansion (14 unskipped)
aliasandunaliasbuiltinsshopt expand_aliasesTest plan
Closes #358
Closes #352
Closes #360
Closes #354
Closes #355