-
Notifications
You must be signed in to change notification settings - Fork 221
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
feat!: Require parentheses around pipelines #4775
Conversation
It does make a lot of sense for those parsing error examples that you show. It's a pity though for the common use cases like Would it be possible to require it only in cases where there's a >>> s = 'a' 'b'
>>> s
'ab'
>>> s = ('a'
... 'b')
>>> s
'ab' |
Or if one conceptually separated the two uses of What I mean is, assume one used from customers
derive upper_title = title | text.upper While I usually want to use from customers
derive upper_title = (title | ... | ... |
text.upper) or from customers
derive upper_title = (title
| text.upper) but never from customers
derive upper_title = (title
text.upper) or from customers
derive upper_title = title
text.upper |
I think any deviation away from " |
Need to add some parentheses docs but otherwise this is ready to go! Edit: actually the docs were already up-to-date... the code behavior was overly permissive and we didn't check for an error |
Whether pipelines required parentheses was ambiguous before — does
select (invoice_date | date.to_text "%d/%m/%Y")
require its parentheses? How about in a tuple likeselect {(invoice_date | date.to_text "%d/%m/%Y")}
?This changes the parser so parentheses are required. This creates much better errors in some cases — for example a missing comma from a tuple isn't parsed as a pipeline:
...is no longer parsed as
derive {x=(y | a=b)}
, which is really confusing. Or similarlyderive {x=y a=b}
also parses into that.It also simplifies the parser code slightly; unifying
pipeline
functions.(tests fail on parsing one thing from the std lib, I need to fix)