summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-parser.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-03-08 16:32:37 -0800
committerGitHub <noreply@github.com>2024-03-08 16:32:37 -0800
commitbc3dc0e82d52faa45ffe73448e86208f137b8536 (patch)
tree1894d39b02ff7fecb6a3ad9ff6b6b0f34d5d0bc2 /source/slang/slang-parser.cpp
parent6f8a20688e0c4b989db152b4d06aeab04fac0567 (diff)
Parser and module finding logic fixes. (#3720)
* Fix parsing logic of `struct` decl. Fixes #3716. * Allow `loadModule` to find modules with underscores. * Fix test.
Diffstat (limited to 'source/slang/slang-parser.cpp')
-rw-r--r--source/slang/slang-parser.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index ae40234bc..3315c786a 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -2724,7 +2724,8 @@ namespace Slang
{
if(typeSpec.decl)
{
- if(peekToken(parser).flags & TokenFlag::AtStartOfLine)
+ if( peekToken(parser).type == TokenType::EndOfFile ||
+ (peekToken(parser).flags & TokenFlag::AtStartOfLine))
{
// The token after the `}` is at the start of its
// own line, which means it can't be on the same line.
@@ -4453,7 +4454,7 @@ namespace Slang
parser->pendingModifiers = &modifiers;
auto loc = parser->tokenReader.peekLoc();
-
+ auto ptoken = parser->tokenReader.peekToken();
switch (peekTokenType(parser))
{
case TokenType::Identifier: