Function sequence

  • Handle things like lists and records, but you can customize the details however you need. Say you want to parse C-style code blocks:

    // const statement: Parser<Stmt> =

    const block: Parser<Stmt[]> =
    sequence({
    start: "{",
    separator: ";",
    end: "}",
    spaces: spaces,
    item: statement,
    trailing: Trailing.Mandatory
    }
    )

    Note: If you need something more custom, do not be afraid to check out the implementation and customize it for your case. It is better to get nice error messages with a lower-level implementation than trying to hack high-level parsers to do things they are not made for.

    See

    Type Parameters

    • A

    Parameters

    Returns Simple.Parser<List<A>>