Skip to content
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_(line|column)_number to loc pragma #6126

Closed
bew opened this issue May 24, 2018 · 3 comments
Closed

Add end_(line|column)_number to loc pragma #6126

bew opened this issue May 24, 2018 · 3 comments

Comments

@bew
Copy link
Contributor

bew commented May 24, 2018

Currently the loc pragma allows to set the filename, line_number and column_number of the next token to be read by the lexer.
Its format is: #<loc:some_filename,line_number,column_number>some_token surrounded by #<loc:push> and #<loc:pop>.
So for example: #<loc:push>#<loc:"/tmp/loc.cr",22,7>SomeConst#<loc:pop>.

The lack of end numbers makes error reporting only show a ^ under the token, instead of a nice ^~~~~~~~ for the whole token.

My suggestion is to add 2 (optional?) numbers to the loc pragma to also have end_line_number and end_column_number.

I think this would be useful for #6125.

@bew
Copy link
Contributor Author

bew commented May 24, 2018

Nevermind, when I remove #<loc:push> and #<loc:pop> it works as I expected..

Now I don't understand what these are for.. @asterite any hint?

@bew bew closed this as completed May 24, 2018
@Sija
Copy link
Contributor

Sija commented May 24, 2018

Now I don't understand what these are for.. @asterite any hint?

@bew git blame it

@bew
Copy link
Contributor Author

bew commented May 24, 2018

@Sija Good idea, thank you!
For those interested, here is the commit: d1bd2a7
(note: save & reset will later be renamed to push & pop)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants