public override Graphken CreateGraphken() { Graphken inner = Inner.CreateGraphken(); Graphken wrap = inner.Wrap(); wrap.EndNode.AddEpsilonTo(wrap.StartNode); return(wrap); }
public override Graphken CreateGraphken() { Graphken inner = Inner.CreateGraphken(); inner.EndNode.AddEpsilonTo(inner.StartNode); Graphken loop = new Graphken(inner.StartNode, inner.StartNode); Graphken wrap = loop.Wrap(); return(wrap); }
public override Graphken CreateGraphken() { Graphken result = Elements.First().CreateGraphken().Wrap(); foreach (var e in Elements.Skip(1)) { Graphken w = e.CreateGraphken(); result.StartNode.AddEpsilonTo(w.StartNode); w.EndNode.AddEpsilonTo(result.EndNode); } return(result); }
protected PathRegex([NotNull] string definition, [NotNull] Dictionary <string, TItemMatch> definedItemMatches, [NotNull] Dictionary <string, TDependencyMatch> definedDependencyMatches, bool ignoreCase) { _definedItemMatches = definedItemMatches; _definedDependencyMatches = definedDependencyMatches; _ignoreCase = ignoreCase; int pos = 0; _definition = definition; PathRegexElement regex = ParseItemAlternatives(ref pos, startsWithItem: true); _graph = regex.CreateGraphken(); _graph.EndNode.IsEnd = true; }
public override Graphken CreateGraphken() { if (Elements.Any()) { Graphken init = Elements.First().CreateGraphken(); Graphken previous = init; foreach (var e in Elements.Skip(1)) { Graphken g = e.CreateGraphken(); previous.EndNode.AddEpsilonTo(g.StartNode); previous = g; } return(new Graphken(init.StartNode, previous.EndNode)); } else { Node startNode = StartsWithItem ? (Node) new NodeBeforeItemMatch("<>") : new NodeBeforeDependencyMatch("<>"); Node endNode = startNode.CreateNodeOfSameKind(); startNode.AddEpsilonTo(endNode); return(new Graphken(startNode, endNode)); } }