Skip to content

Support indexing TextSlice views - #1704

Open
draarivpatel-ui wants to merge 1 commit into
lark-parser:masterfrom
draarivpatel-ui:fix-text-slice-getitem
Open

draarivpatel-ui wants to merge 1 commit into
lark-parser:masterfrom
draarivpatel-ui:fix-text-slice-getitem

Conversation

@draarivpatel-ui

Copy link
Copy Markdown

Fixes #1599.

Summary

  • Add integer indexing to TextSlice with view-relative positive and negative offsets.
  • Add slice indexing while preserving normal str and bytes slice behavior.
  • Raise IndexError for indexes outside the viewed range.
  • Add regression coverage for str and bytes inputs.

Tests

  • nice -n 19 pytest -q tests/test_parser.py -x --tb=short
  • python -m compileall -q lark
  • git diff --check

Copilot AI balanced review requested due to automatic review settings November 25, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@erezsh

erezsh commented Nov 29, 2026

Copy link
Copy Markdown
Member

Is this something that you genuinely needed in your code? why?

This branch has not been deployed

No deployments
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.

TextSlice implementation breaks codebases based on 1.2.2

3 participants