Exemplo n.º 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));
        }
Exemplo n.º 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));
        }