-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Parsing indentation cleanup #10861
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
Parsing indentation cleanup #10861
Conversation
@@ -3708,8 +3708,8 @@ object Parsers { | |||
|
|||
/** with Template, with EOL <indent> interpreted */ |
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.
should this comment be updated? Is this comment a pseudo grammar? Just from the comment it is not clear which "with" is a keyword and whether "," is a token or an informal alternative.
@@ -80,11 +84,15 @@ object Test: | |||
|
|||
class Test2: | |||
self => | |||
def foo = 1 | |||
def foo(x: Int) = | |||
if x < 0 then throw |
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.
Do we really want to allow this? I somehow parse this as:
if x < 0 then { throw();
val ex = ...
}
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.
For consistency I think it is better to allow it. The given expression abuses indentation rules for sure. It should be formatted like this:
if x < 0 then
throw
val ex = ...
ex
0da59cd
to
a885152
Compare
Change parsing algorithm so that we do not need a separate WITHEOL token. The grammar remains unaffected.
c7b816c
to
625f754
Compare
Eliminate WITHEOL token: Change parsing algorithm so that we do not need a separate WITHEOL token. The grammar remains unaffected.
Make indentation significant after
throw
and?=>