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)); }
ParsingState IExprVisitor <ParsingState> .VisitChars(CharsExpr charsExpr) { int startPos = _currState.Pos; if (_currState.Pos + charsExpr.Chars.Length > _currState.Text.Length) { return(_currState.ExitChild(false)); } int j = _currState.Pos; for (int i = 0; i < charsExpr.Chars.Length; i++) { if (_currState.Text[j] != charsExpr.Chars[i]) { return(_currState.ExitChild(false)); } ++j; } return(_currState.ExitChild(true, j - startPos)); }