-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 ECR::Lexer::SyntaxException
with location info
#15222
Add ECR::Lexer::SyntaxException
with location info
#15222
Conversation
Would be great to have this reviewed and released as a part of Crystal 1.15.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.
suggestion: To simplify the implementation, we could introduce a custom raise
method which raises the appropriate SyntaxException
at the current location:
privat def raise(message)
::raise SyntaxException.new(message, @line_number, @column_number)
end
The existing calls like raise "Unexpected end of file inside <%= ..."
would stay as they are, but now they'd target the instance method instead of the global ::raise
.
@straight-shoota I would prefer naming it something like |
We use instance methods to shadow But I'm fine either way. |
… encountering an exception in ECR lexing
Any chances to include this into v1.15.0? |
ECR::Lexer::SyntaxException
with location info
Closes #15220. Don't know if I should add a rescue to
ECR.process_string
that re-raises as a ECR::SyntaxException, for now though I think this works. Didn't end up going withCrystal::SyntaxException
as that required pulling in the entire ast / parser / compiler files which seemed silly for a simple exception.