From fbb60f4e3decf1c26e2eedfa58730a2b08721c3b Mon Sep 17 00:00:00 2001 From: "Samuel D. Crow" Date: Tue, 23 Mar 2021 15:25:59 -0500 Subject: [PATCH] Started enforcing style guide. Fixed all warnings. --- yab2cpp.h | 38 +++++++++++++------- yabCodeStructures.cpp | 18 ++++++---- yabDataStructures.cpp | 82 ++++++++++++++++++++++++++----------------- 3 files changed, 86 insertions(+), 52 deletions(-) diff --git a/yab2cpp.h b/yab2cpp.h index 127bc67..2632442 100644 --- a/yab2cpp.h +++ b/yab2cpp.h @@ -32,6 +32,7 @@ extern ofstream varNames; extern unordered_map >globals; extern unordered_map >locals; extern unordered_map >statics; + /* ** list of all compiler errors ** @@ -189,6 +190,7 @@ public: {} }; +/* constant operands */ class constOp:public operands { /* box is defined once in the constructor */ @@ -207,7 +209,7 @@ public: {} }; -/* expression can be terminal or non-terminal */ +/* expression can be terminal or non-terminal node */ class expression { shared_ptrop; @@ -221,15 +223,19 @@ public: bool isBinOp(); shared_ptrevaluate(); - shared_ptrstringEval(shared_ptrl, shared_ptrr); + shared_ptrstringEval(shared_ptrl, + shared_ptrr); /* r is NULL for unary operators */ - expression(shared_ptrl, enum OPERATORS o, shared_ptrr=NULL) + expression(shared_ptrl, enum OPERATORS o, + shared_ptrr=NULL) { this->left=l; this->right=r; this->oper=o; } + + /* Terminal expression node */ expression(shared_ptrx) { op=x; @@ -290,14 +296,19 @@ public: /* if statement */ class ifStatement:public codeType { - shared_ptr