13.7 Shrubbery Input
import: rhombus/shrubbery | package: rhombus-lib |
function | |||||
| |||||
| |||||
enumeration | |||||
#'top mode reads all shrubbery forms until an end-of-file, and it produces a term, group, or multi-group sequence.
#'interactive mode reads until an end-of-line, unless nothing has been read so far, an opener remains unclosed, or a [:] was encountered that not within an open-closer sequence. If reading continues due to a :, then it stops when a blank line is found (where a line containing a comment does not count as blank), as long as stopping does not create an empty block.
#'line mode is like #'interactive mode, except that it can stop and produce an empty term sequence if a newline is found without having read anything.
#'tex mode reads until an end-of-file, but starting as if inside @{}, and the result is a […] form.
> shrubbery.read(Port.Input.open_string("fun (x):\n x + 1"))
'fun (x): x + 1'