summaryrefslogtreecommitdiffstats
path: root/cps-path-parser/src/main/antlr4
diff options
context:
space:
mode:
authorRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-17 14:19:46 +0530
committerRudrangi Anupriya <ra00745022@techmahindra.com>2023-04-21 13:44:18 +0530
commitd7bc158cd274b3d6cd01bcad86aef258e6880c1c (patch)
treec94fa03528b6ed4fbb2672267482542dd59f7b73 /cps-path-parser/src/main/antlr4
parentc4621cbcb1f9aad97ba3389468546444d1e9f3dc (diff)
Add contains condition support to cps-path
Issue-ID: CPS-1272 Change-Id: Ic81d1322cacc64a8752916324b801d02be47d34f Signed-off-by: Rudrangi Anupriya <ra00745022@techmahindra.com>
Diffstat (limited to 'cps-path-parser/src/main/antlr4')
-rw-r--r--cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g48
1 files changed, 7 insertions, 1 deletions
diff --git a/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 b/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4
index d4718111f6..86c1705617 100644
--- a/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4
+++ b/cps-path-parser/src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4
@@ -21,7 +21,7 @@
grammar CpsPath ;
-cpsPath : ( prefix | descendant | incorrectPrefix ) multipleLeafConditions? textFunctionCondition? ancestorAxis? invalidPostFix?;
+cpsPath : ( prefix | descendant | incorrectPrefix ) multipleLeafConditions? textFunctionCondition? containsFunctionCondition? ancestorAxis? invalidPostFix?;
ancestorAxis : SLASH KW_ANCESTOR COLONCOLON ancestorPath ;
@@ -29,6 +29,8 @@ ancestorPath : yangElement ( SLASH yangElement)* ;
textFunctionCondition : SLASH leafName OB KW_TEXT_FUNCTION EQ StringLiteral CB ;
+containsFunctionCondition : OB KW_CONTAINS_FUNCTION OP AT leafName COMMA StringLiteral CP CB ;
+
parent : ( SLASH yangElement)* ;
prefix : parent SLASH containerName ;
@@ -65,6 +67,9 @@ COLONCOLON : '::' ;
EQ : '=' ;
OB : '[' ;
SLASH : '/' ;
+COMMA : ',' ;
+OP : '(' ;
+CP : ')' ;
// KEYWORDS
@@ -72,6 +77,7 @@ KW_ANCESTOR : 'ancestor' ;
KW_AND : 'and' ;
KW_TEXT_FUNCTION: 'text()' ;
KW_OR : 'or' ;
+KW_CONTAINS_FUNCTION: 'contains' ;
IntegerLiteral : FragDigits ;
// Add below type definitions for leafvalue comparision in https://jira.onap.org/browse/CPS-440