From 236cf1d4a3438b06a7398a113a5382bca040700a Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sun, 24 Oct 2021 13:46:05 -0700 Subject: [PATCH] Allow leading whitespace in .sym65 comments We allow empty lines and lines that begin with ';' in .sym65. Lines with nothing but whitespace, or comments with leading whitespace, caused a warning. It can be aesthetically nice to line up the start of comments, and lines with pointless whitespace aren't problematic, so we now allow these without complaint. Added some samples to the 20170-external-symbols data file. No change to the test output. --- SourceGen/PlatformSymbols.cs | 5 +++-- SourceGen/SGTestData/20170-external-symbols-1.sym65 | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/SourceGen/PlatformSymbols.cs b/SourceGen/PlatformSymbols.cs index 65ab484..4039bfc 100644 --- a/SourceGen/PlatformSymbols.cs +++ b/SourceGen/PlatformSymbols.cs @@ -141,8 +141,9 @@ namespace SourceGen { int lineNum = 0; foreach (string line in lines) { lineNum++; // first line is line 1, says Vim and VisualStudio - if (string.IsNullOrEmpty(line) || line[0] == ';') { - // ignore + string trimLine = line.Trim(); + if (string.IsNullOrEmpty(trimLine) || trimLine[0] == ';') { + // all whitespace, or just a comment; ignore } else if (line[0] == '*') { if (line.StartsWith(TAG_CMD)) { tag = ParseTag(line); diff --git a/SourceGen/SGTestData/20170-external-symbols-1.sym65 b/SourceGen/SGTestData/20170-external-symbols-1.sym65 index 2ee61e4..a553b13 100644 --- a/SourceGen/SGTestData/20170-external-symbols-1.sym65 +++ b/SourceGen/SGTestData/20170-external-symbols-1.sym65 @@ -121,3 +121,11 @@ TooLong @ $c0f8 $a *MULTI_MASK $ffff $ffff $fffff ;range *MULTI_MASK + + +; The following lines have nothing but whitespace. + + + + ;Comment with leading spaces. + ;leading tab