diff --git a/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g b/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g index 731cb86f8..0615b8a8d 100644 --- a/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g +++ b/delphi-frontend/src/main/antlr3/au/com/integradev/delphi/antlr/Delphi.g @@ -1276,7 +1276,7 @@ COMMENT : '//' ~('\n'|'\r')* {$channel } } ; -WHITESPACE : (' '|'\t'|'\r'|'\n'|'\f')+ {$channel=HIDDEN;} +WHITESPACE : ('\u0000'..'\u0020' | '\u3000')+ {$channel=HIDDEN;} ; UnicodeBOM : '\uFEFF' {$channel=HIDDEN;} ; diff --git a/delphi-frontend/src/test/java/au/com/integradev/delphi/antlr/GrammarTest.java b/delphi-frontend/src/test/java/au/com/integradev/delphi/antlr/GrammarTest.java index b263814ac..b984f1927 100644 --- a/delphi-frontend/src/test/java/au/com/integradev/delphi/antlr/GrammarTest.java +++ b/delphi-frontend/src/test/java/au/com/integradev/delphi/antlr/GrammarTest.java @@ -237,4 +237,9 @@ void testEmptyFileShouldThrow() { DelphiFileUtils.mockConfig())) .isInstanceOf(DelphiFileConstructionException.class); } + + @Test + void testUnusualWhitespace() { + parseFile("UnusualWhitespace.pas"); + } } diff --git a/delphi-frontend/src/test/resources/au/com/integradev/delphi/grammar/UnusualWhitespace.pas b/delphi-frontend/src/test/resources/au/com/integradev/delphi/grammar/UnusualWhitespace.pas new file mode 100644 index 000000000..3b4bad238 Binary files /dev/null and b/delphi-frontend/src/test/resources/au/com/integradev/delphi/grammar/UnusualWhitespace.pas differ