"Lexical error" in applying Format & Indent to XQuery

Dear oXygen Support, I encountered an unexpected error today when applying "Format & Indent" to a valid XQuery file. The error is: Cannot format the document. Lexical error at line 21, column 33.
Encountered: "]" (93), after : ""
The XQuery is as follows, and line 21, column 33 corresponds to the nested array constructors [[]] : *xquery version* "3.1";
*declare namespace* *array*="http://www.w3.org/2005/xpath-functions/array" ;
*let* *$permArray* := *function*(*$myAr* *as* *array*(*)) { *let* *$extend* := *function*(*$ar* *as* *array*(*), *$mem* *as* *item* ()*) { *array*{ *for* *$i* *in* 1 *to* (*array:size*(*$ar*) +1) *return* *array:insert-before*(*$ar*, *$i*, *$mem*) } }, *$extendAllSubArrays* := *function*(*$zero* *as* *array*(*), *$mem* *as* *item*()*) { *array:join*( *for* *$i* *in* 1 *to* *array:size*(*$zero*) *return* *$extend*(*$zero*( *$i*), *$mem*) ) } *return* *array:fold-left*(*$myAr*, [[]], *$extendAllSubArrays*) } *return* *$permArray*([1, 2, 3]) => *serialize*(*map* { *"method"*: "json" })
The query was shared on the XML.com Slack at https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU . Using the XQuery debugger, oXygen returns the expected results: [[3,2,1],[2,3,1],[2,1,3],[3,1,2],[1,3,2],[1,2,3]] But for some reason oXygen is unable to perform "format & indent" on the source XQuery. Could you please investigate this "lexical error"? Thank you, Joe

Hello Joe, Thank you for reporting this issue! We will take a look and let you know as soon as we fix it ! Regards, Mircea. -- Enachescu Mircea, Product Architect Syncro Soft | oXygen XML Tel: +1-650-352-1250 ext.212 support@oxygenxml.com http://www.oxygenxml.com On 7/29/2022 8:34 PM, Joe Wicentowski wrote:
Dear oXygen Support,
I encountered an unexpected error today when applying "Format & Indent" to a valid XQuery file. The error is:
Cannot format the document. Lexical error at line 21, column 33. Encountered: "]" (93), after : ""
The XQuery is as follows, and line 21, column 33 corresponds to the nested array constructors [[]] :
*xquery version* "3.1";
*declare namespace* *array*="http://www.w3.org/2005/xpath-functions/array";
*let* *$permArray* := *function*(*$myAr* *as* *array*(*)) { *let* *$extend* := *function*(*$ar* *as* *array*(*), *$mem* *as* *item*()*) { *array*{ *for* *$i* *in* 1 /to/ (/array:size/(*$ar*) +1) *return* /array:insert-before/(*$ar*, *$i*, *$mem*) } }, *$extendAllSubArrays* :=*function*(*$zero* *as* *array*(*), *$mem* *as* *item*()*) { /array:join/( *for* *$i* *in* 1 *to* /array:size/(*$zero*) *return* *$extend*(*$zero*(*$i*), *$mem*) ) } *return* /array:fold-left/(*$myAr*, [[]],*$extendAllSubArrays*) } *return* *$permArray*([1, 2, 3]) => /serialize/(*map* { *"method"*: "json" })
The query was shared on the XML.com Slack at https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU <https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU>.
Using the XQuery debugger, oXygen returns the expected results:
[[3,2,1],[2,3,1],[2,1,3],[3,1,2],[1,3,2],[1,2,3]]
But for some reason oXygen is unable to perform "format & indent" on the source XQuery. Could you please investigate this "lexical error"?
Thank you, Joe
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hi Joe, The problem was identified and solved. it will be available in the next version (25) of Oxygen that will be released this fall. Until the I suggest you to replace the square bracket format of array ("[]") with the keyword fomat. Instead of the "[[]]" expression use: "array { array {}}". Regards, Mircea. On 7/29/2022 8:34 PM, Joe Wicentowski wrote:
Dear oXygen Support,
I encountered an unexpected error today when applying "Format & Indent" to a valid XQuery file. The error is:
Cannot format the document. Lexical error at line 21, column 33. Encountered: "]" (93), after : ""
The XQuery is as follows, and line 21, column 33 corresponds to the nested array constructors [[]] :
*xquery version* "3.1";
*declare namespace* *array*="http://www.w3.org/2005/xpath-functions/array";
*let* *$permArray* := *function*(*$myAr* *as* *array*(*)) { *let* *$extend* := *function*(*$ar* *as* *array*(*), *$mem* *as* *item*()*) { *array*{ *for* *$i* *in* 1 /to/ (/array:size/(*$ar*) +1) *return* /array:insert-before/(*$ar*, *$i*, *$mem*) } }, *$extendAllSubArrays* :=*function*(*$zero* *as* *array*(*), *$mem* *as* *item*()*) { /array:join/( *for* *$i* *in* 1 *to* /array:size/(*$zero*) *return* *$extend*(*$zero*(*$i*), *$mem*) ) } *return* /array:fold-left/(*$myAr*, [[]],*$extendAllSubArrays*) } *return* *$permArray*([1, 2, 3]) => /serialize/(*map* { *"method"*: "json" })
The query was shared on the XML.com Slack at https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU <https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU>.
Using the XQuery debugger, oXygen returns the expected results:
[[3,2,1],[2,3,1],[2,1,3],[3,1,2],[1,3,2],[1,2,3]]
But for some reason oXygen is unable to perform "format & indent" on the source XQuery. Could you please investigate this "lexical error"?
Thank you, Joe
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user
-- Enachescu Mircea, Product Architect Syncro Soft | oXygen XML Tel: +1-650-352-1250 ext.212 support@oxygenxml.com http://www.oxygenxml.com

