libara 0.1.0
libara: ^0.1.0 copied to clipboard
Attributed Range Algebra: overlapping markup as ranges over a persistent, editable sequence, with constructors, queries, layered documents, and JSON.
0.1.0 #
First release.
- Sequences:
Sequence,Items, andTextover Unicode code points, with the Core Range Algebra operations, andResultfor every operation that can fail. Slices hold unmodifiable copies. - Ranges:
Range,Ranges, the predicates, ordering, and containment structure, withRanges.childrenanswering from a hierarchy indexed once;ARangewith scalar attribute values. - Constructors:
regex,union,concat, andlayer. - Documents:
Document, a persistent sequence whose marked ranges move with every edit, with endpoint gravity,Insert,Delete,Replace,Mark,Unmark, andUpdatecommands,transact, coalesced edits,resolve,at,overlapping,within,crossing,map,markers, andcompact.editsgives the commands that turn one sequence into another, from a shortest edit script. - Formats: the
Formatinterface;JSONFormatto and from JSON, with optional history,restorereturning the loaded markers, andLimitsbounding what a decode may allocate; andtext, the item format for code points. - Layered documents:
Layered, layers 1 to n of ranges over ranges, each a persistentDocument, with a caller'sGrammarderiving them. Text edits derive the layers again over the affected region, reporting what does not parse as diagnostics; structural edits are carried out through the grammar'sDerivation;applyandtransactreturn aChange; andslice,within,crossing,span, andextentread one region.LayeredFormatreads and writes a layered document as its text. An XML grammar inexample/xml/shows one at work. - Selectors:
Selector, CSS-like queries over attributed ranges, with type, attribute, and structural selectors, the four combinators,:not,:is,:has,:overlaps, and:crosses, over any list of keyed ranges, aDocument, or one layer of aLayered. AScopeindexes its ranges once for many selections, andLayered.acrossprojects several layers' ranges to base positions so one selector relates them. - Replicas:
Replica, peer-to-peer replication of aDocumentwith no server. Eachcommitis anOperationstamped by a hybrid logical clock and naming its parents;receivemerges operations from any replica in any causal order, and replicas holding the same operations hold equal documents. Concurrent insertions do not interleave, updates are last writer wins by stamp, an unmark wins over a concurrent update, and stamps too far ahead of the local clock wait.sincegives what a peer lacks,Keynames a range on every replica, andOperationFormatcarries operations as JSON. - Coordinates:
Coordinatesconverts code-point positions to UTF-16 offsets (Unit) and to lines and columns (Place), columns in UTF-16 units, code points, or grapheme clusters, inO(log n)over anyDocument<int>version. Throughpackage:charactersit also finds grapheme cluster boundaries, counts clusters, and snaps ranges to them, andsnappedmakes a constructor's ranges whole clusters.