Skip to content

✨ feat(mq-lang): support bracket slice on QualifiedAccess and [:N] syntax#1487

Merged
harehare merged 2 commits intomainfrom
feat/qualified-access-bracket-slice
Mar 24, 2026
Merged

✨ feat(mq-lang): support bracket slice on QualifiedAccess and [:N] syntax#1487
harehare merged 2 commits intomainfrom
feat/qualified-access-bracket-slice

Conversation

@harehare
Copy link
Copy Markdown
Owner

  • Allow bracket access (index/slice) after QualifiedAccess expressions (e.g., module::func()[:1], module::func()[0:2])
  • Add [:N] and [:] slice syntax (empty start index) for arrays
    • arr[:N]slice(arr, 0, N)
    • arr[:]slice(arr, 0, len(arr))
    • dict[:key] (symbol key access) is preserved as-is
  • Fix both AST and CST parsers; add is_symbol_after_colon helper to distinguish symbol dict access from numeric slice

Closes: QualifiedAccess bracket access, [:N] slice

…ntax

- Allow bracket access (index/slice) after QualifiedAccess expressions
  (e.g., `module::func()[:1]`, `module::func()[0:2]`)
- Add [:N] and [:] slice syntax (empty start index) for arrays
  - `arr[:N]` → `slice(arr, 0, N)`
  - `arr[:]`  → `slice(arr, 0, len(arr))`
  - `dict[:key]` (symbol key access) is preserved as-is
- Fix both AST and CST parsers; add `is_symbol_after_colon` helper
  to distinguish symbol dict access from numeric slice

Closes: QualifiedAccess bracket access, [:N] slice
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 24, 2026

Merging this PR will not alter performance

✅ 29 untouched benchmarks


Comparing feat/qualified-access-bracket-slice (7a350b6) with main (8d76a76)

Open in CodSpeed

@harehare harehare merged commit 689dd0d into main Mar 24, 2026
6 of 8 checks passed
@harehare harehare deleted the feat/qualified-access-bracket-slice branch March 24, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant