示例#1
0
        public Node AddToken(RegularExpressionToken token)
        {
            var newEnd = CreateNewNode();

            End.AddAdjacent(newEnd, token);
            End = newEnd;

            return(End);
        }
示例#2
0
        public IGraph AddSequence(IGraph sequenceGraph)
        {
            if (sequenceGraph == null)
            {
                return(this);
            }
            End.AddAdjacent(sequenceGraph.Root, RegularExpressionToken.Blank);
            End = sequenceGraph.End;

            return(this);
        }
示例#3
0
        public void RepeatPlus()
        {
            var newRoot = CreateNewNode();

            newRoot.AddAdjacent(Root, RegularExpressionToken.Blank);
            End.AddAdjacent(Root, RegularExpressionToken.Blank, true);
            Root = newRoot;

            var newEnd = CreateNewNode();

            End.AddAdjacent(newEnd, RegularExpressionToken.Blank);

            End = newEnd;
        }
示例#4
0
        public IGraph AddChoice(IGraph concatGraph)
        {
            var newRoot = CreateNewNode();

            newRoot.AddAdjacent(Root, RegularExpressionToken.Blank);
            newRoot.AddAdjacent(concatGraph.Root, RegularExpressionToken.Blank);
            Root = newRoot;

            var newEnd = CreateNewNode();

            End.AddAdjacent(newEnd, RegularExpressionToken.Blank);
            concatGraph.End.AddAdjacent(newEnd, RegularExpressionToken.Blank);

            End = newEnd;

            return(this);
        }