Skip to content

Commit ed6ec5d

Browse files
authored
Merge branch 'java-regex-simple-assertions' into java-regex-nested-assertions
2 parents 060a02d + 009c895 commit ed6ec5d

83 files changed

Lines changed: 3428 additions & 368 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

client-java/controller/pom.xml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@
144144
<scope>provided</scope>
145145
</dependency>
146146

147+
<!-- Needed for DynamoDb parsing, fixing version to latest one compatible with Java 8, don't upgrade to 4.10 -->
148+
<dependency>
149+
<groupId>org.antlr</groupId>
150+
<artifactId>antlr4-runtime</artifactId>
151+
<version>4.9.3</version>
152+
</dependency>
153+
147154
<dependency>
148155
<groupId>com.h2database</groupId>
149156
<artifactId>h2</artifactId>
@@ -208,10 +215,15 @@
208215
<artifactId>lettuce-core</artifactId>
209216
<scope>test</scope>
210217
</dependency>
211-
<!-- Bringing Netty dependency explicitly as it was excluded from spring-boot-starter-data-redis to avoid version conflict -->
212218
<dependency>
213219
<groupId>software.amazon.awssdk</groupId>
214-
<artifactId>netty-nio-client</artifactId>
220+
<artifactId>dynamodb</artifactId>
221+
<scope>test</scope>
222+
</dependency>
223+
<!-- Some third-party library we use in our test scaffolding might need SLF4j (i.e., Docker) -->
224+
<dependency>
225+
<groupId>org.slf4j</groupId>
226+
<artifactId>slf4j-simple</artifactId>
215227
<scope>test</scope>
216228
</dependency>
217229

@@ -231,7 +243,6 @@
231243
<artifactId>grpc-stub</artifactId>
232244
<scope>test</scope>
233245
</dependency>
234-
235246
</dependencies>
236247

237248
<build>
@@ -269,6 +280,24 @@
269280
<artifactId>maven-compiler-plugin</artifactId>
270281
</plugin>
271282

283+
<!-- Needed for DynamoDB parsing -->
284+
<plugin>
285+
<groupId>org.antlr</groupId>
286+
<artifactId>antlr4-maven-plugin</artifactId>
287+
<version>${antlr.version}</version>
288+
<configuration>
289+
<listener>false</listener>
290+
<visitor>true</visitor>
291+
</configuration>
292+
<executions>
293+
<execution>
294+
<goals>
295+
<goal>antlr4</goal>
296+
</goals>
297+
</execution>
298+
</executions>
299+
</plugin>
300+
272301
<!--
273302
As this library is going to be used and imported by the SUTs,
274303
need to shade its dependencies to avoid the "Jar Hell".
@@ -359,14 +388,7 @@
359388
</execution>
360389
</executions>
361390
</plugin>
362-
363-
<!-- Generates the Cypher and Cql parsers from the Neo4j Cypher25 grammar and the Cql grammar respectively -->
364-
<plugin>
365-
<groupId>org.antlr</groupId>
366-
<artifactId>antlr4-maven-plugin</artifactId>
367-
</plugin>
368-
369-
</plugins>
391+
</plugins>
370392
</build>
371393

