Skip to content

Soft01<A>

extension typeSoft01<A>(Parser0<A>)

A soft Parser0 view whose combinators require a Parser on the other side, producing a Parser result.

Obtained via Soft0.with1 or With1.soft.

Constructors

Soft01()

Soft01(Parser0<A>parser)

Properties

parser final

finalParser0<A>parser

Methods

between()

Parser<A>between(Parser<dynamic>b,Parser<dynamic>c)

Matches b, then this parser (soft), then c, returning only this parser's result.

Implementation
dart
Parser<A> between(Parser<dynamic> b, Parser<dynamic> c) =>
    b.voided.product(parser.soft.product(c.voided)).map((t) => t.$2.$1);

product()

Parser<Record>product<B>(Parser<B>that)

Soft product with a Parser, returning both results.

Implementation
dart
Parser<(A, B)> product<B>(Parser<B> that) => Parsers.softProduct01(parser, that);

productL()

Parser<A>productL<B>(Parser<B>that)

Soft product keeping only this parser's result.

Implementation
dart
Parser<A> productL<B>(Parser<B> that) =>
    Parsers.softProduct01(parser, Parsers.voided(that)).map((t) => t.$1);

productR()

Parser<A>productR<B>(Parser<B>that)

Soft product keeping only that's result.

Implementation
dart
Parser<B> productR<B>(Parser<B> that) =>
    Parsers.softProduct01(Parsers.voided0(parser), that).map((t) => t.$2);

surroundedBy()

Parser<A>surroundedBy(Parser<dynamic>b)

Soft version of surroundedBy.

Implementation
dart
Parser<A> surroundedBy(Parser<dynamic> b) => between(b, b);