Skip to content

Commit

Permalink
more robust checking
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 committed Nov 27, 2024
1 parent ba72e61 commit 4f5027b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,11 @@ public Token NextToken(bool ignoreWhitespace = false) {
var delimIdx = 0;
do {
TokenTextBuilder.Append(c);

if (GetCurrent() == complexDelimiter[delimIdx]) delimIdx++;
if (delimIdx + 1 == complexDelimiter.Length) {
else delimIdx = 0;

if (delimIdx + 1 == complexDelimiter.Length && c == complexDelimiter[^1]) { // latter check ensures a 1-char delimiter actually matches
TokenTextBuilder.Remove(TokenTextBuilder.Length - delimIdx, complexDelimiter.Length - 1);
break;
}
Expand Down

0 comments on commit 4f5027b

Please sign in to comment.