public Robot Parse(IEnumerator <string> enumerator) { var position = _positionParser.Parse(enumerator.Current); enumerator.MoveNext(); var route = _routeParser.Parse(enumerator.Current); return(Robot.From(position, route)); }
public IReadOnlyList <PathMatcher> Parse(string path) { IReadOnlyList <PathMatcher> pathMatchers; if (!RouteParsingCache.TryGetValue(path, out pathMatchers)) { RouteParsingCache[path] = pathMatchers = _innerParser.Parse(path); } return(pathMatchers); }
/// <summary> /// Gives the route a chance to inialize itself. This method is called when the route is registered /// in a route collection. It should be used for any pre-compilation, caching or validation tasks. /// </summary> public void Validate() { if (parsedRoute == null) { parsedRoute = parser.Parse(this, pathSpecification, defaults, constraints); var result = validator.Validate(parsedRoute); if (!result.Success) { throw new InvalidRouteException( this, result, string.Format("The route with specification '{0}' is invalid: {1}", pathSpecification, string.Join("", result.Errors.Select(x => Environment.NewLine + " - " + x).ToArray())) ); } } }
protected override void Because() { _exception = Catch.Exception(() => _route = _routeParser.Parse(_routeText)); }
public static void Add(this RouteCollection routes, FalcorMethod method, string path, RouteHandler handler) => Add(routes, method, RouteParser.Parse(path), handler);