예제 #1
0
        FsmFragment IExprVisitor <FsmFragment> .VisitCharClass(CharClassExpr charClassExpr)
        {
            var from = _fsm.CreateState();
            var to   = _fsm.CreateState();

            FsmTransitionCondition condition = new FsmTransitionCondition(null, charClassExpr.ClassTest, null, false);

            _fsm.CreateTransition(from, to, condition);

            return(new FsmFragment(from, to));
        }
예제 #2
0
        FsmFragment IExprVisitor <FsmFragment> .VisitChars(CharsExpr charsExpr)
        {
            var from = _fsm.CreateState();
            var to   = from;

            foreach (var ch in charsExpr.Chars)
            {
                var last = _fsm.CreateState();
                FsmTransitionCondition condition = new FsmTransitionCondition(ch, null, null, false);
                _fsm.CreateTransition(to, last, condition);
                to = last;
            }

            return(new FsmFragment(from, to));
        }