MatchImpl

Result of the match.

Constructors

this
this(Input source, size_t consumed, Ts values, string filename, size_t line)

Match succeeded. Calls supply.

this
this(Take!Input matched, Data data, Ts values, string filename, size_t line)

Match succeeded, but pass the data directly instead of calling supply. Useful for altering existing matches.

Alias This

base

Members

Aliases

BaseMatch
alias BaseMatch = MatchImpl!(Input, supply)
Undocumented in source.
Capture
alias Capture = Ts

Types of the captured values.

Data
alias Data = MatchData!(Input, supply)
Undocumented in source.
Match
alias Match = typeof(this)
Undocumented in source.
ParserException
alias ParserException = ParserExceptionImpl!(Input, supply)
Undocumented in source.

Functions

base
inout(BaseMatch) base()

Get the base match struct, without capture data.

captureFrom
void captureFrom(Ts values)

Assign a slice of the capture output.

consumed
size_t consumed()

Number of source elements consumed.

opCast
bool opCast()

Check if the match succeeded.

toString
toString()
Undocumented in source. Be warned that the author may not have intended to support it.
tryData
inout(Data) tryData()

Get the data of the match. Throws ParserException if the match has failed.

Static functions

fail
Match fail(Input source, string error, Data data)

Match failed.

ok
ok(Input source, size_t consumed, Ts values)
Undocumented in source. Be warned that the author may not have intended to support it.
ok
ok(Take!Input matched, Data data, Ts values)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

capture
Ts capture;

Additional data added by a specific matcher function.

data
Data data;

Result of the supply function.

error
string error;

If **not null**, the match failed with this message. Empty, but non-null, strings also count as successful matches. Use the Match directly as a boolean to see.

matched
Take!Input matched;

Source matched by the result. In case of failure, this is an empty range, but matched.source can still be used, and will contain the source range starting at the point of the match start.

Parameters

Input

Input range used by the parser.

supply

Function supplying user data such as tokens.

Ts

Optional types for additional values to hold within the match, used to add result data specific to a matcher. If provided, the match can be implicitly casted to the original match type.

Meta