summaryrefslogtreecommitdiffstats
path: root/source/compiler-core/slang-lexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler-core/slang-lexer.cpp')
-rw-r--r--source/compiler-core/slang-lexer.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/compiler-core/slang-lexer.cpp b/source/compiler-core/slang-lexer.cpp
index 10c5aa1ae..7d84ed938 100644
--- a/source/compiler-core/slang-lexer.cpp
+++ b/source/compiler-core/slang-lexer.cpp
@@ -185,7 +185,7 @@ namespace Slang
c = lexer->m_cursor[pos++];
- if (c == '\\')
+ while (c == '\\')
{
// We might have a backslash-escaped newline.
// Look at the next byte (if any) to see.
@@ -198,18 +198,21 @@ namespace Slang
case '\r': case '\n':
{
// The newline was escaped, so return the code point after *that*
-
int e = lexer->m_cursor[pos++];
if ((d ^ e) == ('\r' ^ '\n'))
c = lexer->m_cursor[pos++];
else
c = e;
- break;
+ continue;
}
default:
break;
}
+
+ // Only continue this while loop in the case where we consumed
+ // some newlines
+ break;
}
// TODO: handle UTF-8 encoding for non-ASCII code points here