private static void ProcessLine(string source, ref int position, out bool finished, _ATHLexer lexer, Colour expressionColour, ref List <Tuple <Colour, _ATHExpression> > expressions, ref Dictionary <Colour, string> lineBuffer, ref Dictionary <Colour, int> lineBufferPositions) { Colour lineColour = expressionColour; _ATHLexer.SkipWhitespace(source, ref position); if (source[position] == '#') { lineColour = ((ColourToken)ColourToken.Read(source, ref position)).Colour; } if (lineBuffer.ContainsKey(lineColour) == false) { lineBuffer[lineColour] = ""; lineBufferPositions[lineColour] = 0; } lineBuffer[lineColour] += ((EverythingExceptNewlineToken)EverythingExceptNewlineToken.Read(source, ref position)).Content + "\n"; while (position < source.Length && (source[position] == '\r' || source[position] == '\n')) { position++; } try { var pos = lineBufferPositions[lineColour]; _ATHLexer.SkipWhitespace(lineBuffer[lineColour], ref pos); var expression = lexer.ReadExpression(lineBuffer[lineColour], ref pos, lineColour); expressions.Add(Tuple.Create(lineColour, expression)); _ATHLexer.SkipWhitespace(lineBuffer[lineColour], ref pos); lineBufferPositions[lineColour] = pos; } catch (Exception) { // Empty. } if (expressions.Count > 0) { if (expressions[expressions.Count - 1].Item1 == expressionColour) { if (expressions[expressions.Count - 1].Item2 is THISListDIEExpression) { finished = true; return; } } } finished = false; }