seq method
Returns a parser that accepts the receiver followed by other
. The
resulting parser returns a list of the parse result of the receiver
followed by the parse result of other
. Calling this method on an
existing sequence code does not nest this sequence into a new one, but
instead augments the existing sequence with other
.
For example, the parser letter().seq(digit()).seq(letter())
accepts a
letter followed by a digit and another letter. The parse result of the
input string 'a1b'
is the list <dynamic>['a', '1', 'b']
.
Implementation
@useResult
Parser<List<dynamic>> seq(Parser other) => switch (this) {
SequenceParser(children: final children) =>
[...children, other].toSequenceParser(),
_ => [this, other].toSequenceParser()
};