summaryrefslogtreecommitdiffstats
path: root/cps-path-parser/src/main/antlr4
diff options
context:
space:
mode:
authorLathish <lathishbabu.ganesan@est.tech>2022-03-31 17:29:22 +0100
committerLathish <lathishbabu.ganesan@est.tech>2022-04-25 18:33:28 +0100
commit2f09266fd3231529e41ce97b02577bc5b82a8c03 (patch)
treed3c2dc83eadd5904775ecfa2621152d9d0e73da8 /cps-path-parser/src/main/antlr4
parent3a13b2e965569304822fe4d56838a4fee4e7ad44 (diff)
Fix Absolute Path to list with Integer/String key
- Introduced normalizedXpath to normalize the xpath and cpspath - Introduced normalizedAncestorpath to normalize the ancestor path in xpath and cpspath - Added new condition in the ANTLR Grammar to capture the invalid path in the xpath - Introduced PathParsingException to replace the IllegalStateException Issue-ID: CPS-961 Change-Id: Ie10f5c6cfc466387e79eec184b933297d1d79587 Signed-off-by: Lathish <lathishbabu.ganesan@est.tech>
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.g46
1 files changed, 4 insertions, 2 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 cefeac4387..40ad410a0d 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
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation
+ * Copyright (C) 2021-2022 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
grammar CpsPath ;
-cpsPath : ( prefix | descendant | incorrectPrefix ) multipleLeafConditions? textFunctionCondition? ancestorAxis? ;
+cpsPath : ( prefix | descendant | incorrectPrefix ) multipleLeafConditions? textFunctionCondition? ancestorAxis? invalidPostFix?;
ancestorAxis : SLASH KW_ANCESTOR COLONCOLON ancestorPath ;
@@ -46,6 +46,8 @@ leafCondition : AT leafName EQ ( IntegerLiteral | StringLiteral) ;
leafName : QName ;
+invalidPostFix : (AT | CB | COLONCOLON | EQ ).+ ;
+
/*
* Lexer Rules
* Most of the lexer rules below are inspired by