-
Notifications
You must be signed in to change notification settings - Fork 33
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
Bulleted arrays with .
or •
#1361
Conversation
Can you add |
Good question. No, it's not possible without parens. I think at least I think trailing type casts ( |
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.
Thanks for implementing this feature. I'm a little bit scared so I think that means we should do it.
I definitely feel like I'm stretching the grammar a bit here. We lack a nice place to put things that work only at the indentation level, not deeper in an expression. For example, I didn't want to allow something like this: array.map . foo
. bar (in particular because As a result, it seems like I had to add Related, I just added support for trailing members/calls and pipelines after top-level bulleted arrays, enabling I think this is a reasonable starting point though, and we can extend/fix as we run into further issues. |
@edemaine Surely YAML-like object
.method()
.chaining() |
@danielbayley How would you distinguish from subtraction? |
Iv’e never personally used, or seen any multiline subtraction expressions in the wild. Which is of course, not to say this edge case doesn’t exist… Maybe the distinction could be that if there is a newline between total := (
n
- 1
- 1
) Although, maybe that isn’t even necessary, given that in order to subtract, the first token after the assignment @edemaine What do you think? |
My worry is examples involving indented function calls, like this: func x
- y
- z
// parse 1: subtraction (how Civet works now)
func(x
- y
- z)
// parse 2: call with array argument (how . works now)
func(x(
[ y,
z])) I guess you're saying to prioritize the latter parse, but I don't see how to obtain subtraction behavior without moving the |
One possibility that comes to mind: We could add an opt-in YAML compatibility mode via
For some, I can imagine this is a worthwhile trade-off. |
Fixes #803