4g: Parsing (Outside Caller)
+rash
+rashParse or crash.
Parse a $cord with a given $rule and crash if the $cord isn't entirely parsed.
Accepts
.naf is an $atom.
.sab is a $rule.
Produces
The value of the parse result, or crash.
Source
++ rash |*([naf=@ sab=rule] (scan (trip naf) sab))Examples
> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
"I was the world in which I walked, and what I saw"> (rash 'abc' (just 'a'))
! {1 2}
! 'syntax-error'
! exit+rose
+roseParse to each.
Parse $tape .los with $rule sab, producing an (each @ud (unit *)). If .los was not fully consumed, the result is %.n and .p contains the column number before failure occurred. If .los was fully consumed, the result is %.y and .p contains either sab's result in a +unit, or a null +unit if parsing failed.
Accepts
.los is a $tape.
.sab is a $rule.
Produces
(each @ud (unit *)), where the * is whatever type the $rule produces.
Source
Examples
+rush
+rushParse or null.
Parse an $atom with a given $rule and produce null if the $cord isn't entirely parsed.
Accepts
.naf is an $atom.
.sab is a $rule.
Produces
The value of the parse result, or null.
Source
Examples
+rust
+rustParse $tape or null.
Parse a $tape with a given $rule and produce null if the $tape isn't entirely parsed.
Accepts
.los is a $tape.
.sab is a $rule.
Produces
A (unit *), where * is the type produced by .sab.
Source
Examples
+scan
+scanParse $tape or crash.
Parse a $tape with a given $rule and crash if the $tape isn't entirely parsed.
Accepts
.los is a $tape.
.sab is a $rule.
Produces
Either the type produced by your parsing rules or a crash.
Source
Examples
Last updated