Skip to content

Commit 7e6fffc

Browse files
gabriele-tomassettiadamretter
authored andcommitted
[feature] Add handling of intermediate AST for replace expression
1 parent 40434b2 commit 7e6fffc

File tree

1 file changed

+31
-0
lines changed
  • exist-core/src/main/antlr/org/exist/xquery/parser

1 file changed

+31
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,6 +2200,8 @@ throws PermissionDeniedException, EXistException, XPathException
22002200
|
22012201
step=xqufDeleteExpr [path]
22022202
|
2203+
step=xqufReplaceExpr [path]
2204+
|
22032205
step=transformWithExpr [path]
22042206
|
22052207
step=copyModifyExpr [path]
@@ -3952,6 +3954,35 @@ throws XPathException, PermissionDeniedException, EXistException
39523954
)
39533955
;
39543956

3957+
xqufReplaceExpr [PathExpr path]
3958+
returns [Expression step]
3959+
throws XPathException, PermissionDeniedException, EXistException
3960+
{
3961+
}:
3962+
#(
3963+
replaceAST:"replace"
3964+
{
3965+
PathExpr target = new PathExpr(context);
3966+
PathExpr with = new PathExpr(context);
3967+
ReplaceExpr.ReplacementType replacementType = ReplaceExpr.ReplacementType.NODE;
3968+
}
3969+
(
3970+
"value"
3971+
{
3972+
replacementType = ReplaceExpr.ReplacementType.VALUE;
3973+
}
3974+
)?
3975+
step=expr [target]
3976+
step=expr [with]
3977+
{
3978+
ReplaceExpr replaceExpr = new ReplaceExpr(context, target, with, replacementType);
3979+
replaceExpr.setASTNode(replaceAST);
3980+
path.add(replaceExpr);
3981+
step = replaceExpr;
3982+
}
3983+
)
3984+
;
3985+
39553986
mapConstr [PathExpr path]
39563987
returns [Expression step]
39573988
throws XPathException, PermissionDeniedException, EXistException

0 commit comments

Comments
 (0)