keen/parse
Sourcegrammar[t] interfaceinner-parse-error record case~~[t, u] (t, u) grammar(a t grammar, b u grammar) t data, u dataExpects to parse
a followed by b. By default this does not allow spaces in between. For that, use a ~~ spaces ~~ b./[t] t grammar(a t grammar, b t grammar) t dataTries to parse with
a, and if that fails, tries to parse with b instead.transform[output, input] output grammar(a input grammar, f output data(input)) output data, input dataUses a function to transform the result if parsing is successful.
optional[t] t option grammar(a t grammar) t dataAllows parsing to fail, returning an empty option if it does.
many[t] t[] grammar(a t grammar) t dataParses the same grammar as many times as possible (including 0 times).
one-or-more[t] t[] grammar(a t grammar) t dataParses
a at least once, then as many times as possible.separated-by[t] t[] grammar(a t grammar, separator string) t dataParses a as many times as possible, with 'separator' in between.
This does not allow a trailing separator; it is a parse error to have a separator not followed by another a. This does allow to parse nothing, returning an empty array.
parse-erroron failure.