many1 primitive
Signature
ts
function many1<T>(parser: Parser<T>): Parser<Array<T>>
Description
many1
combinator applies parser
one or more times. Returns an array of the returned values of parser
.
Usage
ts
const Parser = many1(string('+'))
Success
ts
run(Parser).with('+++')
{
isOk: true,
span: [ 0, 3 ],
pos: 3,
value: [ '+', '+', '+' ]
}
Failure
ts
run(Parser).with('---')
{
isOk: false,
span: [ 0, 1 ],
pos: 1,
expected: '+'
}