- reduceLeft<TToken, TOptions, TAcc, TValue>(acc: TAcc, p: Parser<TToken, TOptions, TValue>, reducer: ((acc: TAcc, v: TValue, data: Data<TToken, TOptions>, i: number, j: number) => TAcc)): Matcher<TToken, TOptions, TAcc>
-
Type Parameters
-
TToken
-
TOptions
-
TAcc
-
TValue
Parameters
-
acc: TAcc
-
p: Parser<TToken, TOptions, TValue>
-
reducer: ((acc: TAcc, v: TValue, data: Data<TToken, TOptions>, i: number, j: number) => TAcc)
-
- (acc: TAcc, v: TValue, data: Data<TToken, TOptions>, i: number, j: number): TAcc
-
Parameters
-
acc: TAcc
-
v: TValue
-
data: Data<TToken, TOptions>
-
i: number
-
j: number
Returns TAcc
Returns Matcher<TToken, TOptions, TAcc>
Make a Matcher that takes 0 or more matches from the same parser and reduces them into one value in left-to-right (first-to-last) order.
Note: accumulator is the left (first) argument.
Use leftAssoc1 if you have an initial value to be parsed first.
Implementation is based on chainReduce and map.