many
Accepts a single parser, which may match zero or infinite times.
Available since: v1.0.0-alpha.1
Type declaration
const many: (parser: Parser, name?: string) => Parser;
Example
In this example we are going to parse the string "Hello"
as many times as possible.
import { many, string } from "rudus";
const parser = many(string("Hello"));
const result = parser.run("HelloHelloHello");
The result
of the parser above will be:
{ "input": "HelloHelloHello", "isError": false, "offset": 15, "result": ["Hello", "Hello", "Hello"]}