示例#1
0
 public override void ComputeLastPos(RegexpBuilder bld)
 {
     Left.ComputeLastPos(bld);
     Right.ComputeLastPos(bld);
     LastPos = (BitArray)Left.FirstPos.Clone();
     LastPos.Or(Right.LastPos);
 }
示例#2
0
 public override void ComputeFollowPos(RegexpBuilder b)
 {
     Left.ComputeFollowPos(b);
     Right.ComputeFollowPos(b);
     FollowPos = (BitArray)Left.FollowPos.Clone();
     FollowPos.Or(Right.FollowPos);
 }
示例#3
0
 public override void ComputeFirstPos(RegexpBuilder bld)
 {
     Left.ComputeFirstPos(bld);
     Right.ComputeFirstPos(bld);
     FirstPos = (BitArray)Left.FirstPos.Clone();
     if (Left.Nullable)
     {
         FirstPos.Or(Right.FirstPos);
     }
 }
示例#4
0
 public override void ComputeLastPos(RegexpBuilder bld)
 {
     Left.ComputeLastPos(bld);
     Right.ComputeLastPos(bld);
     LastPos = (BitArray)Right.LastPos.Clone();
     if (Right.Nullable)
     {
         LastPos.Or(Left.LastPos);
     }
 }
示例#5
0
 protected void DumpCore(StringBuilder sb)
 {
     sb.AppendFormat(
         "\tnull   {3}\r\n" +
         "\tfirst  {0}\r\n" +
         "\tlast   {1}\r\n" +
         "\tfollow {2}\r\n",
         RegexpBuilder.DumpSet(FirstPos),
         RegexpBuilder.DumpSet(LastPos),
         RegexpBuilder.DumpSet(FollowPos),
         Nullable);
 }
示例#6
0
            public override void ComputeFollowPos(RegexpBuilder bld)
            {
                node.ComputeFollowPos(bld);
                FollowPos = node.FollowPos;
                for (int i = 0; i != LastPos.Length; ++i)
                {
                    if (!LastPos[i])
                    {
                        continue;
                    }

                    ByteNode ii = (ByteNode)bld.positions[i];
                    ii.FollowPos.Or(FirstPos);
                }
            }
示例#7
0
            public override void ComputeFollowPos(RegexpBuilder bld)
            {
                Left.ComputeFollowPos(bld);
                Right.ComputeFollowPos(bld);
                FollowPos = new BitArray(0);
                for (int i = 0; i != Left.LastPos.Length; ++i)
                {
                    if (!Left.LastPos.Get(i))
                    {
                        continue;
                    }

                    ByteNode ii = (ByteNode)bld.positions[i];
                    ii.FollowPos.Or(Right.FirstPos);
                }
            }
示例#8
0
            public override string ToString()
            {
                StringBuilder sb = new StringBuilder();

                sb.AppendFormat("s{0} posn {1}", Index, RegexpBuilder.DumpSet(Positions));
                if (Accepts)
                {
                    sb.Append(" (acc)");
                }
                sb.Append(" next:");
                for (int i = 0; i != NextState.Length; ++i)
                {
                    if (NextState[i] != null)
                    {
                        sb.AppendFormat(" {0:X2}->s{1}", i, NextState[i].Index);
                    }
                }
                return(sb.ToString());
            }
示例#9
0
 public abstract void ComputeLastPos(RegexpBuilder bld);
示例#10
0
			public override void ComputeLastPos(RegexpBuilder bld)
			{
				LastPos = new BitArray(bld.positions.Count);
				LastPos.Set(Position, true);
			}
示例#11
0
			public abstract void ComputeFollowPos(RegexpBuilder bld);
示例#12
0
			public override void ComputeFollowPos(RegexpBuilder b)
			{
				FollowPos = new BitArray(b.positions.Count);
			}
示例#13
0
 public override void ComputeLastPos(RegexpBuilder bld)
 {
     node.ComputeLastPos(bld);
     LastPos = (BitArray)node.LastPos.Clone();
 }
示例#14
0
 public override void ComputeFollowPos(RegexpBuilder b)
 {
     FollowPos = new BitArray(b.positions.Count);
 }
示例#15
0
			public override void ComputeLastPos(RegexpBuilder bld)
			{
				Left.ComputeLastPos(bld);
				Right.ComputeLastPos(bld);
				LastPos = (BitArray)Left.FirstPos.Clone();
				LastPos.Or(Right.LastPos);
			}
示例#16
0
			public override void ComputeFollowPos(RegexpBuilder b)
			{
				Left.ComputeFollowPos(b);
				Right.ComputeFollowPos(b);
				FollowPos = (BitArray)Left.FollowPos.Clone();
				FollowPos.Or(Right.FollowPos);
			}
示例#17
0
 public override void ComputeLastPos(RegexpBuilder bld)
 {
     LastPos = new BitArray(bld.positions.Count);
     LastPos.Set(Position, true);
 }
示例#18
0
			public abstract void ComputeLastPos(RegexpBuilder bld);
示例#19
0
 public abstract void ComputeFollowPos(RegexpBuilder bld);
示例#20
0
			public override void ComputeLastPos(RegexpBuilder bld)
			{
				node.ComputeLastPos(bld);
				LastPos = (BitArray) node.LastPos.Clone();
			}
示例#21
0
			public override void ComputeFollowPos(RegexpBuilder bld)
			{
				Left.ComputeFollowPos(bld);
				Right.ComputeFollowPos(bld);
				FollowPos = new BitArray(0);
				for (int i = 0; i != Left.LastPos.Length; ++i)
				{
					if (!Left.LastPos.Get(i))
						continue;
					
					ByteNode ii = (ByteNode) bld.positions[i];
					ii.FollowPos.Or(Right.FirstPos);
				}		
			}
示例#22
0
			public override void ComputeLastPos(RegexpBuilder bld)
			{
				Left.ComputeLastPos(bld);
				Right.ComputeLastPos(bld);
				LastPos = (BitArray) Right.LastPos.Clone();
				if (Right.Nullable)
				{
					LastPos.Or(Left.LastPos);
				}
			}
示例#23
0
			public override void ComputeFirstPos(RegexpBuilder bld)
			{
				Left.ComputeFirstPos(bld);
				Right.ComputeFirstPos(bld);
				FirstPos = (BitArray) Left.FirstPos.Clone();
				if (Left.Nullable)
				{
					FirstPos.Or(Right.FirstPos);
				}
			}
示例#24
0
			public override void ComputeFollowPos(RegexpBuilder bld)
			{
				node.ComputeFollowPos(bld);
				FollowPos = node.FollowPos;
				for (int i = 0; i != LastPos.Length; ++i)
				{
					if (!LastPos[i])
						continue;
					
					ByteNode ii = (ByteNode) bld.positions[i];
					ii.FollowPos.Or(FirstPos);
				}	
			}
示例#25
0
        public static Regexp Compile(string s)
        {
            RegexpBuilder b = new RegexpBuilder(s);

            return(b.Build());
        }
示例#26
0
		/// <summary>
		/// Compiles a scanner corresponding to the regular expression.
		/// </summary>
		/// <param name="s"></param>
		/// <returns>A scanner ready to use</returns>
		public static Regexp Compile(string s)
		{
			RegexpBuilder b = new RegexpBuilder(s);
			return b.Build();
		}