aboutsummaryrefslogtreecommitdiffstats
path: root/cps-path-parser/src/main/antlr4
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-09-04 18:15:17 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2024-09-18 16:03:15 +0100
commit44cb5c4d60cd73147e469338cfd7a14ba13857b3 (patch)
tree834e91b820d5fe0f4c21fb05a23e09de0039e5a5 /cps-path-parser/src/main/antlr4
parent9d967bc4a63238d1bd147155b4c3abf95c2ac7c5 (diff)
[Cps Path Parser] Fixes for parent path & normalization
This commit fixes issues with Cps Path Parser related to path normalization and parent path generation when using descendant paths and ancestor axis. Issue-ID: CPS-2365 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I728fc379b134bd62c39a7085650930450c8a8597
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.g417
1 files changed, 10 insertions, 7 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 be8d968fcb..444702db48 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
@@ -29,19 +29,21 @@ grammar CpsPath ;
cpsPath : ( prefix | descendant ) multipleLeafConditions? textFunctionCondition? containsFunctionCondition? ancestorAxis? EOF ;
-ancestorAxis : SLASH KW_ANCESTOR COLONCOLON ancestorPath ;
+slash : SLASH ;
-ancestorPath : yangElement ( SLASH yangElement)* ;
+ancestorAxis : KW_ANCESTOR_AXIS_PREFIX ancestorPath ;
-textFunctionCondition : SLASH leafName OB KW_TEXT_FUNCTION EQ StringLiteral CB ;
+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)* ;
+parent : ( slash yangElement)* ;
-prefix : parent SLASH containerName ;
+prefix : parent slash containerName ;
-descendant : SLASH prefix ;
+descendant : slash prefix ;
yangElement : containerName listElementRef? ;
@@ -85,7 +87,8 @@ KW_ANCESTOR : 'ancestor' ;
KW_AND : 'and' ;
KW_TEXT_FUNCTION: 'text()' ;
KW_OR : 'or' ;
-KW_CONTAINS_FUNCTION: 'contains' ;
+KW_CONTAINS_FUNCTION : 'contains' ;
+KW_ANCESTOR_AXIS_PREFIX : SLASH KW_ANCESTOR COLONCOLON ;
IntegerLiteral : FragDigits ;
// Add below type definitions for leafvalue comparision in https://jira.onap.org/browse/CPS-440