Skip to content

Latest commit

 

History

History
26 lines (15 loc) · 859 Bytes

prsc.star.md

File metadata and controls

26 lines (15 loc) · 859 Bytes

Home > prsc > star

star() function

Creates a Parser that tries to apply the given parser zero or more times in sequence. Values for successful matches are collected in an array. Once the inner parser no longer matches, success is returned at the offset reached with the accumulated values.

If the inner parser returns a fatal failure, the error is returned as-is.

Signature:

export declare function star<T>(parser: Parser<T>): Parser<T[]>;

Parameters

Parameter Type Description
parser Parser<T> Parser to apply repeatedly

Returns:

Parser<T[]>