aboutsummaryrefslogtreecommitdiff
path: root/src/runner.h
blob: 98894daafbcf5adf56738687b599db5d0d6a2b39 (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
42
43
#ifndef RUNNER_H
#define RUNNER_H

#include "astbranch.h"

class Runner
{
public:
	Runner( class Ast &rAst, class Context &rCont );
	virtual ~Runner();

	/**
	 * Run through and pull out all of the functions.  Maybe more later.
	 */
	void initialize();
	class Variable execExpr( AstBranch::NodeList::const_iterator e );
	class Variable execExpr( AstBranch::NodeList::const_iterator e,
			const class Variable &vIn );
	void run();
	Variable run( AstBranch::NodeList::const_iterator n );
	class Variable execFunc( const class AstBranch *pFunc,
			class Variable &vIn );
	void execProfile( class Target *pTarget, const Bu::FString &sProfile );
	void execAction( const Bu::FString &sName );

	Context &getContext();

private:
	class Target *buildTarget( const Bu::FString &sOutput,
			AstBranch::NodeList::const_iterator n );
	class Rule *buildRule( const Bu::FString &sName,
			AstBranch::NodeList::const_iterator n );
	void attachDefaults();
	Variable doSet( const AstBranch *pRoot );

private:
	class Ast &rAst;
	class Context &rCont;
	Target *pCurTarget;
	Rule *pCurRule;
};

#endif