Break, continue, and DEFER statements! Woooo

This commit is contained in:
Nathan Braswell
2015-05-15 15:19:55 -04:00
parent 5dcb5ba02a
commit 795f8715ff
8 changed files with 106 additions and 43 deletions

View File

@@ -15,9 +15,9 @@ class Type;
enum ASTType {undef, translation_unit, interpreter_directive, import, identifier, type_def,
function, code_block, typed_parameter, expression, boolean_expression, statement,
if_statement, while_loop, for_loop, return_statement, assignment_statement, declaration_statement,
if_comp, simple_passthrough, passthrough_params, in_passthrough_params, out_passthrough_params,
opt_string, param_assign, function_call, value};
if_statement, while_loop, for_loop, return_statement, break_statement, continue_statement, defer_statement,
assignment_statement, declaration_statement, if_comp, simple_passthrough, passthrough_params,
in_passthrough_params, out_passthrough_params, opt_string, param_assign, function_call, value};
class ASTData {
public:

View File

@@ -5,6 +5,7 @@
#include <iostream>
#include <fstream>
#include <utility>
#include <stack>
#include <sys/stat.h>
#include "NodeTree.h"
@@ -34,10 +35,13 @@ class CGenerator {
static std::string scopePrefix(NodeTree<ASTData>* from);
std::string generateObjectMethod(NodeTree<ASTData>* enclosingObject, NodeTree<ASTData>* from, std::string *functionPrototype);
NodeTree<ASTData>* getMethodsObjectType(NodeTree<ASTData>* scope, std::string functionName);
std::string tabs();
int tabLevel;
std::string generatorString;
std::string linkerString;
std::vector<std::vector<NodeTree<ASTData>*>> deferDoubleStack;
std::stack<int> loopDeferStackDepth;
private:
std::string tabs();
int tabLevel;
};
#endif