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

#sourceLocation? #7

Closed
dabrahams opened this issue Mar 29, 2021 · 5 comments · Fixed by #8
Closed

#sourceLocation? #7

dabrahams opened this issue Mar 29, 2021 · 5 comments · Fixed by #8

Comments

@dabrahams
Copy link
Contributor

It would be really helpful if you could insert #sourceLocation directives corresponding to the #line directives in a lemon-generated parser. There are some annoying restrictions on where you can put them in Swift, but it should work to put one before each generated parse action function, I think.

@roop
Copy link
Owner

roop commented Apr 1, 2021

That's a great idea. I'll try to implement it in the next few days.

@dabrahams
Copy link
Contributor Author

bump! Would really love this if possible.

@roop
Copy link
Owner

roop commented Apr 12, 2021

@dabrahams Instead of adding the #sourceLocation before the function, it's added as the first line inside the function (so that the citron-generated function signature is not attributed to the grammar file).

@dabrahams
Copy link
Contributor Author

You are awesome! I know this is gonna make my development much better!

@dabrahams
Copy link
Contributor Author

Instead of adding the #sourceLocation before the function, it's added as the first line inside the function (so that the citron-generated function signature is not attributed to the grammar file).

This works great unless you happen to leave the body of the function empty, in which case the error ends up pointing at the signature of the function in the grammar file. Just FWIW.

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

Successfully merging a pull request may close this issue.

2 participants