Bogdanp / elm-ast

A parser for Elm in Elm.
http://bogdanp.github.io/elm-ast/example/
BSD 3-Clause "New" or "Revised" License
143 stars 21 forks source link

Add positional information #84

Closed baransu closed 5 years ago

baransu commented 7 years ago

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:

They are advanced because of

~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.~~

baransu commented 7 years ago

Support for all types has arrived!!! 🎉

Huge shoutout to @joeandaverde and @laslowh for their work on making this changes possible. This is huge breaking change and I'm looking forward on any feedback.

collosi commented 6 years ago

Just checking in on this. Has any progress on the line numbering bug been made?

wende commented 6 years ago

@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 Could use a little work on that. I might try to take a look this weekend

CC. @Baransu

dynajoe commented 6 years ago

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. https://github.com/Baransu/elm-ast/pull/2

paulsonnentag commented 6 years ago

Is this PR still active? If not could I help getting this feature merged?

wende commented 6 years ago

@paulsonnentag there's nobody actively working on this. It'd be great if you tried your shot

paulsonnentag commented 6 years ago

@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.

wende commented 6 years ago

I've started working on this issue this weekend and it looks like it will see a closure soon

baransu commented 6 years ago

@wende If you need any help, let me know 😃

wende commented 5 years ago

Closed in favour of #99