string _suffixesFirsts;       //first chars of all suffixes, for fast suffix detection
        #endregion


        #region overrides: Init, TryMatch
        public override void Init(GrammarData grammarData)
        {
            base.Init(grammarData);
            //collect all suffixes, prefixes in lists and create strings of first chars for both
            Prefixes.Sort(StringList.LongerFirst);
            _prefixesFirsts = string.Empty;
            foreach (string pfx in Prefixes)
            {
                _prefixesFirsts += pfx[0];
            }

            Suffixes.Sort(StringList.LongerFirst);
            _suffixesFirsts = string.Empty;
            foreach (string sfx in Suffixes)
            {
                _suffixesFirsts += sfx[0]; //we don't care if there are repetitions
            }
            if (!CaseSensitive)
            {
                _prefixesFirsts = _prefixesFirsts.ToLower() + _prefixesFirsts.ToUpper();
                _suffixesFirsts = _suffixesFirsts.ToLower() + _suffixesFirsts.ToUpper();
            }
        }//method
Beispiel #2
0
 public ScannerData(GrammarData grammarData)
 {
     GrammarData = grammarData;
 }
Beispiel #3
0
 public virtual void Init(GrammarData grammarData)
 {
     GrammarData  = grammarData;
     OwnerGrammar = grammarData.Grammar;
 }