[mod] text
This commit is contained in:
parent
11d165f794
commit
d26fae56e4
2 changed files with 22 additions and 2 deletions
|
|
@ -10,6 +10,26 @@ declare record text:rec(
|
|||
line? := %method fn($line) {?lines[$line]}
|
||||
);
|
||||
|
||||
(:~ json numbers :)
|
||||
declare type text:num as (xs:integer|xs:double);
|
||||
|
||||
(:~
|
||||
@param line Line position in a document (zero-based).
|
||||
@param character Character offset on a line in a document (zero-based).
|
||||
:)
|
||||
declare record text:Position(
|
||||
line as text:num,
|
||||
character as text:num
|
||||
);
|
||||
|
||||
(:~
|
||||
@param line Line position in a document (zero-based).
|
||||
@param character Character offset on a line in a document (zero-based).
|
||||
:)
|
||||
declare record text:Range(
|
||||
start as text:Position,
|
||||
end as text:Position
|
||||
);
|
||||
declare function text:build($text as xs:string){
|
||||
let $lines:=tokenize($text, '(\r\n?|\n\r?)')
|
||||
return text:rec($lines)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue