summaryrefslogtreecommitdiffstats
path: root/Sencha-lang/AST/BasicExpression.h
blob: 69b3f1800343d055a02a02b9919076c90537bf1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * BasicExpression.h
 *
 *  Created on: Dec 5, 2012
 *      Author: attero
 */

#ifndef BASICEXPRESSION_H_
#define BASICEXPRESSION_H_
#include "ASTExpression.h"
#include <iostream>

/**
 * BasicExpression is a very important class in my AST design. It always has
 * two children, which are actually left and right operands. Basic expression stores
 * a type of operation it does. It can be "+" or "-" for example.
 * Type of operator is very important when expression evaluates itself.
 *
 */
class BasicExpression : public ASTExpression {
public:

	void set_operator(std::string op);
	void set_left_operand(ASTNode * left);
	void set_right_operand(ASTNode * right);
	virtual SenchaObject evaluate();
	virtual void execute();
	virtual void execute_quietly();
	std::string get_operator() { return oper; }
	virtual void accept(Visitor * visitor);

	BasicExpression();
	virtual ~BasicExpression();

private:
	//Do I use it for anything actually?
	bool children_set;
	std::string oper;
};

#endif /* BASICEXPRESSION_H_ */