From 688fc34969b666de0d7ceba745c596e6138ac636 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 4 May 2021 19:10:59 +0200 Subject: [PATCH] Added Struct parsing support to paarseBody Added a test to test it (in basic1.t) --- source/tlang/compiler/parsing/core.d | 6 ++++++ source/tlang/testing/basic1.t | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source/tlang/compiler/parsing/core.d b/source/tlang/compiler/parsing/core.d index 781b8f5..1e22215 100644 --- a/source/tlang/compiler/parsing/core.d +++ b/source/tlang/compiler/parsing/core.d @@ -415,6 +415,12 @@ public final class Parser /* Parse the class and add its statements */ statements ~= parseClass(); } + /* If it is a struct definition */ + else if(symbol == SymbolType.STRUCT) + { + /* Parse the struct and add it to the statements */ + statements ~= parseStruct(); + } /* Error out */ else { diff --git a/source/tlang/testing/basic1.t b/source/tlang/testing/basic1.t index efcf4ad..5a9b366 100644 --- a/source/tlang/testing/basic1.t +++ b/source/tlang/testing/basic1.t @@ -32,11 +32,16 @@ class kl struct structTest { - + } class Shekshi { + struct structTest + { + + } + class Shekshi1 {