372394
</project>
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
grammar DynamoDbConditionExpression;
2+
3+
expression
4+
: orExpr EOF
5+
;
6+
7+
orExpr
8+
: andExpr (OR andExpr)*
9+
;
10+
11+
andExpr
12+
: notExpr (AND notExpr)*
13+
;
14+
15+
notExpr
16+
: NOT notExpr #negatedExpr
17+
| primary #primaryExpr
18+
;
19+
20+
primary
21+
: LPAREN orExpr RPAREN #parenthesizedPrimary
22+
| predicate #predicatePrimary
23+
;
24+
25+
predicate
26+
: ATTRIBUTE_EXISTS LPAREN path RPAREN #attributeExistsPredicate
27+
| ATTRIBUTE_NOT_EXISTS LPAREN path RPAREN #attributeNotExistsPredicate
28+
| ATTRIBUTE_TYPE LPAREN path COMMA value RPAREN #attributeTypePredicate
29+
| BEGINS_WITH LPAREN path COMMA value RPAREN #beginsWithPredicate
30+
| CONTAINS LPAREN path COMMA value RPAREN #containsPredicate
31+
| SIZE LPAREN path RPAREN comparator value #sizePredicate
32+
| path BETWEEN value AND value #betweenPredicate
33+
| path IN LPAREN value (COMMA value)* RPAREN #inPredicate
34+
| path comparator value #comparisonPredicate
35+
;
36+
37+
comparator
38+
: EQ
39+
| NE
40+
| LT
41+
| LTE
42+
| GT
43+
| GTE
44+
;
45+
46+
path
47+
: IDENTIFIER
48+
;
49+
50+
value
51+
: PLACEHOLDER #placeholderValue
52+
| STRING_LITERAL #stringValue
53+
| NUMBER_LITERAL #numberValue
54+
| BOOLEAN_LITERAL #booleanValue
55+
| NULL_LITERAL #nullValue
56+
| IDENTIFIER #identifierValue
57+
;
58+
59+
LPAREN : '(';
60+
RPAREN : ')';
61+
COMMA : ',';
62+
EQ : '=';
63+
NE : '<>';
64+
LTE : '<=';
65+
GTE : '>=';
66+
LT : '<';
67+
GT : '>';
68+
69+
AND : A N D;
70+
OR : O R;
71+
NOT : N O T;
72+
BETWEEN : B E T W E E N;
73+
IN : I N;
74+
ATTRIBUTE_EXISTS : A T T R I B U T E '_' E X I S T S;
75+
ATTRIBUTE_NOT_EXISTS : A T T R I B U T E '_' N O T '_' E X I S T S;
76+
ATTRIBUTE_TYPE : A T T R I B U T E '_' T Y P E;
77+
BEGINS_WITH : B E G I N S '_' W I T H;
78+
CONTAINS : C O N T A I N S;
79+
SIZE : S I Z E;
80+
81+
BOOLEAN_LITERAL : T R U E | F A L S E;
82+
NULL_LITERAL : N U L L;
83+
84+
PLACEHOLDER : ':' IDENT_START IDENT_PART*;
85+
NUMBER_LITERAL : '-'? DIGIT+ ('.' DIGIT+)? EXPONENT?;
86+
STRING_LITERAL : '\'' ~['\r\n]* '\'';
87+
88+
IDENTIFIER : IDENT_START IDENT_PART* INDEX* ('.' IDENT_START IDENT_PART* INDEX*)*;
89+
90+
WS : [ \t\r\n]+ -> skip;
91+
92+
fragment INDEX : '[' DIGIT+ ']';
93+
fragment EXPONENT : [eE] [+\-]? DIGIT+;
94+
fragment IDENT_START : [a-zA-Z_#];
95+
fragment IDENT_PART : [a-zA-Z0-9_];
96+
fragment DIGIT : [0-9];
97+
98+
fragment A : [aA];
99+
fragment B : [bB];
100+
fragment C : [cC];
101+
fragment D : [dD];
102+
fragment E : [eE];
103+
fragment F : [fF];
104+
fragment G : [gG];
105+
fragment H : [hH];
106+
fragment I : [iI];
107+
fragment J : [jJ];
108+
fragment K : [kK];
109+
fragment L : [lL];
110+
fragment M : [mM];
111+
fragment N : [nN];
112+
fragment O : [oO];
113+
fragment P : [pP];
114+
fragment Q : [qQ];
115+
fragment R : [rR];
116+
fragment S : [sS];
117+
fragment T : [tT];
118+
fragment U : [uU];
119+
fragment V : [vV];
120+
fragment W : [wW];
121+
fragment X : [xX];
122+
fragment Y : [yY];
123+
fragment Z : [zZ];

0 commit comments

Comments
 (0)