From 2f09266fd3231529e41ce97b02577bc5b82a8c03 Mon Sep 17 00:00:00 2001 From: Lathish Date: Thu, 31 Mar 2022 17:29:22 +0100 Subject: 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 --- .../src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cps-path-parser/src/main/antlr4') 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 -- cgit 1.2.3-korg