mihaibudiu commented on code in PR #4844:
URL: https://github.com/apache/calcite/pull/4844#discussion_r3120233492
##########
core/src/main/codegen/templates/Parser.jj:
##########
@@ -3774,6 +3774,48 @@ SqlNode Expression(ExprContext exprContext) :
list = Expression2(exprContext) { return SqlParserUtil.toTree(list); }
}
+/** Parses regular postfixes such as {@code a.b}, {@code a[1]} and
+ * {@code a[1].b}. Shared by the main expression grammar and Babel's
+ * infix cast. */
+void AddRegularPostfixes(List<Object> list) :
+{
+ SqlNode ext;
+}
+{
+ (
+ LOOKAHEAD(2) <DOT>
+ ext = RowExpressionExtension() {
+ list.add(
+ new SqlParserUtil.ToTreeListItem(
+ SqlStdOperatorTable.DOT, getPos()));
+ list.add(ext);
+ }
+ |
+ AddBracketPostfix(list)
+ )*
+}
+
+/** Parses postfixes that are allowed after colon field access, for example
+ * {@code v:field.nested} or {@code v:[1]['x']}. Unlike regular postfixes,
+ * this path does not allow member-style calls such as {@code v:field.func()}.
*/
+void AddColonPostfixes(List<Object> list) :
+{
+ SqlIdentifier p;
+}
+{
+ (
+ LOOKAHEAD(2) <DOT>
+ p = SimpleIdentifier() {
+ list.add(
+ new SqlParserUtil.ToTreeListItem(
Review Comment:
So is the plan in a subsequent PR to add a Colon operator and replace this
with colon?
Then I would suggest using the colon from the start. You don't want people
to take a dependence on this parse tree and to expect a dot. Why change
something if you can do it right from the start?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]