diff options
Diffstat (limited to 'source')
| -rw-r--r-- | source/slang/slang-preprocessor.cpp | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/source/slang/slang-preprocessor.cpp b/source/slang/slang-preprocessor.cpp index 9586088a1..b0986f64c 100644 --- a/source/slang/slang-preprocessor.cpp +++ b/source/slang/slang-preprocessor.cpp @@ -2994,10 +2994,25 @@ static void HandleIncludeDirective(PreprocessorDirectiveContext* context) AdvanceRawToken(context); Token pathToken; - if(!Expect(context, TokenType::StringLiteral, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken)) - return; - - String path = getFileNameTokenValue(pathToken); + String path; + if (PeekRawTokenType(context) == TokenType::OpLess) + { + StringBuilder pathSB; + Expect(context, TokenType::OpLess, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken); + while (PeekRawTokenType(context) != TokenType::OpGreater && + PeekRawTokenType(context) != TokenType::EndOfFile) + { + pathSB << AdvanceRawToken(context).getContent(); + } + if (!Expect(context, TokenType::OpGreater, Diagnostics::expectedTokenInPreprocessorDirective)) + return; + path = pathSB.produceString(); + } + else + { + Expect(context, TokenType::StringLiteral, Diagnostics::expectedTokenInPreprocessorDirective, &pathToken); + path = getFileNameTokenValue(pathToken); + } auto directiveLoc = GetDirectiveLoc(context); |
