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 ,
2013-12-18 18:05:21 -06:00
if_statement , while_loop , for_loop , return_statement , assignment_statement , declaration_statement ,
2013-12-22 01:34:59 -06:00
if_comp , simple_passthrough , 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 ) ;
2014-05-08 01:07:57 -04:00
void addTemplateTypeDefToReplace ( NodeTree < ASTData > * typeDefToReplace ) ;
std : : vector < NodeTree < ASTData > * > getTemplateTypeDefsToReplace ( ) ;
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 ;
2014-05-08 01:07:57 -04:00
std : : vector < NodeTree < ASTData > * > templateTypeDefsToReplace ; //Used only by template classes/functions to keep track of pointers to the typedefs that need to be changed
2013-09-26 15:16:58 -04:00
private :
} ;
# endif