aboutsummaryrefslogtreecommitdiff
path: root/src/buildparser.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-12-21 18:03:28 +0000
committerMike Buland <eichlan@xagasoft.com>2009-12-21 18:03:28 +0000
commit51e21a316be6e052251b3dfc7d671061ebd67cee (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/buildparser.h
parentad6f4dfcc671d3f8d458c42b0992956f2a2cf979 (diff)
downloadbuild-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.gz
build-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.bz2
build-51e21a316be6e052251b3dfc7d671061ebd67cee.tar.xz
build-51e21a316be6e052251b3dfc7d671061ebd67cee.zip
Removed the old trunk contents. About to load up m3
Diffstat (limited to '')
-rw-r--r--src/buildparser.h192
1 files changed, 0 insertions, 192 deletions
diff --git a/src/buildparser.h b/src/buildparser.h
deleted file mode 100644
index 516760c..0000000
--- a/src/buildparser.h
+++ /dev/null
@@ -1,192 +0,0 @@
1#ifndef BUILDER_H
2#define BUILDER_H
3
4#include <stdint.h>
5#include <string>
6#include <list>
7#include <utility>
8#include <map>
9#include "build.tab.h"
10#include "parser.h"
11
12class Build;
13class BuildParser;
14class Function;
15class FunctionFactory;
16class Perform;
17class PerformFactory;
18class Target;
19class TargetFactory;
20
21#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, BuildParser &bld )
22YY_DECL;
23
24typedef std::list<std::string> StringList;
25typedef std::list<Function *> FunctionList;
26typedef std::list<Perform *> PerformList;
27typedef std::map<std::string,std::string> VarMap;
28
29template<class tx, class ty, class tz>
30class Triplet
31{
32public:
33 Triplet( const tx &x, const ty &y, const tz &z ) :
34 first( x ), second( y ), third( z )
35 {}
36
37 Triplet( const Triplet &src ) :
38 first( src.first ), second( src.second ), third( src.third )
39 {}
40
41 tx first;
42 ty second;
43 tz third;
44};
45
46enum eSetHow
47{
48 setSet,
49 setAdd
50};
51
52class BuildParser : public Parser
53{
54 typedef std::pair<std::string, Function *> BuildListItem;
55 typedef std::list<BuildListItem> BuildListCore;
56 typedef std::pair<BuildListCore, Function *> BuildList;
57 typedef Triplet<std::string, std::string, int> SetVar;
58 typedef std::list<SetVar> SetVarList;
59public:
60 BuildParser();
61 virtual ~BuildParser();
62
63 Build *load( const std::string &sFile );
64
65private:
66 void scanBegin();
67 void scanEnd();
68
69 Build *genBuild();
70
71public: // Target functions
72 bool isTarget( const char *sType );
73 void newTarget();
74 void setTargetRule( const char *sRule );
75 void setTargetPrefix( const char *sPrefix );
76 void setTargetType( const char *sType );
77 void addTargetInput();
78 void addTargetRequires();
79 void addTargetSet( const char *sVar, const char *sVal, int nHow );
80 void addTargetGroup( const char *sGroup );
81
82private: // Target variables
83 TargetFactory &fTarget;
84 class TargetInfo
85 {
86 public:
87 std::string sRule;
88 std::string sPrefix;
89 std::string sType;
90 BuildList lInput;
91 BuildList lRequires;
92 StringList lGroups;
93 SetVarList lVar;
94 };
95 typedef std::pair<BuildList,TargetInfo> TargetTmp;
96 typedef std::list<TargetTmp> TargetTmpList;
97 TargetTmpList lTargetTmp;
98
99public: // Function functions
100 bool isFunction( const char *sFunc );
101 void newFunctionCall( const char *sName );
102 void addFunctionParam( const char *sParam );
103
104private: // Function variables
105 Function *pTmpFunc;
106 FunctionFactory &fFunction;
107
108public: // Perform functions
109 bool isPerform( const char *sPerf );
110 void newPerform( const char *sName );
111 void addPerformParam( const char *sParam );
112
113private: // Perform variables
114 Perform *pTmpPerform;
115 PerformFactory &fPerform;
116
117public: // List functions
118 void newList();
119 void addListString( const char *str );
120 void addListFunc();
121 void filterList();
122
123 void buildListFilter( BuildList &lSrc );
124 StringList buildToStringList( const BuildList &lSrc, const StringList &lIn, Build *pPass=NULL );
125 StringList buildToStringListDup( const BuildList &lSrc, const StringList &lIn, Build &bld, const std::string &sCont, VarMap *mExtra, Build *pPass=NULL );
126
127private: // List variables
128 BuildList lTmp;
129
130public: // Rules functions
131 void addRule( const char *sName );
132 void addRuleMatches();
133 void addRuleProduces();
134 void addRuleRequires();
135 void addRuleInputFilter();
136 void addRulePerform();
137 void setRuleAggregate();
138
139private: // Rule variables
140 class RuleInfo
141 {
142 public:
143 std::string sName;
144 Function *pMatches;
145 BuildList lProduces;
146 BuildList lRequires;
147 FunctionList lFilter;
148 PerformList lPerform;
149 Function *pAggregate;
150 };
151
152 typedef std::list<RuleInfo> RuleTmpList;
153 RuleTmpList lRuleTmp;
154
155public: // Action functions
156 void addAction();
157 void addAction( const char *sName );
158 void addCommand( int nType );
159 void addGrpCommand( const char *sGroup, int nType );
160
161private: // Action variables
162 typedef struct ActionTmpCmd
163 {
164 ActionTmpCmd( int nAct, BuildList &l ) :
165 nAct( nAct ), bGroup( false ), lCmds( l ) { };
166 ActionTmpCmd( int nAct, const char *s ) :
167 nAct( nAct ), bGroup( true ), sGroup( s ) { };
168 int nAct;
169 bool bGroup;
170 BuildList lCmds;
171 std::string sGroup;
172 } ActionTmpCmd;
173 //typedef std::pair<int, BuildList> ActionTmpCmd;
174 //typedef std::pair<int, std::string> ActionTmpGrpCmd
175 typedef std::list<ActionTmpCmd> ActionTmpCmdList;
176 //typedef std::list<ActionTmpGrpCmd> ActionTmpGrpCmdList;
177 typedef std::pair<std::string, ActionTmpCmdList> ActionTmp;
178 typedef std::list<ActionTmp> ActionTmpList;
179 ActionTmpList lActions;
180
181public: // Global variable functions
182 void addGlobalSet( const char *sVar, const char *sValue, int nHow );
183
184private: // Global variable variables
185 SetVarList lGlobalVars;
186
187public: // Debug
188 void debugDump();
189 void printBuildList( const BuildList &lst );
190};
191
192#endif