From c1e519b80fe4e663e738da2597640c5bc4a66f90 Mon Sep 17 00:00:00 2001 From: David Dyck Date: Sat, 13 Jun 2020 20:57:44 -0700 Subject: [PATCH] Fix issue Failure to parse HIGHCHARUNICODE compiler directive Fix issue Failure to parse HIGHCHARUNICODE compiler directive https://github.com/joewhite/dgrok/issues/4 Add an ignored directive type for "HIGHCHARUNICODE"] to Source/DGrok.Framework/Framework/TokenFilter.cs Add a new test case HighCharUnicodeCompilerDirectivesAreIgnored() to verifiy that {$HIGHCHARUNICODE ... } is ignored ( doesn't really check the value of the parameter ON/OFF ) --- Source/DGrok.Framework/Framework/TokenFilter.cs | 1 + Source/DGrok.Tests/TokenFilterTests.cs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/Source/DGrok.Framework/Framework/TokenFilter.cs b/Source/DGrok.Framework/Framework/TokenFilter.cs index f93665b..c8186be 100644 --- a/Source/DGrok.Framework/Framework/TokenFilter.cs +++ b/Source/DGrok.Framework/Framework/TokenFilter.cs @@ -86,6 +86,7 @@ public TokenFilter(IEnumerable tokens, CompilerDefines compilerDefines, _directiveTypes["EXTENDEDSYNTAX"] = DirectiveType.Ignored; _directiveTypes["EXTENSION"] = DirectiveType.Ignored; _directiveTypes["FINITEFLOAT"] = DirectiveType.Ignored; + _directiveTypes["HIGHCHARUNICODE"] = DirectiveType.Ignored; _directiveTypes["HINTS"] = DirectiveType.Ignored; _directiveTypes["I"] = DirectiveType.PossibleInclude; _directiveTypes["IMAGEBASE"] = DirectiveType.Ignored; diff --git a/Source/DGrok.Tests/TokenFilterTests.cs b/Source/DGrok.Tests/TokenFilterTests.cs index e23a715..f9be602 100644 --- a/Source/DGrok.Tests/TokenFilterTests.cs +++ b/Source/DGrok.Tests/TokenFilterTests.cs @@ -95,6 +95,12 @@ public void CPlusPlusBuilderCompilerDirectivesAreIgnored() Assert.That("{$NOINCLUDE Foo}", LexesAndFiltersAs()); } [Test] + public void HighCharUnicodeCompilerDirectivesAreIgnored() + { + Assert.That("{$HIGHCHARUNICODE ON}", LexesAndFiltersAs()); + Assert.That("{$HIGHCHARUNICODE OFF}", LexesAndFiltersAs()); + } + [Test] public void IfDefTrue() { Assert.That("0{$IFDEF TRUE}1{$ENDIF}2", LexesAndFiltersAs(