Skip to main content

many1

Accepts a single parser, which must match at least once or infinite times otherwise it fails.

info

Available since: v1.0.0-alpha.1

Type declaration

const many1: (parser: Parser) => Parser;

Example

In this example we are going to parse the string "Hello" as many times as possible.

import { many1, string } from "rudus";

const parser = many1(string("Hello"));

const result = parser.run("");

The result of the parser above will be:

{
"input": "",
"isError": true,
"offset": 0,
"result": null,
"errorMessage": "many1: Failed to match at least once at offset 0"
}