findPathTo method

ParserPath? findPathTo(
  1. Parser source,
  2. Parser target
)

Returns the shortest path from source to target, if any.

Implementation

ParserPath? findPathTo(Parser source, Parser target) {
  assert(parsers.contains(source), 'source is not part of the analyzer');
  assert(parsers.contains(target), 'target is not part of the analyzer');
  return breadthFirstSearchTarget(source, (each) => each == target);
}