aboutsummaryrefslogtreecommitdiffstats
path: root/aai-traversal/src/main/resources/antlr4/org/onap
diff options
context:
space:
mode:
authorLaMont, William (wl2432) <wl2432@att.com>2019-04-10 18:03:20 -0400
committerLaMont, William (wl2432) <wl2432@att.com>2019-04-11 10:49:45 -0400
commit5b3ccace8082f9ae76a69d8fc96def195c2c3da7 (patch)
treea0fb0931174962be0be8fdef15c360da36487503 /aai-traversal/src/main/resources/antlr4/org/onap
parent4bba3fc57cddd367ee472b2007b37ff568416c7b (diff)
add v16 to traversal repo
Issue-ID: AAI-2322 Change-Id: I8967e1e90dc407424c8b8943d1278108f9786cef Signed-off-by: LaMont, William (wl2432) <wl2432@att.com>
Diffstat (limited to 'aai-traversal/src/main/resources/antlr4/org/onap')
-rw-r--r--aai-traversal/src/main/resources/antlr4/org/onap/aai/AAIDsl.g455
1 files changed, 28 insertions, 27 deletions
diff --git a/aai-traversal/src/main/resources/antlr4/org/onap/aai/AAIDsl.g4 b/aai-traversal/src/main/resources/antlr4/org/onap/aai/AAIDsl.g4
index cf34571..78162f5 100644
--- a/aai-traversal/src/main/resources/antlr4/org/onap/aai/AAIDsl.g4
+++ b/aai-traversal/src/main/resources/antlr4/org/onap/aai/AAIDsl.g4
@@ -1,29 +1,41 @@
/**
- * Define a grammar called AAIDsl
+ * Define a parser grammar called AAIDsl
*/
grammar AAIDsl;
+aaiquery: startStatement limit?;
-aaiquery: dslStatement;
+startStatement: (vertex ) (traversal)* ;
+nestedStatement: (vertex|unionVertex ) (traversal)* ;
-dslStatement: (singleNodeStep ) (traverseStep )* limitStep*;
+vertex: label store? (filter)?;
-unionQueryStep: LBRACKET dslStatement ( COMMA (dslStatement))* RBRACKET;
+traversal: (edge (vertex|unionVertex));
-traverseStep: (TRAVERSE ( singleNodeStep | unionQueryStep));
+filter: (propertyFilter)* whereFilter?;
+propertyFilter: (not? '(' key (',' (key | num))* ')');
-singleNodeStep: NODE STORE? (filterStep | filterTraverseStep)*;
+whereFilter: (not? '(' edge nestedStatement ')' );
-filterStep: NOT? (LPAREN KEY (COMMA (KEY | NODE))* RPAREN);
-filterTraverseStep: (LPAREN traverseStep* RPAREN);
+unionVertex: '[' ( (edgeFilter)* nestedStatement ( comma ( (edgeFilter)* nestedStatement))*) ']';
-limitStep: LIMIT NODE;
+comma: ',';
+edge: TRAVERSE (edgeFilter)*;
+edgeFilter: '(' key (',' key )* ')';
-LIMIT: 'LIMIT';
-NODE: ID;
+num: NUM;
+limit: LIMIT num;
+label: (ID | NUM )+;
+key: KEY;
-KEY: ['] (ID | ' ')* ['] ;
+store: STORE;
+not: NOT;
+LIMIT: 'LIMIT'|'limit';
+NUM: (DIGIT)+;
+
+/*NODE: (ID | NUM )+;*/
+KEY : '\'' ( ~['\r\n] )*? '\'';
AND: [&];
@@ -33,29 +45,18 @@ OR: [|];
TRAVERSE: [>] ;
-LPAREN: [(];
-
-RPAREN: [)];
-
-COMMA: [,] ;
-
EQUAL: [=];
-LBRACKET: [[];
-
-RBRACKET: [\]];
-
NOT: [!];
-VALUE: [DIGIT]+;
-
fragment LOWERCASE : [a-z] ;
fragment UPPERCASE : [A-Z] ;
fragment DIGIT : [0-9] ;
+fragment ESC : '\\' . ;
+fragment ID_SPECIALS: [-:_];
+
ID
- : ( LOWERCASE | UPPERCASE | DIGIT) ( LOWERCASE | UPPERCASE | DIGIT | '-' | '.' | '_' | '/')*
+ : ( LOWERCASE | UPPERCASE | DIGIT | ID_SPECIALS)
;
WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines
-
-