Hi Mircea, That's great news. Many thanks! Joe On Wed, Aug 10, 2022 at 8:09 AM Oxygen XML Editor Support (Mircea Enachescu) <support@oxygenxml.com> wrote:
Hi Joe,
The problem was identified and solved. it will be available in the next version (25) of Oxygen that will be released this fall. Until the I suggest you to replace the square bracket format of array ("[]") with the keyword fomat. Instead of the "[[]]" expression use: "array { array {}}".
Regards, Mircea.
On 7/29/2022 8:34 PM, Joe Wicentowski wrote:
Dear oXygen Support,
I encountered an unexpected error today when applying "Format & Indent" to a valid XQuery file. The error is:
Cannot format the document. Lexical error at line 21, column 33.
Encountered: "]" (93), after : ""
The XQuery is as follows, and line 21, column 33 corresponds to the nested array constructors [[]] :
*xquery version* "3.1";
*declare namespace* *array*="http://www.w3.org/2005/xpath-functions/array ";
*let* *$permArray* := *function*(*$myAr* *as* *array*(*)) { *let* *$extend* := *function*(*$ar* *as* *array*(*), *$mem* *as* *item* ()*) { *array*{ *for* *$i* *in* 1 *to* (*array:size*(*$ar*) +1) *return* *array:insert-before*(*$ar*, *$i*, *$mem*) } }, *$extendAllSubArrays* := *function*(*$zero* *as* *array*(*), *$mem* *as* *item*()*) { *array:join*( *for* *$i* *in* 1 *to* *array:size*(*$zero*) *return* *$extend*(*$zero*( *$i*), *$mem*) ) } *return* *array:fold-left*(*$myAr*, [[]], *$extendAllSubArrays*) } *return* *$permArray*([1, 2, 3]) => *serialize*(*map* { *"method"*: "json" })
The query was shared on the XML.com Slack at https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU .
Using the XQuery debugger, oXygen returns the expected results:
[[3,2,1],[2,3,1],[2,1,3],[3,1,2],[1,3,2],[1,2,3]]
But for some reason oXygen is unable to perform "format & indent" on the source XQuery. Could you please investigate this "lexical error"?
Thank you, Joe
_______________________________________________ oXygen-user mailing listoXygen-user@oxygenxml.comhttps://www.oxygenxml.com/mailman/listinfo/oxygen-user
-- Enachescu Mircea, Product Architect Syncro Soft | oXygen XML
Tel: +1-650-352-1250 ext.212support@oxygenxml.comhttp://www.oxygenxml.com
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com https://www.oxygenxml.com/mailman/listinfo/oxygen-user
participants (2)
-
Joe Wicentowski
-
Oxygen XML Editor Support (Mircea Enachescu)