Skip to content

Commit

Permalink
full revert on the idea not to allow spaces in PGQ arrow specifications
Browse files Browse the repository at this point in the history
now, we allow them

so the <-> and <- symbols were removed again.

This change of thought was triggered by the mayhem the new lexical
symbols were causing:

================================================================================
Query unexpectedly failed (test/optimizer/move_constants.test:101)
================================================================================
EXPLAIN SELECT -1*X<-5 FROM test;
================================================================================
Actual result:
Parser Error: syntax error at or near "<-"
LINE 1: EXPLAIN SELECT -1*X<-5 FROM test

but the main result of this PR is still: you can now type ->* without spaces
  • Loading branch information
peter authored and peter committed Nov 18, 2024
1 parent f27ad97 commit 9ee35ae
Show file tree
Hide file tree
Showing 5 changed files with 19,614 additions and 19,679 deletions.
2 changes: 1 addition & 1 deletion third_party/libpg_query/grammar/grammar.y
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
%nonassoc SET /* see */
%left UNION EXCEPT
%left INTERSECT
%left LAMBDA_ARROW DOUBLE_ARROW ARROW_LEFT ARROW_BOTH
%left LAMBDA_ARROW DOUBLE_ARROW
%left OR
%left AND
%right NOT
Expand Down
14 changes: 10 additions & 4 deletions third_party/libpg_query/grammar/statements/pgq.y
Original file line number Diff line number Diff line change
Expand Up @@ -757,18 +757,24 @@ FullElementSpec:
}
;

/* we now do *not* allow spaces inside the arrows (we extended the DDB lexer in scan.l and grammar.y for this) */
/* we allow spaces inside the arrows */
Arrow:
'-'
{ $$ = "-"; }
|
ARROW_LEFT
'<' '-'
{ $$ = "<-"; }
|
LAMBDA_ARROW
{ $$ = "->"; }
|
ARROW_BOTH
'-' '>'
{ $$ = "->"; }
|
'<' LAMBDA_ARROW
{ $$ = "<->"; }
|
'<' '-' '>'
{ $$ = "<->"; }
|
Op
Expand All @@ -793,7 +799,7 @@ ArrowLeft:
'-' '['
{ $$ = "-"; }
|
ARROW_LEFT '['
'<' '-' '['
{ $$ = "<-"; }
;

Expand Down
12 changes: 0 additions & 12 deletions third_party/libpg_query/scan.l
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,6 @@ dot_dot \.\.
colon_equals ":="
lambda_arrow "->"
double_arrow "->>"
arrow_left "<-"
arrow_both "<->"
power_of "**"
integer_div "//"

Expand Down Expand Up @@ -828,16 +826,6 @@ other .
return LAMBDA_ARROW;
}

{arrow_left} {
SET_YYLLOC();
return ARROW_LEFT;
}

{arrow_both} {
SET_YYLLOC();
return ARROW_BOTH;
}

{double_arrow} {
SET_YYLLOC();
return DOUBLE_ARROW;
Expand Down
Loading

0 comments on commit 9ee35ae

Please sign in to comment.