Example #1
0
		/// <summary>
		/// 添加一个到特定状态的转移。
		/// </summary>
		/// <param name="state">要转移到的状态。</param>
		/// <param name="charClass">转移的字符类。</param>
		public void Add(NfaState state, string charClass)
		{
			if (!RegexCharClass.IsEmpty(charClass))
			{
				charClassTransition = Nfa.GetCharClass(charClass);
				CharClassTarget = state;
			}
		}
Example #2
0
		/// <summary>
		/// 根据当前的正则表达式构造 NFA。
		/// </summary>
		/// <param name="nfa">要构造的 NFA。</param>
		internal override void BuildNfa(Nfa nfa)
		{
			innerExp.BuildNfa(nfa);
			if (TrailingExpression != null)
			{
				NfaState head = nfa.HeadState;
				TrailingHeadState = nfa.TailState;
				TrailingExpression.BuildNfa(nfa);
				TrailingHeadState.Add(nfa.HeadState);
				nfa.HeadState = head;
				TrailingHeadState.StateType = NfaStateType.TrailingHead;
				nfa.TailState.StateType = NfaStateType.Trailing;
			}
		}
Example #3
0
 /// <summary>
 /// 添加一个到特定状态的转移。
 /// </summary>
 /// <param name="state">要转移到的状态。</param>
 /// <param name="ch">转移的字符。</param>
 public void Add(NfaState state, char ch)
 {
     charClassTransition = Nfa.GetCharClass(ch);
     CharClassTarget     = state;
 }
Example #4
0
 /// <summary>
 /// 使用指定的源状态初始化 <see cref="NfaState.DebugView"/> 类的实例。
 /// </summary>
 /// <param name="sourceCollection">使用调试视图的源状态。</param>
 public DebugView(NfaState sourceCollection)
 {
     this.source = sourceCollection;
 }
Example #5
0
 /// <summary>
 /// 添加一个到特定状态的 ϵ 转移。
 /// </summary>
 /// <param name="state">要转移到的状态。</param>
 public void Add(NfaState state)
 {
     EpsilonTransitions.Add(state);
 }
Example #6
0
		/// <summary>
		/// 添加一个到特定状态的 ϵ 转移。
		/// </summary>
		/// <param name="state">要转移到的状态。</param>
		public void Add(NfaState state)
		{
			EpsilonTransitions.Add(state);
		}
Example #7
0
		/// <summary>
		/// 添加一个到特定状态的转移。
		/// </summary>
		/// <param name="state">要转移到的状态。</param>
		/// <param name="ch">转移的字符。</param>
		public void Add(NfaState state, char ch)
		{
			charClassTransition = Nfa.GetCharClass(ch);
			CharClassTarget = state;
		}
Example #8
0
			/// <summary>
			/// 使用指定的源状态初始化 <see cref="NfaState.DebugView"/> 类的实例。
			/// </summary>
			/// <param name="sourceCollection">使用调试视图的源状态。</param>
			public DebugView(NfaState sourceCollection)
			{
				this.source = sourceCollection;
			}