visitSequenceFixedResult<E> method

  1. @override
Parser visitSequenceFixedResult<E>(
  1. SequenceFixedResultExpression<E> node
)
override

Implementation

@override
Parser visitSequenceFixedResult<E>(SequenceFixedResultExpression<E> node) {
  final expressions = node.expressions;
  final parsers = <Parser>[];
  for (var i = 0; i < expressions.length; i++) {
    final child = expressions[i];
    final parser = child.accept(this);
    parsers.add(parser);
  }

  if (parsers.length == 1) {
    return FixedResultTransformerParser<E>(parsers.first, node.result,
        source: '$node');
  } else {
    return SequenceFixedResultParser<E>(parsers, node.result,
        source: '$node');
  }
}