Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in capture with match #561

Closed
wants to merge 2 commits into from
Closed

Conversation

hikotq
Copy link
Contributor

@hikotq hikotq commented Mar 10, 2019

When performing "EndText" matching, it is necessary to check whether
the current position matches the input text length.However, when
capturing a submatch using the matching result of DFA, "EndText" matching
wasn't actually performed correctly because the input text is sliced.

By applying this patch we specify the match end position by the argument "end",
not using slice when performing capture with the matching result of DFA.

Fixes #557

When performing "EndText" matching, it is necessary to check whether
the current position matches the input text length.However, when
capturing a submatch using the matching result of DFA, "EndText" matching
wasn't actually performed correctly because the input text is sliced.

By applying this patch we specify the match end position by the argument "end",
not using slice when performing capture with the matching result of DFA.

Fixes rust-lang#557
Copy link
Member

@BurntSushi BurntSushi left a comment

Choose a reason for hiding this comment

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

Lovely, thank you! I think this looks good to me. One small request though:
could you please make sure all new code introduced in this PR is in a style
consistent with the surrounding code? In particular, please make sure all lines
are wrapped to 79 columns inclusive.

@hikotq
Copy link
Contributor Author

hikotq commented Mar 10, 2019

I formatted the code.

BurntSushi pushed a commit that referenced this pull request Mar 30, 2019
When performing "EndText" matching, it is necessary to check whether
the current position matches the input text length. However, when
capturing a submatch using the matching result of DFA, "EndText"
matching wasn't actually performed correctly because the input text is
sliced.

By applying this patch we specify the match end position by the
argument "end", not using slice when performing capture with the
matching result of DFA.

Fixes #557, Closes #561
@hikotq
Copy link
Contributor Author

hikotq commented Mar 30, 2019

Thank you for reviewing and merging!

@BurntSushi BurntSushi mentioned this pull request May 17, 2022
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.

None yet

2 participants