Repository navigation
fix: parse triple-marker hunk lines - #27
Merged
Merged
Conversation
barrettruth
commented
Jul 16, 2026
barrettruth
marked this pull request as ready for review
July 16, 2026 23:30
ribru17
approved these changes
Jul 17, 2026
| choice( | ||
| iseq("+", optional(ANYTHING)), | ||
| iseq("++", optional(ANYTHING)), | ||
| iseq("+++"), |
Contributor
There was a problem hiding this comment.
I'm assuming the parse tests didn't pass if we just add the changes here? probably because this broadening is only valid within a hunk?
Contributor
Author
|
FMI, what are we waiting on for this to get merged 🤔 |
Collaborator
|
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.
closes #13
@ribru17 @clason @the-mikedavis
Problem
Deleted/added hunk lines can start w/ the same triple-marker text used by file headers (like
+++ /path/to/file). Example in #13. Currently, grammar allows---as an exact deletion line, but did NOT allow that be followed by source code leading to an error.Also note that the same issue exists symmetrically for addition - both ought to be addressed. Importantly, do not treat all
--- <text>/+++ <text>type-lines as hunk changes.Solution
Allow this pattern of triple-marker + context when parsing hunk changes ONLY.
The net effect is that inside a hunk,
--- C, C++/+++ C, C--is a deletion/addition.--- a/file,--- /dev/null,+++ b/filethingyare all properly parsed as file headers.I made some super exhaustive and convoluted test cases in the corpus for this, too.