Chain.parse constructor

Chain.parse(String chain)

Parses a string representation of a stack chain.

If chain is the output of a call to Chain.toString, it will be parsed as a full stack chain. Otherwise, it will be parsed as in Trace.parse and returned as a single-trace chain.

Implementation

factory Chain.parse(String chain) {
  if (chain.isEmpty) return new Chain([]);
  if (chain.contains(vmChainGap)) {
    return new Chain(
        chain.split(vmChainGap).map((trace) => new Trace.parseVM(trace)));
  }
  if (!chain.contains(chainGap)) return new Chain([new Trace.parse(chain)]);

  return new Chain(
      chain.split(chainGap).map((trace) => new Trace.parseFriendly(trace)));
}