Files
int2ssl/Node.h
T

66 lines
1.4 KiB
C++
Raw Normal View History

2015-02-15 18:53:04 +03:00
/**
*
* Copyright (c) 2005-2009 Anchorite (TeamX), <anchorite2001@yandex.ru>
2015-02-15 21:33:27 +03:00
* Copyright (c) 2014-2015 Nirran, phobos2077
* Copyright (c) 2015 alexeevdv <mail@alexeevdv.ru>
2015-02-15 18:53:04 +03:00
* Distributed under the GNU GPL v3. For full terms see the file license.txt
*
*/
2015-02-13 16:59:11 +03:00
#ifndef NODE_H
#define NODE_H
2015-02-15 16:31:38 +03:00
// C++ standard includes
// int2ssl includes
2015-02-13 16:59:11 +03:00
#include "Namespace.h"
#include "Opcode.h"
2015-02-15 16:31:38 +03:00
// Third party includes
2015-02-13 16:59:11 +03:00
class CNode;
2015-02-15 21:30:47 +03:00
typedef std::vector<CNode> CNodeArray;
typedef std::vector<CNodeArray> CArrayOfNodeArray;
2015-02-13 16:59:11 +03:00
2015-02-14 14:38:14 +03:00
class CNode
{
2015-02-13 16:59:11 +03:00
public:
2015-02-14 13:39:47 +03:00
enum Type {
TYPE_NORMAL,
TYPE_BEGIN_OF_BLOCK,
TYPE_END_OF_BLOCK,
TYPE_OMITTED_ARGUMENT,
TYPE_BREAK,
TYPE_CONTINUE,
TYPE_FOR_LOOP,
TYPE_CONDITIONAL_EXPRESSION
};
2015-02-13 16:59:11 +03:00
public:
2015-02-14 13:39:47 +03:00
CNode(Type type = TYPE_NORMAL);
CNode(const CNode& node);
virtual ~CNode();
2015-02-13 16:59:11 +03:00
public:
2015-02-14 13:39:47 +03:00
CNode& operator = (const CNode& node);
2015-02-13 16:59:11 +03:00
public:
2015-02-16 00:30:55 +03:00
void StoreTree(int nIndent, int nIndex);
2015-02-15 18:28:27 +03:00
uint32_t GetTopOffset();
2015-02-14 13:39:47 +03:00
bool IsExpression() const;
bool IsInfix() const;
2015-02-13 16:59:11 +03:00
public:
2015-02-15 18:28:27 +03:00
uint32_t m_ulOffset;
2015-02-14 13:39:47 +03:00
COpcode m_Opcode;
2015-02-13 16:59:11 +03:00
2015-02-14 13:39:47 +03:00
Type m_Type;
CNodeArray m_Arguments;
2015-02-13 16:59:11 +03:00
};
// 'Begin' end 'End of block' 'End Else Begin' nodes
const CNode c_NodeBeginOfBlock(CNode::TYPE_BEGIN_OF_BLOCK);
const CNode c_NodeEndOfBlock(CNode::TYPE_END_OF_BLOCK);
2015-02-14 14:38:14 +03:00
#endif //NODE_H