Exemplo n.º 1
0
        /// <summary>
        /// Sequence of characters in node._str
        /// </summary>
        private Automaton <S> ConvertNodeMulti(RegexNode node)
        {
            //sequence of characters
            string sequence   = node._str;
            int    count      = sequence.Length;
            bool   ignoreCase = ((node._options & RegexOptions.IgnoreCase) != 0);

            S[] conds = new S[count];

            for (int i = 0; i < count; i++)
            {
                List <char[]> ranges = new List <char[]>();
                char          c      = sequence[i];
                ranges.Add(new char[] { c, c });
                S cond = solver.MkRangesConstraint(ignoreCase, ranges);
                //TBD: fix the following description
                if (!description.ContainsKey(cond))
                {
                    description[cond] = Rex.RexEngine.Escape(c);
                }
                conds[i] = cond;
            }

            return(automBuilder.MkSeq(conds));
        }
Exemplo n.º 2
0
            /// <summary>
            /// Convert to automaton
            /// </summary>
            public Automaton <S> ToAutomaton(RegexToAutomatonBuilder <ILikeNode, S> builder, ICharAlgebra <S> solver)
            {
                if (this.set.Length == 0)
                {
                    return(builder.MkSeq(solver.False));
                }

                var moveCond = solver.MkOr(this.set.Select(c => solver.MkCharConstraint(c)));

                moveCond = this.negate ? solver.MkNot(moveCond) : moveCond;
                return(builder.MkSeq(moveCond));
            }
Exemplo n.º 3
0
            /// <summary>
            /// Convert to automaton
            /// </summary>
            public Automaton <S> ToAutomaton(RegexToAutomatonBuilder <ILikeNode, S> builder, ICharAlgebra <S> solver)
            {
                var moveCond = solver.MkRangeConstraint(this.start, this.end);

                moveCond = this.negate ? solver.MkNot(moveCond) : moveCond;
                return(builder.MkSeq(moveCond));
            }
Exemplo n.º 4
0
 /// <summary>
 /// Convert to automaton
 /// </summary>
 public Automaton <S> ToAutomaton(RegexToAutomatonBuilder <ILikeNode, S> builder, ICharAlgebra <S> solver)
 {
     return(builder.MkSeq(solver.False));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Convert to automaton
 /// </summary>
 public Automaton <S> ToAutomaton(RegexToAutomatonBuilder <ILikeNode, S> builder, ICharAlgebra <S> solver)
 {
     return(builder.MkSeq(this.chars.Select(c => solver.MkRangeConstraint(c, c)).ToArray()));
 }