2013-09-26 15:16:58 -04:00
|
|
|
#ifndef ASTDATA_H
|
|
|
|
|
#define ASTDATA_H
|
|
|
|
|
|
2013-10-02 03:15:20 -04:00
|
|
|
#include <vector>
|
2013-12-27 13:05:07 -06:00
|
|
|
#include <map>
|
2013-12-23 01:26:24 -06:00
|
|
|
|
2013-10-02 03:15:20 -04:00
|
|
|
#include "Symbol.h"
|
2014-01-07 13:14:58 -05:00
|
|
|
//Circular dependency
|
|
|
|
|
class Type;
|
2013-12-23 01:26:24 -06:00
|
|
|
#include "Type.h"
|
2013-10-02 03:15:20 -04:00
|
|
|
|
2013-09-26 15:16:58 -04:00
|
|
|
#ifndef NULL
|
2014-03-06 13:13:40 -05:00
|
|
|
#define NULL ((void*)0)
|
2013-09-26 15:16:58 -04:00
|
|
|
#endif
|
|
|
|
|
|
2014-01-07 13:14:58 -05:00
|
|
|
enum ASTType {undef, translation_unit, interpreter_directive, import, identifier, type_def,
|
|
|
|
|
function, code_block, typed_parameter, expression, boolean_expression, statement,
|
2015-05-15 15:19:55 -04:00
|
|
|
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};
|
2013-09-26 15:16:58 -04:00
|
|
|
|
|
|
|
|
class ASTData {
|
|
|
|
|
public:
|
2013-10-16 01:43:18 -04:00
|
|
|
ASTData();
|
2014-01-07 13:14:58 -05:00
|
|
|
ASTData(ASTType type, Type *valueType = NULL);
|
|
|
|
|
ASTData(ASTType type, Symbol symbol, Type *valueType = NULL);
|
2013-10-02 03:15:20 -04:00
|
|
|
~ASTData();
|
|
|
|
|
std::string toString();
|
2013-10-16 01:43:18 -04:00
|
|
|
static std::string ASTTypeToString(ASTType type);
|
2015-05-27 00:58:33 -04:00
|
|
|
|
2013-09-26 15:16:58 -04:00
|
|
|
ASTType type;
|
2014-01-07 13:14:58 -05:00
|
|
|
Type* valueType;
|
2013-10-02 03:15:20 -04:00
|
|
|
Symbol symbol;
|
2014-03-06 13:13:40 -05:00
|
|
|
std::map<std::string, std::vector<NodeTree<ASTData>*>> scope;
|
2013-09-26 15:16:58 -04:00
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2015-04-04 01:32:40 -04:00
|
|
|
#endif
|