From 18a5bdca16a03ea70784888195bfc7e68a466dc2 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Mon, 15 Mar 2021 11:29:05 +0200 Subject: [PATCH] Added recursive brace parsing for parseExpression() Updated test case to test it --- source/tlang/compiler/parser.d | 10 ++++++++++ source/tlang/testing/basic1.t | 2 ++ 2 files changed, 12 insertions(+) diff --git a/source/tlang/compiler/parser.d b/source/tlang/compiler/parser.d index b8868d4..ce021ff 100644 --- a/source/tlang/compiler/parser.d +++ b/source/tlang/compiler/parser.d @@ -340,6 +340,16 @@ public final class Parser * TODO: For recursive () in expressions I might need to stop the `)` detection outside * of the call to parseExpression (the original call) */ + else if(symbol == SymbolType.LBRACE) + { + nextToken(); + + parseExpression(); + + + + nextToken(); + } else { //gprintln("parseExpression(): NO MATCH", DebugType.ERROR); diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index 05a49e0..229e29b 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -42,6 +42,8 @@ void main(int hello, byte d) ubyte eish = 1+1; + ubyte poes = ((1+1)); + if(1+1) { if(1)