Skip to content

Commit 5d11080

Browse files
gregfeliceclaude
andcommitted
Address Copilot review: comment placement, %expect docs, test wording
1. Move "Helper function to create an ExplainStmt node" comment from above make_exists_pattern_sublink() to above make_explain_stmt() where it belongs. 2. Add block comment documenting the %expect/%expect-rr conflict budget: 7 S/R from path vs arithmetic on - and <, 3 R/R from expr_var vs var_name_opt on ) } =. 3. Clarify test comment: "Regular expressions" -> "Regular (non-pattern) expressions" to avoid confusion with regex. Regression test: pattern_expression OK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cd0aebc commit 5d11080

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

regress/expected/pattern_expression.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ $$) AS (result agtype);
193193
(1 row)
194194

195195
--
196-
-- Regular expressions still work (no regression)
196+
-- Regular (non-pattern) expressions still work (no regression)
197197
--
198198
SELECT * FROM cypher('pattern_expr', $$
199199
RETURN (1 + 2)

regress/sql/pattern_expression.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ SELECT * FROM cypher('pattern_expr', $$
141141
$$) AS (result agtype);
142142

143143
--
144-
-- Regular expressions still work (no regression)
144+
-- Regular (non-pattern) expressions still work (no regression)
145145
--
146146
SELECT * FROM cypher('pattern_expr', $$
147147
RETURN (1 + 2)

src/backend/parser/cypher_gram.y

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@
5858
* where both paths succeed (bare (a) prefers the expression interpretation).
5959
*/
6060
%glr-parser
61+
/*
62+
* Conflict budget for the GLR parser. Update these counts if grammar
63+
* rules change.
64+
*
65+
* %expect 7 (shift/reduce) -- All arise from the ambiguity between
66+
* path extension ('-' '[' ... ']' '-' '>') and arithmetic operators
67+
* on '-' and '<'. GLR forks at these points and discards the
68+
* failing alternative.
69+
*
70+
* %expect-rr 3 (reduce/reduce) -- From the overlap between expr_var
71+
* and var_name_opt on ')' / '}' / '='. Resolved by %dprec
72+
* annotations that prefer the expression interpretation.
73+
*/
6174
%expect 7
6275
%expect-rr 3
6376

@@ -3328,7 +3341,6 @@ static Node *build_list_comprehension_node(Node *var, Node *expr,
33283341
return (Node *) node_to_agtype((Node *)sub, "agtype[]", location);
33293342
}
33303343

3331-
/* Helper function to create an ExplainStmt node */
33323344
/*
33333345
* Wrap a graph pattern in an EXISTS SubLink. Used by both
33343346
* EXISTS(pattern) syntax and bare pattern expressions in WHERE.
@@ -3353,6 +3365,7 @@ static Node *make_exists_pattern_sublink(Node *pattern, int location)
33533365
return (Node *)node_to_agtype((Node *)n, "boolean", location);
33543366
}
33553367

3368+
/* Helper function to create an ExplainStmt node */
33563369
static ExplainStmt *make_explain_stmt(List *options)
33573370
{
33583371
ExplainStmt *estmt = makeNode(ExplainStmt);

0 commit comments

Comments
 (0)