[mod] java xq parser
This commit is contained in:
parent
c8e4f928b1
commit
99a77cd5bf
4 changed files with 19 additions and 7 deletions
|
@ -1,4 +1,5 @@
|
|||
declare base-uri "../..";
|
||||
import module namespace xq4="java:quodatum.parser.xq4";
|
||||
"C:\Users\mrwhe\git\quodatum\basex-lsp\test\sample.docs\pdfbox.xqm"
|
||||
=>unparsed-text()
|
||||
(: "test/sample.docs/pdfbox.xqm"=>unparsed-text() :)
|
||||
"2+4"
|
||||
=>xq4:parseModule()
|
|
@ -10,6 +10,7 @@ services:
|
|||
volumes:
|
||||
- ./data:/srv/basex/data
|
||||
# - ./webapp/web.xml:/srv/basex/webapp/WEB-INF/web.xml # set websocket options 12.1+
|
||||
- ./bundles/grammar/xq4.jar:/srv/basex/lib/custom/xq4.jar
|
||||
- ./webapp/lsp:/srv/basex/webapp/lsp
|
||||
- ./webapp/static/clients:/srv/basex/webapp/static/clients
|
||||
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
@author Andy Bunce
|
||||
:)
|
||||
module namespace docs="lsp/docs";
|
||||
import module namespace p="xq4" at "xq4.xqm";
|
||||
(: import module namespace p="xq4" at "xq4.xqm"; :)
|
||||
import module namespace xq4="java:quodatum.parser.xq4";
|
||||
import module namespace pos="lsp/position" at "position.xqm";
|
||||
import module namespace rpc = 'rpc' at 'jsonrpc.xqm';
|
||||
import module namespace lsp-diags = 'lsp-diags' at 'lsp-diags.xqm';
|
||||
|
@ -118,7 +119,7 @@ declare function docs:parse(
|
|||
)as map(*)?
|
||||
{
|
||||
let $text:=docs:get($socket,$file,"textDocument")?text
|
||||
let $xml:= p:parse-Module($text)=>prof:time("⏱️ p:parse-Module " || $file)
|
||||
let $xml:= xq4:parseModule($text)=>prof:time("⏱️ p:parse-Module " || $file)
|
||||
return (
|
||||
ws:set($socket,docs:key($socket,$file,"parse"),$xml),
|
||||
lsp-diags:publish($file, $text, $xml)
|
||||
|
|
|
@ -19,6 +19,13 @@ declare record lsp-diags:nostic(
|
|||
message as xs:string
|
||||
);
|
||||
|
||||
declare variable $lsp-diags:severities:={
|
||||
'error':1,
|
||||
'hint':2,
|
||||
'info':3,
|
||||
'warning':4
|
||||
};
|
||||
|
||||
declare function lsp-diags:publish(
|
||||
$uri as xs:string,
|
||||
$text as xs:string,
|
||||
|
@ -42,9 +49,11 @@ as map(*)*{
|
|||
|
||||
lsp-diags:nostic(pos:Range(pos:toPosition($text=>trace("EXML "), $xml/@b),
|
||||
pos:toPosition($text, $xml/@e)),
|
||||
1,$xml/string())=>trace("EEEE "),
|
||||
1,
|
||||
$xml/string()),
|
||||
|
||||
lsp-diags:nostic(pos:Range(pos:toPosition($text=>trace("EXML "), $xml/@e +1 ),
|
||||
lsp-diags:nostic(pos:Range(pos:toPosition($text, $xml/@e +1 ),
|
||||
pos:toPosition($text, string-length($text)-1)),
|
||||
1,"Previous parse error")
|
||||
2,
|
||||
"Previous parse error")
|
||||
};
|
Loading…
Add table
Reference in a new issue