Skip to content

Commit 35b16cf

Browse files
committed
add error handling for early istring end in parser
1 parent eab2d4d commit 35b16cf

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/dparse/parser.d

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
module dparse.parser;
44

5-
import dparse.lexer;
65
import dparse.ast;
6+
import dparse.lexer;
77
import dparse.rollback_allocator;
88
import dparse.stack_buffer;
9-
import std.experimental.allocator.mallocator;
10-
import std.experimental.allocator;
11-
import std.conv;
129
import std.algorithm;
1310
import std.array;
11+
import std.conv;
12+
import std.experimental.allocator;
13+
import std.experimental.allocator.mallocator;
1414
import std.string : format;
1515

1616
// Uncomment this if you want ALL THE OUTPUT
@@ -4635,8 +4635,13 @@ class Parser
46354635
{
46364636
if (auto c = parseInterpolatedStringPart())
46374637
parts.put(c);
4638-
else
4638+
else if (moreTokens)
46394639
advance();
4640+
else
4641+
{
4642+
error("Expected more interpolated string parts but got EOF ", false);
4643+
return null;
4644+
}
46404645
}
46414646
ownArray(node.parts, parts);
46424647
expect(tok!"istringLiteralEnd");

0 commit comments

Comments
 (0)