Fixed dumb parsing error

This commit is contained in:
Hackerpilot 2014-01-13 21:50:40 +00:00
parent efbf9952b3
commit 952b5e364a
2 changed files with 18 additions and 2 deletions

View File

@ -1128,6 +1128,12 @@ public struct DLexer(R)
app.put("q{"); app.put("q{");
int depth = 1; int depth = 1;
LexerConfig c = config;
scope(exit) config = c;
config.whitespaceBehavior = WhitespaceBehavior.include;
config.stringBehavior = StringBehavior.source;
config.commentBehavior = CommentBehavior.include;
_front = advance(); _front = advance();
while (depth > 0 && !empty) while (depth > 0 && !empty)
{ {
@ -1414,5 +1420,5 @@ public struct DLexer(R)
} }
const LexerConfig config; LexerConfig config;
} }

View File

@ -4084,6 +4084,11 @@ q{(int a, ...)
{ {
mixin(traceEnterAndExit!(__FUNCTION__)); mixin(traceEnterAndExit!(__FUNCTION__));
auto node = new PrimaryExpression; auto node = new PrimaryExpression;
if (!moreTokens())
{
error("Expected primary statement instead of EOF");
return null;
}
switch (current.type) switch (current.type)
{ {
case tok!".": case tok!".":
@ -4407,6 +4412,11 @@ q{(int a, ...)
{ {
mixin(traceEnterAndExit!(__FUNCTION__)); mixin(traceEnterAndExit!(__FUNCTION__));
auto node = new Statement; auto node = new Statement;
if (!moreTokens())
{
error("Expected statement instead of EOF");
return null;
}
switch (current.type) switch (current.type)
{ {
case tok!"case": case tok!"case":
@ -5801,7 +5811,7 @@ q{doStuff(5)}c;
Unittest parseUnittest() Unittest parseUnittest()
{ {
mixin(traceEnterAndExit!(__FUNCTION__)); mixin(traceEnterAndExit!(__FUNCTION__));
mixin (simpleParse!(Unittest, tok!"unittest", "blockStatement|parseBlockStatement", true)); mixin (simpleParse!(Unittest, tok!"unittest", "blockStatement|parseBlockStatement"));
} }
/** /**