From 61defaaf144be78b4dc939b054a15a8066baabbd Mon Sep 17 00:00:00 2001 From: ike709 Date: Tue, 26 Nov 2024 20:21:06 -0600 Subject: [PATCH] cope with \r in long strings --- DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs b/DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs index bde1ab358b..861626ecee 100644 --- a/DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs +++ b/DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs @@ -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);