Rudiments

compiler.h
1 // Copyright (c) 1999-2018 David Muse
2 // See the COPYING file for more information.
3
4 #ifndef RUDIMENTS_COMPILER_H
5 #define RUDIMENTS_COMPILER_H
6
7 #include <rudiments/private/compilerincludes.h>
8
9 class compilermodule;
10 class compilerpreprocessor;
11 class compilerprocessor;
12 class compilerpostprocessor;
13
63 class RUDIMENTS_DLLSPEC compiler {
64 public:
65
67 compiler();
68
70 virtual ~compiler();
71
72
75 void appendModulePath(const char *path);
76
78 void clearModulePaths();
79
81 linkedlist< char * > *getModulePaths();
82
83
86 void appendPreProcessor(compilerpreprocessor *module);
87
94 bool appendPreProcessor(const char *filename,
95 const char *classname,
96 const char *id,
97 domnode *parameters);
98
105 bool appendPreProcessor(const char *filename,
106 const char *classname,
107 const char *id,
108 const char *parameters);
109
111 void clearPreProcessors();
112
114 linkedlist< compilermodule * > *getPreProcessors();
115
116
117
120 void appendProcessor(compilerprocessor *module);
121
128 bool appendProcessor(const char *filename,
129 const char *classname,
130 const char *id,
131 domnode *parameters);
132
139 bool appendProcessor(const char *filename,
140 const char *classname,
141 const char *id,
142 const char *parameters);
143
145 void clearProcessors();
146
148 linkedlist< compilermodule * > *getProcessors();
149
150
151
154 void appendPostProcessor(compilerpostprocessor *module);
155
162 bool appendPostProcessor(const char *filename,
163 const char *classname,
164 const char *id,
165 domnode *parameters);
166
173 bool appendPostProcessor(const char *filename,
174 const char *classname,
175 const char *id,
176 const char *parameters);
177
179 void clearPostProcessors();
180
182 linkedlist< compilermodule * > *getPostProcessors();
183
184
185
189 bool setInputGrammar(const char *grammar,
190 const char *startsymbol);
191
194 bool setOutputGrammar(const char *grammar);
195
196
197
212 void setMetaData(domnode *metadata);
213
214
230 bool compile(const char *input, stringbuffer *output);
231
232
244 bool process(domnode *root);
245
246
248 const char *getError();
249
250
252 void setDebugLevel(uint8_t debuglevel);
253
254 #include <rudiments/private/compiler.h>
255 };
256
257
258
262 class RUDIMENTS_DLLSPEC compilermodule {
263 public:
265 compilermodule();
266
268 virtual ~compilermodule();
269
271 void setId(const char *id);
272
274 bool setParameters(const char *parameters);
275
277 void setParameters(domnode *parameters);
278
280 const char *getId();
281
283 domnode *getParameters();
284
285 protected:
286 const char *id;
287 domnode *parameters;
288
289 private:
290 dom *xmld;
291 };
292
293
301 class RUDIMENTS_DLLSPEC compilerpreprocessor : public compilermodule {
302 public:
304 compilerpreprocessor();
305
307 virtual ~compilerpreprocessor();
308
313 virtual bool process(const char *input,
314 stringbuffer *output,
315 domnode *metadata)=0;
316 };
317
318
326 class RUDIMENTS_DLLSPEC compilerprocessor : public compilermodule {
327 public:
329 compilerprocessor();
330
332 virtual ~compilerprocessor();
333
338 virtual bool process(domnode *tree,
339 domnode *metadata)=0;
340 };
341
342
351 class RUDIMENTS_DLLSPEC compilerpostprocessor : public compilermodule {
352 public:
355 compilerpostprocessor();
356
358 virtual ~compilerpostprocessor();
359
364 virtual bool process(const char *input,
365 stringbuffer *output,
366 domnode *metadata)=0;
367 };
368
369 #endif
compiler
Definition: compiler.h:63
compiler::clearModulePaths
void clearModulePaths()
compiler::setMetaData
void setMetaData(domnode *metadata)
compiler::getPreProcessors
linkedlist< compilermodule * > * getPreProcessors()
compiler::setOutputGrammar
bool setOutputGrammar(const char *grammar)
compiler::getError
const char * getError()
compiler::clearPreProcessors
void clearPreProcessors()
compiler::appendPostProcessor
bool appendPostProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
compiler::appendPreProcessor
bool appendPreProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
compiler::process
bool process(domnode *root)
compiler::appendPreProcessor
bool appendPreProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
compiler::getPostProcessors
linkedlist< compilermodule * > * getPostProcessors()
compiler::appendPostProcessor
bool appendPostProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
compiler::clearPostProcessors
void clearPostProcessors()
compiler::~compiler
virtual ~compiler()
compiler::appendPostProcessor
void appendPostProcessor(compilerpostprocessor *module)
compiler::getModulePaths
linkedlist< char * > * getModulePaths()
compiler::appendProcessor
bool appendProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
compiler::setDebugLevel
void setDebugLevel(uint8_t debuglevel)
compiler::clearProcessors
void clearProcessors()
compiler::appendProcessor
bool appendProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
compiler::appendProcessor
void appendProcessor(compilerprocessor *module)
compiler::setInputGrammar
bool setInputGrammar(const char *grammar, const char *startsymbol)
compiler::compile
bool compile(const char *input, stringbuffer *output)
compiler::appendModulePath
void appendModulePath(const char *path)
compiler::appendPreProcessor
void appendPreProcessor(compilerpreprocessor *module)
compiler::compiler
compiler()
compiler::getProcessors
linkedlist< compilermodule * > * getProcessors()
compilermodule
Definition: compiler.h:262
compilermodule::getParameters
domnode * getParameters()
compilermodule::setParameters
bool setParameters(const char *parameters)
compilermodule::getId
const char * getId()
compilermodule::~compilermodule
virtual ~compilermodule()
compilermodule::setId
void setId(const char *id)
compilermodule::compilermodule
compilermodule()
compilermodule::setParameters
void setParameters(domnode *parameters)
compilerpostprocessor
Definition: compiler.h:351
compilerpostprocessor::compilerpostprocessor
compilerpostprocessor()
compilerpostprocessor::process
virtual bool process(const char *input, stringbuffer *output, domnode *metadata)=0
compilerpostprocessor::~compilerpostprocessor
virtual ~compilerpostprocessor()
compilerpreprocessor
Definition: compiler.h:301
compilerpreprocessor::compilerpreprocessor
compilerpreprocessor()
compilerpreprocessor::~compilerpreprocessor
virtual ~compilerpreprocessor()
compilerpreprocessor::process
virtual bool process(const char *input, stringbuffer *output, domnode *metadata)=0
compilerprocessor
Definition: compiler.h:326
compilerprocessor::~compilerprocessor
virtual ~compilerprocessor()
compilerprocessor::process
virtual bool process(domnode *tree, domnode *metadata)=0
compilerprocessor::compilerprocessor
compilerprocessor()
dom
Definition: dom.h:10
domnode
Definition: domnode.h:122
input
Definition: input.h:9
linkedlist
Definition: linkedlist.h:60
output
Definition: output.h:9
stringbuffer
Definition: stringbuffer.h:13