diff --git a/stdx/d/lexer.d b/stdx/d/lexer.d index 76e27b3..7c53ae3 100644 --- a/stdx/d/lexer.d +++ b/stdx/d/lexer.d @@ -1127,6 +1127,12 @@ public struct DLexer(R) auto app = appender!string(); app.put("q{"); int depth = 1; + + LexerConfig c = config; + scope(exit) config = c; + config.whitespaceBehavior = WhitespaceBehavior.include; + config.stringBehavior = StringBehavior.source; + config.commentBehavior = CommentBehavior.include; _front = advance(); while (depth > 0 && !empty) @@ -1414,5 +1420,5 @@ public struct DLexer(R) } - const LexerConfig config; + LexerConfig config; } diff --git a/stdx/d/parser.d b/stdx/d/parser.d index c684501..a9936a9 100644 --- a/stdx/d/parser.d +++ b/stdx/d/parser.d @@ -4084,6 +4084,11 @@ q{(int a, ...) { mixin(traceEnterAndExit!(__FUNCTION__)); auto node = new PrimaryExpression; + if (!moreTokens()) + { + error("Expected primary statement instead of EOF"); + return null; + } switch (current.type) { case tok!".": @@ -4407,6 +4412,11 @@ q{(int a, ...) { mixin(traceEnterAndExit!(__FUNCTION__)); auto node = new Statement; + if (!moreTokens()) + { + error("Expected statement instead of EOF"); + return null; + } switch (current.type) { case tok!"case": @@ -5801,7 +5811,7 @@ q{doStuff(5)}c; Unittest parseUnittest() { mixin(traceEnterAndExit!(__FUNCTION__)); - mixin (simpleParse!(Unittest, tok!"unittest", "blockStatement|parseBlockStatement", true)); + mixin (simpleParse!(Unittest, tok!"unittest", "blockStatement|parseBlockStatement")); } /**