on 492ae2f help sign in
44 lines 708 B history raw
1### `++rash`
3Parse or crash
5Parse a cord with a given `++rule` and crash if the `++cord` isn't entirely
6parsed.
8Accepts
9-------
11`naf` is an atom.
13`sab` is a `++rule`.
15Produces
16--------
18The value of the parse result, or crash.
20Source
21------
23 ++ rash |*({naf/@ sab/rule} (scan (trip naf) sab)) ::
26Examples
27--------
29 ~zod/try=> (rash 'I was the world in which I walked, and what I saw' (star (shim 0 200)))
30 "I was the world in which I walked, and what I saw"
31 ~zod/try=> (rash 'abc' (just 'a'))
32 ! {1 2}
33 ! 'syntax-error'
34 ! exit
35 ~zod/try=> (rash 'abc' (jest 'abc'))
36 'abc'
37 `~zod/try=> (rash 'abc' (jest 'ab'))
38 ! {1 3}
39 ! 'syntax-error'
40 ! exit
44***