From 6f8f940f3165e3da2e94cfcbc67fe15c82205650 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Tue, 22 May 2012 18:05:04 +1200 Subject: [PATCH] #2130 fixed -- #comments can be used at the end of any lines --- OpenRA.FileFormats/MiniYaml.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.FileFormats/MiniYaml.cs b/OpenRA.FileFormats/MiniYaml.cs index 1807c05f77..1962bcfbce 100755 --- a/OpenRA.FileFormats/MiniYaml.cs +++ b/OpenRA.FileFormats/MiniYaml.cs @@ -105,11 +105,14 @@ namespace OpenRA.FileFormats levels.Add(new List()); var lineNo = 0; - foreach (var line in lines) + foreach (var ll in lines) { + var line = ll; ++lineNo; + if (line.Contains('#')) + line = line.Substring(0, line.IndexOf('#')).TrimEnd(' ', '\t'); var t = line.TrimStart(' ', '\t'); - if (t.Length == 0 || t[0] == '#') + if (t.Length == 0) continue; var level = line.Length - t.Length; var location = new MiniYamlNode.SourceLocation { Filename = filename, Line = lineNo };