public CallSubParserForkPredicateResult Mount(PredicateEntryBase first, PredicateEntryBase second) { First = first; Second = second; return(this); }
public ExecutionPath Mount(Node startNode, PredicateNode predicate) { PathSourceNode = startNode; Nodes[0] = predicate; Predicate = predicate.PredicateEntry; ReferenceCount.AddReference(); return(this); }
private Node ConnectEntry(Node source, Entry entry) { return(entry switch { MatchEntry matchEntry => ConnectMatch(source, matchEntry), StateEntry stateEntry => ConnectState(source, stateEntry, stateEntry.State.Inline || Automata.ForceInlineAll), QuantifierEntry quantifierEntry => ConnectQuantifier(source, quantifierEntry), PredicateEntryBase predicateEntry => ConnectPredicate(source, predicateEntry), ActionEntry actionEntry => ConnectAction(source, actionEntry), EpsilonEntry _ => source, _ => throw new ArgumentOutOfRangeException(nameof(entry)) });
public ExecutionPath(Node pathSourceNode, Node[] route, int weight, PredicateEntryBase predicate) { PathSourceNode = pathSourceNode; Nodes = route; IsInvalid = Nodes == null || Nodes.Length == 0; Output = IsInvalid ? null : Nodes[Nodes.Length - 1]; IsReturnPath = false; Predicate = predicate; LookAheadMatch = Array.Empty <MatchEntry>(); Weight = weight; CalcInfo(ref Weight, out PassLazyNode, out EnterReturnNodes, out StackEvalDelta); }
public void Release() { if (ForkPredicatePath == false) { return; } if (ReferenceCount.ReleaseReference() > 0) { return; } PathSourceNode = null; var predicateNode = (PredicateNode)Nodes[0]; (predicateNode.PredicateEntry as IDisposable)?.Dispose(); predicateNode.Release(); Nodes[0] = null; Predicate = null; _forkExecutionPathPool.Release(this); }
public PredicateNode Mount(PredicateEntryBase predicateEntry) { PredicateEntry = predicateEntry; return(this); }
public PredicateNode(Automata <TInstruction, TOperand> automata, Graph graph, PredicateEntryBase predicateEntry) : base(automata, graph) { PredicateEntry = predicateEntry; }
public Edge(Node sourceNode, Node targetNode, PredicateEntryBase predicateMatch, int weight = 0) : this(sourceNode, targetNode, weight) { PredicateMatch = predicateMatch; IsMatch = true; }
protected virtual void BuildConsumePredicateResult(ILBuilderContext ilBuilderContext, LocalBuilder resultLocal, PredicateEntryBase predicateEntryBase) { }
protected override void BuildConsumePredicateResult(ILBuilderContext ilBuilderContext, LocalBuilder resultLocal, PredicateEntryBase predicateEntryBase) { var parserEntry = ((IParserEntry)predicateEntryBase.GetActualPredicateEntry()).ParserEntryData; if (parserEntry == null || parserEntry.FlatIndex == -1) { return; } var parserTransition = parserEntry.ParserProduction; var argumentBuilder = parserTransition.Binder.Template[parserEntry.FlatIndex]; if (argumentBuilder is ParserArgumentBuilder) { BuildConsumeResult(ilBuilderContext, resultLocal, parserEntry); } if (argumentBuilder is LexerArgumentBuilder) { BuildConsumeResult(ilBuilderContext, resultLocal, parserEntry); } }