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(); }
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(); }
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(); }
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(); }
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(); }
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(); }