ligasgr / intellij-xquery

Plugin to support XQuery in Intellij Idea
Apache License 2.0
35 stars 23 forks source link

Support ArgumentPlaceholder("?") in function calls #218

Closed willsthompson closed 6 years ago

willsthompson commented 7 years ago

Starting in XQuery 3.0, an ArgumentPlaceholder can be used in place of a function argument, and the function will be curried into a partial function application. This is also supported in the "1.0-ml" version syntax.

https://www.w3.org/TR/xquery-30/#doc-xquery30-ArgumentPlaceholder

xquery version "3.0";
let $func-partial := fn:string-join(?, ', ')
return $func-partial((1, 2, 3))
rhdunn commented 6 years ago

Parsing ArgumentPlaceholder before ExprSingle in Argument will cause the following to generate a parse error:

xquery version "3.0";
let $f := fn:string-join(?test, ', ')
return $f

It should either use the current context item if supported by the XQuery processor, or generate an XPDY0002 "missing context item" error.

ligasgr commented 6 years ago

You're absolutely right! Thanks for pointing this test case out. I've missed in all the rush to fix the issue!