Skip to content

Commit b7ec980

Browse files
committed
Refactor property_access_prefix to atomic_expression
So it can be used inside asteriskless_andless_expression, avoiding the need to duplicate the list of possible expressions in two places.
1 parent b4153e0 commit b7ec980

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

src/parser/grammar.ne

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,10 @@ expression -> ( andless_expression | logic_operator ) {% unwrap %}
184184
andless_expression -> ( asteriskless_andless_expression | asterisk ) {% unwrap %}
185185

186186
asteriskless_andless_expression ->
187+
( atomic_expression | between_predicate | case_expression ) {% unwrap %}
188+
189+
atomic_expression ->
187190
( array_subscript
188-
| between_predicate
189-
| case_expression
190191
| function_call
191192
| property_access
192193
| parenthesis
@@ -248,7 +249,7 @@ square_brackets -> "[" free_form_sql:* "]" {%
248249
})
249250
%}
250251

251-
property_access -> property_access_prefix _ %DOT _ (identifier | array_subscript | all_columns_asterisk) {%
252+
property_access -> atomic_expression _ %DOT _ (identifier | array_subscript | all_columns_asterisk) {%
252253
// Allowing property to be <array_subscript> is currently a hack.
253254
// A better way would be to allow <property_access> on the left side of array_subscript,
254255
// but we currently can't do that because of another hack that requires
@@ -262,19 +263,6 @@ property_access -> property_access_prefix _ %DOT _ (identifier | array_subscript
262263
}
263264
%}
264265

265-
property_access_prefix ->
266-
( array_subscript
267-
| function_call
268-
| property_access
269-
| parenthesis
270-
| curly_braces
271-
| square_brackets
272-
| operator
273-
| identifier
274-
| parameter
275-
| literal
276-
| keyword ) {% unwrap %}
277-
278266
between_predicate -> %BETWEEN _ andless_expression_chain _ %AND _ andless_expression {%
279267
([betweenToken, _1, expr1, _2, andToken, _3, expr2]) => ({
280268
type: NodeType.between_predicate,

0 commit comments

Comments
 (0)