Am 10/24/2022 um 12:45 PM schrieb Hans-Jürgen Rennau:
Hello,

I noticed that the lookup operator (?) accepts as key expression also non-parenthesized expressions, e.g.:

$map?$key

It seems to me that the XQuery spec does not allow that - the key specifier must be an NCName, an integer, * or a parenthesized expression [1]:
[126] KeySpecifier ::= NCName | IntegerLiteral | ParenthesizedExpr | "*"    
So only this should be allowed:
$map?($key)

But I am not quite sure if I do not overlook something.

My question: is the acceptance of non-parenthesized key expressions conformant behaviour, or a (certainly intended) laxness?


If it is BaseX 10 it might be because it already tries to implement what XQuery 4 https://qt4cg.org/specifications/xquery-40/xquery-40-diff.html#id-unary-lookup is going to allow:

[141]   KeySpecifier   ::=   NCName | IntegerLiteral | StringLiteral | VarRef | ParenthesizedExpr | "*"