-
Notifications
You must be signed in to change notification settings - Fork 21
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 positional information #84
Conversation
tests/Expression.elm
Outdated
@@ -1,42 +1,34 @@ | |||
module Expression exposing (all) | |||
module Expression |
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.
It shouldn't be a part of this PR. It solves different issue
tests/Helpers.elm
Outdated
@@ -0,0 +1,64 @@ | |||
module Helpers |
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.
Ditto
tests/Multiline.elm
Outdated
@@ -0,0 +1,29 @@ | |||
module Multiline exposing (application) |
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.
Ditto
Attempt to complete location information for expressions
Support for all types has arrived!!! 🎉Huge shoutout to @joeandaverde and @laslowh for their work on making this changes possible. |
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.
Outstanding work!
Few styling comments on my end. We also need to consider some [half]measure to solve the line numbering bug in application before releasing it in next major version
src/Ast/Expression.elm
Outdated
Record | ||
<$> braces | ||
(commaSeparated | ||
((,) |
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.
Please try to avoid splitting arguments to next line
Backpipe (<|) twice could do the job here
src/Ast/Expression.elm
Outdated
(withMeta | ||
((\a -> (\m -> ( a, Variable [ a ] m ))) | ||
<$> loName | ||
) |
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.
Ditto. Could rewritten to something similar to
withMeta <|
Record <$> braces <| comaSeparated <| withMeta <| (\a m -> (a, Variable [a], m) <$> loName)
src/Ast/Expression.elm
Outdated
\() -> | ||
chainl | ||
(withMeta ((\m -> flippedApp m) <$ spacesOrIndentedNewline ops)) | ||
(term ops) |
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.
Ditto
src/Ast/Expression.elm
Outdated
) | ||
:: remE | ||
) | ||
remO |
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.
Oh god 😮 Ditto
src/Ast/Expression.elm
Outdated
a | ||
e | ||
m | ||
) |
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.
Ditto
tests/Multiline.elm
Outdated
) | ||
(var "k" { line = 12, column = 1 }) | ||
{ line = 12, column = 0 } | ||
) |
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.
Apart from the bug of line numbers (Every argument's line being 1 too small apart from the last one) that I assume is coming from Combine dependency rather then this codebase, the isApplication` could be slightly modified to produce this output
Just checking in on this. Has any progress on the line numbering bug been made? |
@laslowh So the issue is with lines starting from index 0 (rather than 1) then jumping straight to 2, and treating the last line in the expression as the same as one before. So essentially instead of getting 1,2,3,4,5, we're getting 0,2,3,4,4. No idea what's the cause CC. @baransu |
Looks like the line numbering issues were addressed: https://github.com/elm-community/parser-combinators/blob/master/CHANGELOG.md I've started work on fixing the tests and upgrading the package. baransu#2 |
Is this PR still active? If not could I help getting this feature merged? |
@paulsonnentag there's nobody actively working on this. It'd be great if you tried your shot |
@joeandaverde I've checked out your latest commit, but it seems like there are still a lot of cases where the line/column number is not correct. Do you have any tips on what the problem could be? Otherwise, I'll have to dig deeper into the code. |
I've started working on this issue this weekend and it looks like it will see a closure soon |
@wende If you need any help, let me know 😃 |
Closed in favour of #99 |
Huge thanks to @joeandaverde for creating most of what is implemented in this PR in the first place. Also shoutout to the @laslowh who helped with rest of the types. You're the best!!! 🎉
All Expressions and Statements now have Meta as last argument
{ line: Int, column: Int }
.Positional information are not perfect. There as some cases where whitespaces are omitted in column count but besides everything works as expected.
This is big breaking change and I'm counting on your feedback.
Fixes: #13
Almost all types are converted contain meta information except:TypeApplicationApplicationBinOpVariableThey are advanced because ofpartial application in case ofTypeApplication
andApplication
creating in placeVariable
andBinOp
types~I was trying implement Meta for those as well but I've failed lacking knowledge and full understanding of
parser-combinators
as well as advanced Elm. That why I'm creating this WIP PR, counting on your support.~~