public static void ContinueNextLine(ref List <string> lines, ref int index) { MicroRegex.Match match = MicroRegex.Match.LastMatch ( lines[index], Operators.linecontinue, MicroRegex.SearchTypes.STRING, MicroRegex.MatchTypes.NonLiteralSequence ); int count = 1; while (match.Success) { if (String.IsNullOrWhiteSpace(lines[index].Substring(match.Index + match.Length))) { if (index + count < lines.Count) { lines[index] = lines[index].Substring(0, match.Index); if (!lines[index].EndsWith(" ", StringComparison.Ordinal)) { lines[index] += " "; } lines[index] += lines[index + count].TrimStart(); lines[index + count] = ""; count = count + 1; } else { throw new Exception("Line " + (index + count) + ": Syntax Error: Line continuation not followed by another line."); } } else { lines[index] = lines[index].Remove(match.Index, match.Length); } match = MicroRegex.Match.LastMatch ( lines[index], Operators.linecontinue, MicroRegex.SearchTypes.STRING, MicroRegex.MatchTypes.NonLiteralSequence ); } }
public static void RemoveAnnotation(ref List <string> lines, int index) { MicroRegex.Match match = MicroRegex.Match.NextMatch ( lines[index], Operators.comment, MicroRegex.SearchTypes.STRING, MicroRegex.MatchTypes.NonLiteralSequence, MicroRegex.Match.ANYQUOTE ); if (match.Success) { lines[index] = lines[index].Substring(0, match.Index); } }