xpath BUGFIX nested predicates in leaf-lists
Refs
@@ -7808,14 +7808,22 @@ eval_name_test_try_compile_predicates(const struct lyxp_expr *exp, uint32_t *tok
val_start_idx = e_idx;
/* ']' */
- while (lyxp_check_token(NULL, exp, e_idx, LYXP_TOKEN_BRACK2)) {
- if (!lyxp_check_token(NULL, exp, e_idx, LYXP_TOKEN_OPER_LOG)) {
+ nested_pred = 1;
+ do {
+ ++e_idx;
+
+ if ((nested_pred == 1) && !lyxp_check_token(NULL, exp, e_idx, LYXP_TOKEN_OPER_LOG)) {
/* higher priority than '=' */
rc = LY_ENOT;
goto cleanup;
+ } else if (!lyxp_check_token(NULL, exp, e_idx, LYXP_TOKEN_BRACK1)) {
+ /* nested predicate */
+ ++nested_pred;
+ } else if (!lyxp_check_token(NULL, exp, e_idx, LYXP_TOKEN_BRACK2)) {
+ /* predicate end */
+ --nested_pred;
}
- ++e_idx;
- }
+ } while (nested_pred);
/* try to evaluate the value */
LY_CHECK_GOTO(rc = eval_name_test_try_compile_predicate_append(exp, val_start_idx, e_idx - 1, ctx_scnode, set,
