示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public RegExpAutoCompleteInfo GetAutoCompleteInfo()
 {
     if (this._autoCompleteInfo == null)
     {
         DfaAutoCompleteType none;
         GetAutoCompleteInfoTransitionsProcessingResult autoCompleteInfoTransitionsProcessing = this.GetAutoCompleteInfoTransitionsProcessing();
         if (autoCompleteInfoTransitionsProcessing._NonExactsFound)
         {
             none = DfaAutoCompleteType.None;
         }
         else if (autoCompleteInfoTransitionsProcessing._ExactCharFound)
         {
             if (!this.Contains(this._finalState))
             {
                 none = DfaAutoCompleteType.ExactChar;
             }
             else
             {
                 GetAutoCompleteInfoTransitionsProcessingResult result2 = autoCompleteInfoTransitionsProcessing;
                 RegExpDfaWave nextWave = this;
                 do
                 {
                     nextWave = nextWave.GetNextWave(result2._ExactChar);
                     result2  = nextWave.GetAutoCompleteInfoTransitionsProcessing();
                 }while ((!result2._NonExactsFound && result2._ExactCharFound) && !nextWave.Contains(this._finalState));
                 if (nextWave.Contains(this._finalState))
                 {
                     if (result2._NonExactsFound)
                     {
                         none = DfaAutoCompleteType.FinalOrExactBeforeFinalOrNone;
                     }
                     else
                     {
                         none = DfaAutoCompleteType.FinalOrExactBeforeFinal;
                     }
                 }
                 else
                 {
                     none = DfaAutoCompleteType.FinalOrExactBeforeNone;
                 }
             }
         }
         else
         {
             none = DfaAutoCompleteType.Final;
         }
         this._autoCompleteInfo = new RegExpAutoCompleteInfo(none, autoCompleteInfoTransitionsProcessing._ExactChar);
     }
     return(this._autoCompleteInfo);
 }
示例#2
0
        GetAutoCompleteInfoTransitionsProcessingResult GetAutoCompleteInfoTransitionsProcessing()
        {
            GetAutoCompleteInfoTransitionsProcessingResult result = new GetAutoCompleteInfoTransitionsProcessingResult();

            result._ExactCharFound = false;
            result._ExactChar      = '\0';
            result._NonExactsFound = false;
            foreach (RegExpState state in this)
            {
                foreach (Transition transition in state.Transitions)
                {
                    if (transition.IsEmpty)
                    {
                        continue;
                    }
                    if (transition.IsExact)
                    {
                        if (result._ExactCharFound)
                        {
                            if (result._ExactChar != transition.GetSampleChar())
                            {
                                result._NonExactsFound = true;
                            }
                        }
                        else
                        {
                            result._ExactCharFound = true;
                            result._ExactChar      = transition.GetSampleChar();
                        }
                    }
                    else
                    {
                        result._NonExactsFound = true;
                    }
                    if (result._NonExactsFound)
                    {
                        break;
                    }
                }
                if (result._NonExactsFound)
                {
                    return(result);
                }
            }
            return(result);
        }