import module namespace qform = 'urn:quodatum:http.form' at "postutil.xqm"; declare variable $REX:="https://www.bottlecaps.de/rex/"; declare function local:resolve($path as xs:string) as xs:string{ file:resolve-path($path,file:base-dir()) }; declare function local:rex($ebnf,$opts as map(*)) { let $xq:= qform:post-form(map:put($opts,"@input",$ebnf),$REX) let $write:=if($xq instance of xs:base64Binary) then file:write-binary#2 else file:write-text#2 return $write($opts?dest,$xq) }; let $target:={ "xquery": { "dest":local:resolve("../webapp/lsp/xq4.xqm"), "command": "-lalr 2 -tree -name quodatum.parser.xq4 -xquery"}, "basex" : { "dest": local:resolve("../bundles/grammar/xq4.java"), "command": "-lalr 2 -tree -name quodatum.parser.xq4 -java -basex"} } let $ebnf:=local:resolve("../bundles/grammar/XQuery-40.ebnf") return local:rex($ebnf,$target("basex"))