aboutsummaryrefslogtreecommitdiff
path: root/src/runner.h
blob: 86216ca6b2c58fed8622ae336a926bd861afb6d4 (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
44
45
46
47
48
49
50
/*
 * Copyright (C) 2007-2014 Xagasoft, All rights reserved.
 *
 * This file is part of the Xagasoft Build and is released under the
 * terms of the license contained in the file LICENSE.
 */

#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::String &sProfile );
    void execAction( const Bu::String &sName );

    Context &getContext();

private:
    class Target *buildTarget( const Bu::String &sOutput,
            AstBranch::NodeList::const_iterator n );
    class Rule *buildRule( const Bu::String &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