Skip to content
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

Keywords used only query expressions should not be reserved everywhere #1136

Closed
jclark opened this issue Jul 5, 2022 · 8 comments
Closed
Labels
Area/Lang Relates to the Ballerina language specification sl-update-priority Priority for Swan Lake Updates
Milestone

Comments

@jclark
Copy link
Collaborator

jclark commented Jul 5, 2022

At the moment, keywords used only in query expressions are reserved everywhere.

This would create a problem for adding #1134 in Swan Lake, since reserving new keywords would create an incompatibility.

If we do a new keyword for #1137 (e.g. aggregate or collect), then we need to handle that here also.

@jclark jclark added the Area/Lang Relates to the Ballerina language specification label Jul 5, 2022
@jclark jclark added this to the Swan Lake Update 3 milestone Jul 5, 2022
@jclark
Copy link
Collaborator Author

jclark commented Jul 5, 2022

This covers:

  • where
  • join, outer, equals, on
  • order by, ascending, descending
  • limit
  • on conflict
  • group by
  • TBD keyword for aggregation e.g. collect

@jclark
Copy link
Collaborator Author

jclark commented Jul 5, 2022

I think group by should be reasonably straightforward to solve:

  • we can treat it as a single keyword that is spelled with whitespace, rather than as two separate keywords
  • I don't think it's possible to have two adjacent identifiers in an expression where neither identifier is a keyword: there's always some operator symbol between them.

@jclark
Copy link
Collaborator Author

jclark commented Jul 5, 2022

Each from is paired with a select, collect or do, with the query pipeline in between, so one can keep track of the number of "open" froms, and recognize some keywords only when there is an open from i.e. collect, select and keywords occurring only in the query pipeline.

This still creates potential (albeit fairly unlikely) incompatibilities in that use of collect within the query pipeline would become syntactically invalid.

@jclark
Copy link
Collaborator Author

jclark commented Aug 17, 2022

I think a better solution to this is just to say that the identifiers that start a clause (other than from and let, which is already reserved) should not be reserved at all.

Only tricky case I think is the order direction (ascending or descending) in an order by clause.

@jclark jclark added the sl-update-priority Priority for Swan Lake Updates label Dec 20, 2022
@jclark jclark modified the milestones: 2023R1, 2013R2 Apr 25, 2023
@jclark
Copy link
Collaborator Author

jclark commented Jun 15, 2023

@KavinduZoysa @hasithaa Did you make ascending, descending not reserved?

It would be nice to do that also, but I'm 100% sure if that can be done without problems.

@KavinduZoysa
Copy link
Contributor

@jclark, ascending and descending keywords are still reserved. But group and collect are not reserved. We will revisit other keywords under this lang issue and fix them.

@jclark
Copy link
Collaborator Author

jclark commented Jun 20, 2023

I think just "conflict" should be NR rather than "on" "conflict".

@jclark
Copy link
Collaborator Author

jclark commented Jun 20, 2023

This issue has dealt with keywords that start clauses. Other keywords are dealt with by #1255.

jclark added a commit that referenced this issue Jun 21, 2023
In `on conflict`, `on` is reserved (because used in `on fail`, but `conflict` isn't.
Part of #1136
@jclark jclark closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Lang Relates to the Ballerina language specification sl-update-priority Priority for Swan Lake Updates
Projects
None yet
Development

No branches or pull requests

2 participants