-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow observing an indent after conditional #22611
Conversation
e65b79e
to
1564f74
Compare
Note to self: #19099 is infix indent. (PR from end of queue.) |
It would be nice to avoid |
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.
Otherwise LGTM
@@ -105,6 +105,9 @@ object Parsers { | |||
private val InCase: Region => Region = Scanners.InCase(_) | |||
private val InCond: Region => Region = Scanners.InParens(LPAREN, _) | |||
private val InFor : Region => Region = Scanners.InBraces(_) | |||
private val InBrk : Region => Region = |
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.
I don't know what InBrk
is supposed to mean. Can we find a better name?
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.
Also, it would be good to point to the issue number to explain what this fixes.
Normally do not infer NEWLINE within parens, but special case old syntax for conditionals, so that it can observe indented syntax. The mechanism is to inject an Indented region when parsing a parenthesized condition which is within an InParens region, such as an arg list. The effect is not to advance past EOL after `(true)`.
971dacf
to
a19c14a
Compare
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.
That's clear now.
Normally do not infer NEWLINE within parens,
but special case old syntax for conditionals,
so that it can observe indented syntax.
The mechanism is to inject an Indented region
when parsing a parenthesized condition which is
within an InParens region, such as an arg list.
The effect is not to advance past EOL after
(true)
.Fixes #22608