예제 #1
0
 public void AddDistinct(ScanPatterns Patterns)
 {
     foreach (var pat in Patterns)
     {
         AddDistinct(pat);
     }
 }
예제 #2
0
        public static ScanPatterns operator +(ScanPatterns InValue1, ScanPatterns InValue2)
        {
            ScanPatterns rv = new ScanPatterns(InValue1);

            rv.AddDistinct(InValue2);
            return(rv);
        }
예제 #3
0
 public void Add(ScanPatterns Patterns)
 {
     foreach (var pattern in Patterns)
     {
         this.Add(pattern);
     }
 }
예제 #4
0
 public void Add(ScanPatterns Patterns)
 {
     foreach (var pattern in Patterns)
     {
         this.Add(pattern.Duplicate( ));
     }
 }
예제 #5
0
 public void Add(ScanPatterns InPatterns, DelimClassification InDelimClass)
 {
     foreach (ScanPattern pat in InPatterns)
     {
         base.Add(pat.PatternValue);
         mWip.Add(InDelimClass);
     }
 }
예제 #6
0
 public KeywordPattern(KeywordPattern Pattern)
     : base(Pattern)
 {
     this.CompareCase        = Pattern.CompareCase;
     this.ReplacementValue   = Pattern.ReplacementValue;
     this.WhitespacePatterns = Pattern.WhitespacePatterns;
     this.UserCode           = Pattern.UserCode;
 }
예제 #7
0
 public void AddDistinct(ScanPatterns Patterns)
 {
     foreach (var pat in Patterns)
     {
         Add(pat.Duplicate());
         continue;
     }
 }
예제 #8
0
        /// <summary>
        /// Match a location in the input text string to a whitespace separated keyword
        /// pattern.
        /// </summary>
        /// <param name="Text"></param>
        /// <param name="Ix"></param>
        /// <param name="WhitespacePatterns"></param>
        /// <returns></returns>
        private Tuple <bool, int> EqualsWhitespaceSeparatedParts(
            string Text, int Ix,
            ScanPatterns WhitespacePatterns)
        {
            bool doesMatch   = false;
            int  ix          = Ix;
            int  nbrParts    = this._PatternValueParts.Length;
            int  partIx      = 0;
            int  cummMatchLx = 0;

            // the start of the match.
            int bx = Ix;

            while (true)
            {
                string patPart = this._PatternValueParts[partIx];

                // match the current part of the keyword pattern to the input text string.
                var  rv      = EqualsText(patPart, this.CompareCase, Text, ix);
                bool isMatch = rv.Item1;
                int  matchLx = rv.Item2;

                // not a match. break out.
                if (isMatch == false)
                {
                    doesMatch = false;
                    break;
                }
                cummMatchLx += matchLx;

                // this is the last part. the full pattern is a match.
                if ((partIx + 1) == nbrParts)
                {
                    doesMatch = true;
                    break;
                }

                // advance past whitespace.
                ix = Ix + cummMatchLx;
                int fx = Scanner.ScanNotEqual(Text, WhitespacePatterns, ix);

                // no whitespace. not a match.
                if (fx == ix)
                {
                    doesMatch = false;
                    break;
                }

                // total up the match length up to the last whitespace char.
                ix          = fx;
                cummMatchLx = ix - Ix;

                partIx += 1;
            }

            return(new Tuple <bool, int>(doesMatch, cummMatchLx));
        }
예제 #9
0
 public void AddDistinct(ScanPatterns Patterns, DelimClassification DelimClass)
 {
     foreach (ScanPattern pat in Patterns)
     {
         int px = base.AddDistinct(pat.PatternValue);
         if (px != -1)
         {
             mWip.Add(DelimClass);
         }
     }
 }
예제 #10
0
 void DelimPatterns_ScanPatternsChanged(ScanPatterns InPatterns)
 {
     mDelims = null;
 }
예제 #11
0
 public void Replace(ScanPatterns Patterns)
 {
     Clear();
     Add(Patterns);
 }
예제 #12
0
        public bool ContainsAll(ScanPatterns InPatterns)
        {
            bool containsAll = ContainsAll(InPatterns.StringArray);

            return(containsAll);
        }