コード例 #1
0
 public ScannerNonWord(DelimClassification InDelimClass, char InNonWordChar)
 {
     mDelimClass  = InDelimClass;
     mValue       = null;
     mNextLookup  = null;
     mNonWordChar = InNonWordChar;
 }
コード例 #2
0
 public ScanNonWordxResults(
     TextTraits InTextTraits, ScannerNonWord InNonWord, ScanCharResults InCharResults)
 {
     mTextTraits  = InTextTraits;
     mNonWord     = InNonWord;
     mCharResults = InCharResults;
 }
コード例 #3
0
 public ScannerNonWord(DelimClassification InDelimClass, string InValue)
 {
     mDelimClass  = InDelimClass;
     mValue       = InValue;
     mNextLookup  = null;
     mNonWordChar = '\0';
 }
コード例 #4
0
 public ScannerNonWord()
 {
     mDelimClass  = DelimClassification.None;
     mValue       = null;
     mNextLookup  = null;
     mNonWordChar = '\0';
 }
コード例 #5
0
        /// <summary>
        /// Append to end of lookup chain where the leading character is the same
        /// for all the delim strings in the chain.
        /// </summary>
        /// <param name="InNextLookup"></param>
        /// <returns></returns>
        public ScannerNonWord AppendNextLookup(ScannerNonWord InNextLookup)
        {
            ScannerNonWord addedTo = null;

            // skip the append if nonword string or char already exists in the lookup
            // chain.
            if ((InNextLookup.IsNonWordChar == true) &&
                (this.IsNonWordChar == true))
            {
                addedTo = null;
            }

            else if ((InNextLookup.IsNonWordString == true) &&
                     (this.IsNonWordString == true) &&
                     (InNextLookup.NonWordString == this.NonWordString))
            {
                addedTo = null;
            }

            // this item is the end of the chain.
            else if (mNextLookup == null)
            {
                mNextLookup = InNextLookup;
                addedTo     = this;
            }

            // step down the chain of nonword string/char with the same leading char.
            else
            {
                addedTo = mNextLookup.AppendNextLookup(InNextLookup);
            }

            return(addedTo);
        }
コード例 #6
0
 public void Apply(ScannerNonWord InNonWord)
 {
     if (InNonWord.IsNonWordChar == true)
     {
         mNonWordChar   = InNonWord.NonWordChar;
         mNonWordString = null;
     }
     else
     {
         mNonWordChar   = null;
         mNonWordString = InNonWord.NonWordString;
     }
     mDelimClass = InNonWord.DelimClass;
 }
コード例 #7
0
        /// <summary>
        /// Return the ScannerNonWord which fully matches the non word pattern
        /// located at pos InIx in the string being searched. When the pattern is a
        /// single char, then this NonWord object is the matching object. When the
        /// pattern is a string, have to check each non word string as the pattern in
        /// the string.
        /// </summary>
        /// <param name="InStart"></param>
        /// <param name="InBoundedString"></param>
        /// <param name="InIx"></param>
        /// <returns></returns>
        public static ScannerNonWord FindInLookupChain(
            ScannerNonWord InStart, Scanner.ScanBoundedString InBoundedString, int InIx)
        {
            ScannerNonWord snw             = InStart;
            ScannerNonWord found           = null;
            ScannerNonWord foundSingleChar = null;

            // use the single linked list chaining structure of ScannerNonWord to
            // compare each nonword string to the char sequence in the scanned string.
            while (snw != null)
            {
                // this ScannerNonWord consists of a single char. there is no string of chars
                // that the char is the leading char of.
                // ( When the single char word is found have to continue looking. Rule is that
                //   matching delim strings take precedence over matching single char. )
                if (snw.IsNonWordChar == true)
                {
                    foundSingleChar = snw;
                }

                else if (snw.IsEqual(InBoundedString, InIx) == true)
                {
                    found = snw;
                    break;
                }

                snw = snw.NextLookup;
            }

            if (found != null)
            {
                return(found);
            }
            else
            {
                return(foundSingleChar);
            }
        }
コード例 #8
0
 public ScanNonWordxResults(TextTraits InTextTraits)
 {
     mTextTraits  = InTextTraits;
     mNonWord     = null;
     mCharResults = new ScanCharResults();
 }