예제 #1
0
        public override void Init(GrammarData grammarData)
        {
            base.Init(grammarData);
            var stopCharSet = new CharHashSet();

            foreach (var term in grammarData.Terminals)
            {
                var firsts = term.GetFirsts();
                if (firsts == null)
                {
                    continue;
                }
                foreach (var first in firsts)
                {
                    if (!string.IsNullOrEmpty(first))
                    {
                        stopCharSet.Add(first[0]);
                    }
                }
            }//foreach term
            if (EscapeChar != NoEscape)
            {
                stopCharSet.Add(EscapeChar);
            }
            _stopChars = stopCharSet.ToArray();
        }
예제 #2
0
 public override void Init(GrammarData grammarData) {
   base.Init(grammarData);
   var stopChars = new CharHashSet();
   foreach (var key in Escapes.Keys)
     stopChars.Add(key[0]);
   foreach (var t in Terminators)
     stopChars.Add(t[0]);
   _stopChars = stopChars.ToArray();
 }
예제 #3
0
 public override void Init(GrammarData grammarData) {
   base.Init(grammarData);
   _isSimple = Terminators.Count == 1 && Escapes.Count == 0;
   if (_isSimple) {
     _singleTerminator = Terminators.First(); 
     return;
   }
   var stopChars = new CharHashSet();
   foreach (var key in Escapes.Keys)
     stopChars.Add(key[0]);
   foreach (var t in Terminators)
     stopChars.Add(t[0]);
   _stopChars = stopChars.ToArray();
 }
예제 #4
0
 public override void Init(GrammarData grammarData) {
   base.Init(grammarData);
   var stopCharSet = new CharHashSet();
   foreach(var term in grammarData.Terminals) {
     var firsts = term.GetFirsts(); 
     if (firsts == null) continue; 
     foreach (var first in firsts)
       if (!string.IsNullOrEmpty(first))
         stopCharSet.Add(first[0]); 
   }//foreach term
   if (EscapeChar != NoEscape)  
     stopCharSet.Add(EscapeChar);
   _stopChars = stopCharSet.ToArray(); 
 }
예제 #5
0
        public override void Init(GrammarData grammarData)
        {
            base.Init(grammarData);
            var stopChars = new CharHashSet();

            foreach (var key in Escapes.Keys)
            {
                stopChars.Add(key[0]);
            }
            foreach (var t in Terminators)
            {
                stopChars.Add(t[0]);
            }
            _stopChars = stopChars.ToArray();
        }
예제 #6
0
        public override void Init(GrammarData grammarData)
        {
            base.Init(grammarData);
            _isSimple = Terminators.Count == 1 && Escapes.Count == 0;
            if (_isSimple)
            {
                _singleTerminator = Terminators.First();
                return;
            }
            var stopChars = new CharHashSet();

            foreach (var key in Escapes.Keys)
            {
                stopChars.Add(key[0]);
            }
            foreach (var t in Terminators)
            {
                stopChars.Add(t[0]);
            }
            _stopChars = stopChars.ToArray();
        }