Skip to content

Commit 40434b2

Browse files
gabriele-tomassettiadamretter
authored andcommitted
[feature] Add parsing support for replace expression
1 parent e381421 commit 40434b2

File tree

1 file changed

+8
-2
lines changed
  • exist-core/src/main/antlr/org/exist/xquery/parser

1 file changed

+8
-2
lines changed

exist-core/src/main/antlr/org/exist/xquery/parser/XQuery.g

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -721,8 +721,9 @@ exprSingle throws XPathException
721721
| ( "switch" LPAREN ) => switchExpr
722722
| ( "typeswitch" LPAREN ) => typeswitchExpr
723723
| ( "update" ( "replace" | "value" | "insert" | "delete" | "rename" )) => updateExpr
724-
| ( "insert" ) => xqufInsertExpr
725-
| ( "delete" ) => xqufDeleteExpr
724+
| ( "insert" ( "node" | "nodes" ) ) => xqufInsertExpr
725+
| ( "delete" ( "node" | "nodes" ) ) => xqufDeleteExpr
726+
| ( "replace" ( "value" | "node" ) ) => xqufReplaceExpr
726727
| ( "copy" DOLLAR) => copyModifyExpr
727728
| ( "invoke" "updating" ) => dynamicUpdFunCall
728729
| orExpr
@@ -794,6 +795,11 @@ xqufDeleteExpr throws XPathException
794795
"delete"^ ( "node"! | "nodes"! ) exprSingle
795796
;
796797
798+
xqufReplaceExpr throws XPathException
799+
:
800+
"replace"^ ("value" "of"!)? "node"! exprSingle "with"! exprSingle
801+
;
802+
797803
copyModifyExpr throws XPathException
798804
:
799805
"copy"^ letVarBinding ( COMMA! letVarBinding )*

0 commit comments

Comments
 (0)