From 0aff0e582101c2c33834c4ea2824e115c5c20fbc Mon Sep 17 00:00:00 2001 From: otya128 Date: Sat, 24 Dec 2016 16:53:49 +0900 Subject: [PATCH] Fix IF parsing --- SMILEBASIC/parser.d | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/SMILEBASIC/parser.d b/SMILEBASIC/parser.d index a884f62..3b6050c 100644 --- a/SMILEBASIC/parser.d +++ b/SMILEBASIC/parser.d @@ -1583,7 +1583,10 @@ class Parser then = ifStatements(); } token = lex.front(); - lex.popFront(); + if (multiline || token.type != TokenType.NewLine) + { + lex.popFront(); + } import std.typecons; Tuple!(Statements, Expression)[] elseif = new Tuple!(Statements, Expression)[0]; while(token.type == TokenType.Elseif) @@ -1643,7 +1646,10 @@ class Parser { else_ = ifStatements(); } - lex.popFront(); + if (multiline || lex.front.type != TokenType.NewLine) + { + lex.popFront(); + } } auto if_ = new If(expr, then, else_, elseif, lex.location); return if_;