From d262e1c3f4671673a02ea402366a8c9b93fe4e53 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 27 Nov 2024 15:38:41 +0000 Subject: [Cps Path Parser] Introduce Attribute axis Add grammar and tests for attribute-axis to match cps paths like: //books/@title which should return the titles of all books (a subsequent patch will implement the logic). The syntax is compatible with XPath standard. Issue-ID: CPS-2416 Signed-off-by: danielhanrahan Change-Id: I25164b23670147c504f0f0f6c0cc8ff15997f2a3 --- .../src/main/antlr4/org/onap/cps/cpspath/parser/antlr4/CpsPath.g4 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cps-path-parser/src/main/antlr4/org/onap') 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 74b99feb33..bb6bfc3942 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 @@ -27,10 +27,12 @@ grammar CpsPath ; -cpsPath : ( prefix | descendant ) multipleLeafConditions? textFunctionCondition? containsFunctionCondition? ancestorAxis? EOF ; +cpsPath : ( prefix | descendant ) multipleLeafConditions? textFunctionCondition? containsFunctionCondition? ancestorAxis? attributeAxis? EOF ; slash : SLASH ; +attributeAxis : SLASH AT leafName ; + ancestorAxis : KW_ANCESTOR_AXIS_PREFIX ancestorPath ; ancestorPath : yangElement ( slash yangElement)* ; -- cgit 1.2.3-korg