<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
Hi Joe,<br>
<br>
The problem was identified and solved. it will be available in the
next version (25) of Oxygen that will be released this fall.<br>
Until the I suggest you to replace the square bracket format of
array ("[]") with the keyword fomat.<br>
Instead of the "[[]]" expression use: "array { array {}}".<br>
<br>
Regards,<br>
Mircea.<br>
<br>
<div class="moz-cite-prefix">On 7/29/2022 8:34 PM, Joe Wicentowski
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAHwerk2C-WUPCgK9fG6xeSZw+0e=O5Dz7__cYOEFoqXA1kNyMA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">Dear oXygen Support,
<div><br>
</div>
<div>I encountered an unexpected error today when applying
"Format & Indent" to a valid XQuery file. The error is:</div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Cannot
format the document. Lexical error at line 21, column 33.
Encountered: "]" (93), after : ""</blockquote>
<div><br>
</div>
<div>The XQuery is as follows, and line 21, column 33
corresponds to the nested array constructors [[]] :</div>
<div><br>
</div>
<div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px
solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<p class="gmail-p1"
style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:normal;font-family:Helvetica"><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>xquery
version</b></span> <span class="gmail-s2"
style="color:rgb(50,50,150)">"3.1"</span><span
class="gmail-s3" style="color:rgb(120,120,0)">;</span><br>
<br>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>declare
namespace</b></span> <span class="gmail-s4"
style="color:rgb(0,0,230)"><b>array</b></span><span
class="gmail-s5" style="color:rgb(200,80,40)">=</span><span
class="gmail-s2" style="color:rgb(50,50,150)">"<a
href="http://www.w3.org/2005/xpath-functions/array"
moz-do-not-send="true" class="moz-txt-link-freetext">http://www.w3.org/2005/xpath-functions/array</a>"</span><span
class="gmail-s3" style="color:rgb(120,120,0)">;</span><br>
<br>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>let</b></span>
<span class="gmail-s6" style="color:rgb(150,50,150)"><b>$permArray</b></span>
<span class="gmail-s3" style="color:rgb(120,120,0)">:=</span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>function</b></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$myAr</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>as</b></span>
<span class="gmail-s4" style="color:rgb(0,0,230)"><b>array</b></span>(<span
class="gmail-s3" style="color:rgb(120,120,0)">*</span>))
<span class="gmail-Apple-converted-space"> </span><br>
{<span class="gmail-Apple-converted-space"> </span><br>
<span class="gmail-Apple-converted-space"> </span><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>let</b></span>
<span class="gmail-s6" style="color:rgb(150,50,150)"><b>$extend</b></span>
<span class="gmail-s3" style="color:rgb(120,120,0)">:=</span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>function</b></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$ar</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>as</b></span>
<span class="gmail-s4" style="color:rgb(0,0,230)"><b>array</b></span>(<span
class="gmail-s3" style="color:rgb(120,120,0)">*</span>)<span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$mem</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>as</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>item</b></span>()<span
class="gmail-s3" style="color:rgb(120,120,0)">*</span>)
<br>
<span class="gmail-Apple-converted-space">
</span>{<br>
<span class="gmail-Apple-converted-space">
</span><span class="gmail-s1"
style="color:rgb(0,150,200)"><b>array</b></span>{ <span
class="gmail-Apple-converted-space"> </span><br>
<span class="gmail-Apple-converted-space">
</span><span class="gmail-s4"
style="color:rgb(0,0,230)"><b>for</b></span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$i</b></span>
<span class="gmail-s4" style="color:rgb(0,0,230)"><b>in</b></span>
<span class="gmail-s2" style="color:rgb(50,50,150)">1</span>
<span class="gmail-s7" style="color:rgb(0,64,0)"><i>to</i></span>
(<span class="gmail-s7" style="color:rgb(0,64,0)"><i>array:size</i></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$ar</b></span>)
<span class="gmail-s3" style="color:rgb(120,120,0)">+</span><span
class="gmail-s2" style="color:rgb(50,50,150)">1</span>)<br>
<span class="gmail-Apple-converted-space">
</span><span class="gmail-s4"
style="color:rgb(0,0,230)"><b>return</b></span> <span
class="gmail-Apple-converted-space">
</span><br>
<span class="gmail-Apple-converted-space">
</span><span class="gmail-s7"
style="color:rgb(0,64,0)"><i>array:insert-before</i></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$ar</b></span><span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$i</b></span><span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$mem</b></span>)<br>
<span class="gmail-Apple-converted-space">
</span>} <span
class="gmail-Apple-converted-space"> </span><br>
<span class="gmail-Apple-converted-space">
</span>}<span class="gmail-s3"
style="color:rgb(120,120,0)">,</span><br>
<span class="gmail-Apple-converted-space"> </span><span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$extendAllSubArrays</b></span>
<span class="gmail-s3" style="color:rgb(120,120,0)">:=</span><span
class="gmail-Apple-converted-space"> </span><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>function</b></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$zero</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>as</b></span>
<span class="gmail-s4" style="color:rgb(0,0,230)"><b>array</b></span>(<span
class="gmail-s3" style="color:rgb(120,120,0)">*</span>)<span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$mem</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>as</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>item</b></span>()<span
class="gmail-s3" style="color:rgb(120,120,0)">*</span>)<br>
<span class="gmail-Apple-converted-space">
</span>{<br>
<span class="gmail-Apple-converted-space">
</span><span class="gmail-s7"
style="color:rgb(0,64,0)"><i>array:join</i></span>(<br>
<span class="gmail-Apple-converted-space">
</span><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>for</b></span>
<span class="gmail-s6" style="color:rgb(150,50,150)"><b>$i</b></span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>in</b></span>
<span class="gmail-s2" style="color:rgb(50,50,150)">1</span>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>to</b></span>
<span class="gmail-s7" style="color:rgb(0,64,0)"><i>array:size</i></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$zero</b></span>)<br>
<span class="gmail-Apple-converted-space">
</span><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>return</b></span>
<span class="gmail-s6" style="color:rgb(150,50,150)"><b>$extend</b></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$zero</b></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$i</b></span>)<span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$mem</b></span>)<br>
<span class="gmail-Apple-converted-space">
</span>)<br>
<span class="gmail-Apple-converted-space">
</span>}<br>
<span class="gmail-Apple-converted-space"> </span><span
class="gmail-s1" style="color:rgb(0,150,200)"><b>return</b></span><br>
<span class="gmail-Apple-converted-space"> </span><span
class="gmail-s7" style="color:rgb(0,64,0)"><i>array:fold-left</i></span>(<span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$myAr</b></span><span
class="gmail-s3" style="color:rgb(120,120,0)">,</span>
[[]]<span class="gmail-s3" style="color:rgb(120,120,0)">,</span><span
class="gmail-Apple-converted-space"> </span><span
class="gmail-s6" style="color:rgb(150,50,150)"><b>$extendAllSubArrays</b></span>)<span
class="gmail-Apple-converted-space"> </span><br>
}<br>
<span class="gmail-s1" style="color:rgb(0,150,200)"><b>return</b></span>
<span class="gmail-s6" style="color:rgb(150,50,150)"><b>$permArray</b></span>([<span
class="gmail-s2" style="color:rgb(50,50,150)">1</span><span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s2" style="color:rgb(50,50,150)">2</span><span
class="gmail-s3" style="color:rgb(120,120,0)">,</span> <span
class="gmail-s2" style="color:rgb(50,50,150)">3</span>])
<span class="gmail-s3" style="color:rgb(120,120,0)">=></span>
<span class="gmail-s7" style="color:rgb(0,64,0)"><i>serialize</i></span>(<span
class="gmail-s1" style="color:rgb(0,150,200)"><b>map</b></span>
{ <span class="gmail-s6" style="color:rgb(150,50,150)"><b>"method"</b></span><span
class="gmail-s3" style="color:rgb(120,120,0)">:</span> <span
class="gmail-s2" style="color:rgb(50,50,150)">"json"</span>
})</p>
</blockquote>
</div>
<div><br>
</div>
<div>The query was shared on the XML.com Slack at <a
href="https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU"
moz-do-not-send="true">https://xmlcom.slack.com/archives/C011NLXE4DU/p1659114945879269?thread_ts=1658881670.454309&cid=C011NLXE4DU</a>.</div>
<div><br>
</div>
<div>Using the XQuery debugger, oXygen returns the expected
results: </div>
<div><br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">[[3,2,1],[2,3,1],[2,1,3],[3,1,2],[1,3,2],[1,2,3]]</blockquote>
<div><br>
</div>
<div>But for some reason oXygen is unable to perform "format
& indent" on the source XQuery. Could you please
investigate this "lexical error"?</div>
<div><br>
</div>
<div>Thank you,</div>
<div>Joe</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
oXygen-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:oXygen-user@oxygenxml.com">oXygen-user@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="https://www.oxygenxml.com/mailman/listinfo/oxygen-user">https://www.oxygenxml.com/mailman/listinfo/oxygen-user</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="100">--
Enachescu Mircea, Product Architect
Syncro Soft | oXygen XML
Tel: +1-650-352-1250 ext.212
<a class="moz-txt-link-abbreviated" href="mailto:support@oxygenxml.com">support@oxygenxml.com</a>
<a class="moz-txt-link-freetext" href="http://www.oxygenxml.com">http://www.oxygenxml.com</a>
</pre>
</body>
</html>