-
Notifications
You must be signed in to change notification settings - Fork 62
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
Initializes non-reserved PartiQL keywords #780
Conversation
Codecov ReportBase: 81.34% // Head: 81.33% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #780 +/- ##
============================================
- Coverage 81.34% 81.33% -0.02%
- Complexity 2613 2614 +1
============================================
Files 257 257
Lines 21260 21249 -11
Branches 3841 3836 -5
============================================
- Hits 17295 17283 -12
- Misses 2761 2765 +4
+ Partials 1204 1201 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -0,0 +1,325 @@ | |||
# Overview |
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.
This is a really good start to a proper keyword specification table; however, I think it belongs in partiql-docs. I've created an issue in that repository partiql/partiql-docs#28
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.
Agreed. I can move it.
@@ -539,7 +553,7 @@ extract | |||
: EXTRACT PAREN_LEFT IDENTIFIER FROM rhs=expr PAREN_RIGHT; | |||
|
|||
trimFunction | |||
: func=TRIM PAREN_LEFT ( mod=IDENTIFIER? sub=expr? FROM )? target=expr PAREN_RIGHT; | |||
: func=TRIM PAREN_LEFT ( mod=(BOTH|LEADING|TRAILING)? sub=expr? FROM )? target=expr PAREN_RIGHT; |
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.
Is pattern restrictor its own AST node? Also I was just reading through the grammar and noticed that we don't need many of the element labels. The element and list element labels are useful when the rule has more than one element with the same type. Unless that's the case, they're clutter
For example, we don't need any of the element labels here. It makes it harder to read
Ex: https://github.com/partiql/partiql-lang-kotlin/blob/main/partiql-grammar/src/main/antlr/org/partiql/grammar/PartiQL.g4#L329-L337
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 this example, are you talking about labels sub
and target
? Only did that because sub
is optional.
Or func
? I added the func
label just because it made the PartiQLVisitor code look uniform. AKA DateFunction, and TrimFunction, and others result in:
call(ctx.func.text.toLowerCase(), args, metas)
But doesn't matter to me.
And yes, PatternRestrictor is its own AST node.
Relevant Issues
Description
nonreservedKeywords
rule in ANTLR that is a fallback forsymbolPrimitive
TRIM
function allowed an optional IDENTIFIER as the first argument -- then, in the PartiQLVisitor, we would check that the identifier was eitherleading
,trailing
, orboth
. Now, we have formalized a way to still useleading
,trailing
, orboth
as identifiers while still enforcing that the first optional parameter must be one of the 3.trail
,simple
, andacyclic
) were parsed as IDENTIFIERS, but upon visiting, we would check that the identifiers are one of the allowed 3. It's more ideal that we have a formal rule -- that way, writing grammars is easier, and we don't need to write checks in the visitor.Other Information
License Information
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.