Exemple #1
0
 public void Clear()
 {
     _filePath = null;
     _reader = null;
     _context = null;
     if (_stringBuilder != null && _stringBuilder.Capacity > _stringBuilderCapacity * 8)
     {
         _stringBuilder = null;
     }
 }
Exemple #2
0
 public static Lexer Get(string filePath, TextReader reader, ParsingContext context, IEnumerable<string> ppSymbols)
 {
     return Instance.Init(filePath, reader, context, ppSymbols);
 }
Exemple #3
0
 private Lexer Init(string filePath, TextReader reader, ParsingContext context, IEnumerable<string> ppSymbols)
 {
     if (filePath == null) throw new ArgumentNullException("filePath");
     if (reader == null) throw new ArgumentNullException("reader");
     if (context == null) throw new ArgumentNullException("context");
     _filePath = filePath;
     _reader = reader;
     _context = context;
     _index = _count = 0;
     _isEOF = false;
     _totalIndex = 0;
     _lastLine = _lastColumn = _line = _column = 1;
     if (_stringBuilder == null)
     {
         _stringBuilder = new StringBuilder(_stringBuilderCapacity);
     }
     _atLineHead = true;
     _gotNonTrivalToken = false;
     _ppRegionCount = 0;
     _ppSymbolSet.Clear();
     if (ppSymbols != null)
     {
         _ppSymbolSet.UnionWith(ppSymbols);
     }
     _ppConditionStack.Clear();
     _ppExprToken = null;
     return this;
 }