2023-04-05

(sph lang indent-syntax)

converting to and from strings with indented lines

part of sph-lib

module name

(sph lang indent-syntax)

exported bindings

procedure: denoted-tree->indent-tree a [base-depth indent-string] ->
((integer:indent . string:line-content) ...) [integer string] -> string
procedure: denoted-tree->indent-tree-lines a [base-depth indent-string] ->
procedure: indent-tree->denoted-tree a [indent-width] ->
procedure: indent-tree->prefix-tree a [indent-width] ->
procedure: indent-tree->range-delimited-tree a indent-char indent-width start-delimiter end-delimiter ->
string char/char-set/procedure integer string string -> string
convert from indent syntax to one where nesting is specified by a pair of strings
for start and end of a range
procedure: line->indent-and-content a indent-width ->
string integer -> (integer string)
procedure: prefix-tree->indent-tree a [base-depth indent-string] ->
list:(string/list ...) -> string
converts a list to a string of indented lines with indent corresponding to nesting depth
procedure: prefix-tree-text source ->
(string/list ...) -> string
convert a list with strings and eventually sub-lists with strings to an indented document structure.
normalise indent from multiline string literals
procedure: read-indent-tree->denoted-tree port [indent-width] ->
procedure: read-indent-tree->prefix-tree a ... ->
same arguments as read-indent-tree ->
denoted-tree
procedure: read-indent-tree-element->denoted-tree port [indent-width] ->
port [integer] -> list
assumes that unread-string works on the port
procedure: string->indent-depth a indent-width ->
string integer -> integer