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;
11 class compilerprocessor;
13 
63 class RUDIMENTS_DLLSPEC compiler {
64  public:
65 
68 
70  virtual ~compiler();
71 
72 
75  void appendModulePath(const char *path);
76 
79 
82 
83 
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 
112 
115 
116 
117 
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 
146 
149 
150 
151 
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 
180 
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:
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 
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:
305 
308 
313  virtual bool process(const char *input,
315  domnode *metadata)=0;
316 };
317 
318 
326 class RUDIMENTS_DLLSPEC compilerprocessor : public compilermodule {
327  public:
330 
333 
338  virtual bool process(domnode *tree,
339  domnode *metadata)=0;
340 };
341 
342 
351 class RUDIMENTS_DLLSPEC compilerpostprocessor : public compilermodule {
352  public:
356 
359 
364  virtual bool process(const char *input,
366  domnode *metadata)=0;
367 };
368 
369 #endif
Definition: compiler.h:63
void clearModulePaths()
void setMetaData(domnode *metadata)
linkedlist< compilermodule * > * getPreProcessors()
bool setOutputGrammar(const char *grammar)
const char * getError()
void clearPreProcessors()
bool appendPostProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
bool appendPreProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
bool process(domnode *root)
bool appendPreProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
linkedlist< compilermodule * > * getPostProcessors()
bool appendPostProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
void clearPostProcessors()
virtual ~compiler()
void appendPostProcessor(compilerpostprocessor *module)
linkedlist< char * > * getModulePaths()
bool appendProcessor(const char *filename, const char *classname, const char *id, const char *parameters)
void setDebugLevel(uint8_t debuglevel)
void clearProcessors()
bool appendProcessor(const char *filename, const char *classname, const char *id, domnode *parameters)
void appendProcessor(compilerprocessor *module)
bool setInputGrammar(const char *grammar, const char *startsymbol)
bool compile(const char *input, stringbuffer *output)
void appendModulePath(const char *path)
void appendPreProcessor(compilerpreprocessor *module)
linkedlist< compilermodule * > * getProcessors()
Definition: compiler.h:262
domnode * getParameters()
bool setParameters(const char *parameters)
const char * getId()
virtual ~compilermodule()
void setId(const char *id)
void setParameters(domnode *parameters)
Definition: compiler.h:351
virtual bool process(const char *input, stringbuffer *output, domnode *metadata)=0
virtual ~compilerpostprocessor()
Definition: compiler.h:301
virtual ~compilerpreprocessor()
virtual bool process(const char *input, stringbuffer *output, domnode *metadata)=0
Definition: compiler.h:326
virtual ~compilerprocessor()
virtual bool process(domnode *tree, domnode *metadata)=0
Definition: dom.h:10
Definition: domnode.h:122
Definition: input.h:9
Definition: linkedlist.h:60
Definition: output.h:9
Definition: stringbuffer.h:13