-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add end position information to BNFC'Position #463
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Nikolai Kudasov <[email protected]>
Co-authored-by: Nikolai Kudasov <[email protected]>
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? |
@@ -159,6 +178,7 @@ cf2Abstract Options{ lang, tokenText, generic, functor } name cf = vsep . concat | |||
[ [ 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions should only be imported when used (currently, that would be under condition functor
), otherwise compilation generates warnings with -Wall
.
, "tokenLineCol :: Token -> (Int, Int)" | ||
, "tokenLineCol = posLineCol . tokenPosn" | ||
, "" | ||
, "-- | Get end line and column of a token." | ||
, "tokenLineColEnd :: Token -> (Int, Int)" | ||
, "tokenLineColEnd t = (l, c + n)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a token spans several lines? Note that the user can define their own tokens that may contain newline characters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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