Exemplo n.º 1
0
            public static DfaMatchingState <TSetType> TakeTransition(
                SymbolicRegexMatcher <TSetType> matcher, DfaMatchingState <TSetType> currentStates, int mintermId, TSetType minterm)
            {
                if (currentStates.Node.Kind != SymbolicRegexKind.Or)
                {
                    // Fall back to Brzozowski when the state is not a disjunction.
                    return(BrzozowskiTransition.TakeTransition(matcher, currentStates, mintermId, minterm));
                }

                SymbolicRegexBuilder <TSetType> builder = matcher._builder;

                Debug.Assert(builder._delta is not null);

                SymbolicRegexNode <TSetType> union = builder._nothing;
                uint kind = 0;

                // Produce the new list of states from the current list, considering transitions from members one at a time.
                Debug.Assert(currentStates.Node._alts is not null);
                foreach (SymbolicRegexNode <TSetType> oneState in currentStates.Node._alts)
                {
                    DfaMatchingState <TSetType> nextStates = builder.MkState(oneState, currentStates.PrevCharKind);

                    int offset = (nextStates.Id << builder._mintermsCount) | mintermId;
                    DfaMatchingState <TSetType> p = Volatile.Read(ref builder._delta[offset]) ?? matcher.CreateNewTransition(nextStates, minterm, offset);

                    // Observe that if p.Node is an Or it will be flattened.
                    union = builder.MkOr2(union, p.Node);

                    // kind is just the kind of the partition.
                    kind = p.PrevCharKind;
                }

                return(builder.MkState(union, kind, true));
            }
Exemplo n.º 2
0
            public static DfaMatchingState <TSetType> TakeTransition(
                SymbolicRegexMatcher <TSetType> matcher, DfaMatchingState <TSetType> currentState, int mintermId, TSetType minterm)
            {
                SymbolicRegexBuilder <TSetType> builder = matcher._builder;

                Debug.Assert(builder._delta is not null);

                int offset = (currentState.Id << builder._mintermsCount) | mintermId;

                return(Volatile.Read(ref builder._delta[offset]) ?? matcher.CreateNewTransition(currentState, minterm, offset));
            }