compile method

Parser<RouteResult> compile ()

Implementation

Parser<RouteResult> compile() {
  Parser<RouteResult> out;

  for (int i = 0; i < segments.length; i++) {
    var s = segments[i];
    bool isLast = i == segments.length - 1;
    if (out == null) {
      out = s.compile(isLast);
    } else {
      out = s.compileNext(
          out.then(match('/')).index(0).cast<RouteResult>(), isLast);
    }
  }

  return out;
}