Skip to content

Commit 4f690d2

Browse files
authored
Accept numbers in # and ## preprocessor tokens (#2449)
1 parent db69b2a commit 4f690d2

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#define MACRO(ARG_1, ARG_2) "[#ARG_1] [##ARG_2]"
2+
3+
/proc/RunTest()
4+
ASSERT(MACRO(1, 2) == "1 2")

DMCompiler/Compiler/DMPreprocessor/DMPreprocessorLexer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ public Token NextToken(bool ignoreWhitespace = false) {
442442
}
443443

444444
TokenTextBuilder.Clear();
445-
while (char.IsAsciiLetter(GetCurrent()) || GetCurrent() == '_') {
445+
while (char.IsAsciiLetterOrDigit(GetCurrent()) || GetCurrent() == '_') {
446446
TokenTextBuilder.Append(GetCurrent());
447447
Advance();
448448
}

0 commit comments

Comments
 (0)