Add end position information to BNFC'Position#463
Add end position information to BNFC'Position#463aabounegm wants to merge 3 commits intoBNFC:masterfrom
Conversation
Co-authored-by: Nikolai Kudasov <fizruk@users.noreply.github.com>
Co-authored-by: Nikolai Kudasov <fizruk@users.noreply.github.com>
|
I have tried running the doctests locally but failed for some reason. which also caused a lot of |
|
I believe the tests should be fixed now. @andreasabel when do you think you can take a look? |
|
Hello @andreasabel, sorry to bother you again, but do you have an estimate for when you might have time to review this? |
| [ [ text $ List.intercalate ", " stdClasses | hasTextualToks || hasData ] | ||
| , [ text $ List.intercalate ", " funClasses | fun ] | ||
| , [ text $ "Int, Maybe(..)" | defPosition ] | ||
| , [ text $ "fmap, fst, snd"] |
There was a problem hiding this comment.
These functions should only be imported when used (currently, that would be under condition functor), otherwise compilation generates warnings with -Wall.
| , "" | ||
| , "-- | Get end line and column of a token." | ||
| , "tokenLineColEnd :: Token -> (Int, Int)" | ||
| , "tokenLineColEnd t = (l, c + n)" |
There was a problem hiding this comment.
What if a token spans several lines? Note that the user can define their own tokens that may contain newline characters.
andreasabel
left a comment
There was a problem hiding this comment.
Thanks for the PR, and sorry for the delay in evaluating this PR.
Did you run the testsuite (in subdirectory testing)?
It seems your patch breaks e.g. the --agda --functor backend.
Also, if we change the functionality of --functor, we will potentially break a lot of user code.
So I suggest to implement the new feature under a new flag, e.g. --position, and explain how it differs from --functor.
When I had a quick look at the code I saw that you assume tokens to only span a single line, but user-defined tokens can also span several lines.
|
Thanks for the review, you've raised some good points indeed. Unfortunately, I have gotten rather busy lately and don't think I will be able to address them relatively soon. |
I made an attempt at implementing the feature I asked for. Please let me know if there is anything I can improve on or some style I'm not strictly following (nitpicks are welcome 😄).
Resolves #461