Skip to content

Commit 51742d6

Browse files
authored
Update sql.bnf (#667)
The optional The ESCAPE clause (with its escape character) acts as a single postfix operator. It can only bind to a preceding [expr] LIKE [expr] expression like_escape_character_expr is needed to create an expression that can be assigned a TEXT type in sqldelight The bind_expr needs to have higher precedence for the correct PSI tree Change the priority order to be above other operators like `||`
1 parent 7594262 commit 51742d6

File tree

1 file changed

+6
-4
lines changed
  • core/src/main/kotlin/com/alecstrong/sql/psi/core

1 file changed

+6
-4
lines changed

core/src/main/kotlin/com/alecstrong/sql/psi/core/sql.bnf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,16 @@ expr ::= ( other_expr
213213
| binary_or_expr
214214
| binary_and_expr
215215
| between_expr
216-
| binary_like_expr
217216
| is_distinct_from_expr // needs to go before is_expr because it starts the same
218217
| is_expr
219218
| null_expr
220219
| collate_expr
221220
| cast_expr
222221
| function_expr
223222
| in_expr
223+
| bind_expr
224+
| like_escape_character_expr // The ESCAPE clause (with its escape character) acts as a single postfix operator
225+
| binary_like_expr
224226
| binary_equality_expr
225227
| binary_boolean_expr
226228
| binary_bitwise_expr
@@ -229,8 +231,7 @@ expr ::= ( other_expr
229231
| binary_pipe_expr
230232
| unary_expr
231233
| literal_expr
232-
| column_expr
233-
| bind_expr )
234+
| column_expr)
234235

235236
other_expr ::= extension_expr
236237
extension_expr ::= FAKE_EXTENSION
@@ -284,7 +285,8 @@ paren_expr ::= LP expr RP {
284285
cast_expr ::= CAST LP expr AS type_name RP
285286
collate_expr ::= expr COLLATE collation_name
286287
binary_like_operator ::= ( LIKE | GLOB | REGEXP | MATCH )
287-
binary_like_expr ::= expr [ NOT ] ( binary_like_operator ) expr [ ESCAPE expr ] {
288+
like_escape_character_expr ::= ESCAPE expr
289+
binary_like_expr ::= expr [ NOT ] binary_like_operator expr [ like_escape_character_expr ] {
288290
mixin = "com.alecstrong.sql.psi.core.psi.mixins.BinaryLikeExprMixin"
289291
}
290292
null_expr ::= expr ( ISNULL | NOTNULL | NOT NULL )

0 commit comments

Comments
 (0)