Skip to content

Commit

Permalink
cope with \r in long strings
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 committed Nov 27, 2024
1 parent 4f5027b commit 61defaa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,12 @@ public Token NextToken(bool ignoreWhitespace = false) {
}
else if (isLong) {
// Long strings ignore a newline immediately after the @{" and before the "}
if (TokenTextBuilder[3] == '\r')
TokenTextBuilder.Remove(3, 1);
if (TokenTextBuilder[3] == '\n')
TokenTextBuilder.Remove(3, 1);
if (TokenTextBuilder[^3] == '\r')
TokenTextBuilder.Remove(TokenTextBuilder.Length - 3, 1);
if (TokenTextBuilder[^3] == '\n')
TokenTextBuilder.Remove(TokenTextBuilder.Length - 3, 1);

Expand Down

0 comments on commit 61defaa

Please sign in to comment.