Haskell: add --positions=range flag to include start and end position#546
Merged
Commelina merged 6 commits intoBNFC:masterfrom Mar 18, 2026
Merged
Haskell: add --positions=range flag to include start and end position#546Commelina merged 6 commits intoBNFC:masterfrom
--positions=range flag to include start and end position#546Commelina merged 6 commits intoBNFC:masterfrom
Conversation
627daa8 to
ae13281
Compare
--functor-v2 flag to include start and end position--functor-v2 flag to include start and end position
e6f5cc5 to
371a2ca
Compare
Member
|
How about organizing the option name like this:
Defaults if just
Internally: data Positions
= None
| Range
| Start
| Line |
--functor-v2 flag to include start and end position--positions=range flag to include start and end position
Member
Author
|
Finished the first step unifying the position-related options, and |
Co-authored-by: Nikolai Kudasov <fizruk@users.noreply.github.com>
Co-authored-by: Nikolai Kudasov <fizruk@users.noreply.github.com>
andreasabel
approved these changes
Mar 17, 2026
Member
andreasabel
left a comment
There was a problem hiding this comment.
Thanks!
I tried this on one example for Haskell and Agda, and found no issues.
Contributor
|
So cool to have this merged! Thanks for picking this up @Commelina! |
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.
Fixes #461 .
This PR added a
--positions=rangeflag to the--haskellbackend. The flag generates AST nodes with both start and end position:The position is also stored in generated Agda AST. However, it is currently not supported for layout grammars (the end position is always the same as the start one).
There should be absolutely NO change on ANY generated file if
--positions=rangeis not given.Some snippets from #463 are used.
TODO:
Code cleanup (especially these withfunctor,withEndPos,hasFunctorOption, etc.)Detailed docs--functor-v2Item 1 and 2 are necessary before this PR can be merged.