Skip to content

fix(lexer): prevent panic on stateful rules with empty optional groups - #488

Open
AdamMagued wants to merge 1 commit into
alecthomas:masterfrom
AdamMagued:fix-issue-324
Open

AdamMagued wants to merge 1 commit into
alecthomas:masterfrom
AdamMagued:fix-issue-324

Conversation

@AdamMagued

Copy link
Copy Markdown

Fixes #324

Summary

  • Guarded submatch slice indexing against panic when stateful lexer rules contain optional groups that capture nothing.
  • Added comprehensive unit tests for stateful lexer rules with optional groups.

Verified via container sandbox test suite.

…re groups

Signed-off-by: AdamMagued <adamismailmageud@gmail.com>
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.

Panic when stateful lexer's non-Root rule has optional group but captures nothing

1 participant