aboutsummaryrefslogtreecommitdiff
path: root/src/builder.h
blob: 529edc6e6cde8075333c79d445e70715ffa82e5c (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef BUILDER_H
#define BUILDER_H

#include <stdint.h>
#include <string>
#include "build.tab.h"
#include "exceptions.h"

class Builder;
class Function;
class FunctionFactory;
class Perform;
class PerformFactory;

#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld )
YY_DECL;

subExceptionDecl( BuildException );

class Builder
{
public:
	Builder();
	virtual ~Builder();

	void error( YYLTYPE *locp, const char *msg );
	void error( const std::string &msg );

	void load( const std::string &sFile );

	int getTargetType( const char *sType );

private:
	std::string file;
	void scanBegin();
	void scanEnd();

public: // Function functions
	bool isFunction( const char *sFunc );
	void newFunctionCall( const char *sName );
	void addFunctionParam( const char *sParam );

private: // Function variables
	Function *pTmpFunc;
	FunctionFactory &fFunction;

public: // Perform functions
	bool isPerform( const char *sPerf );
	void newPerform( const char *sName );
	void addPerformParam( const char *sParam );

private: // Perform variables
	Perform *pTmpPerform;
	PerformFactory &fPerform;

public: // List functions
	void newList();
	void addListString( const char *str );
	void addListFunc();

public: // Functions for dealing with rules
	void addAction();
	void addAction( const char *sName );
	void addCommand( int nType );
};

#endif