compiler.h
// Copyright (c) 2015 David Muse
// See the COPYING file for more information.
#ifndef RUDIMENTS_COMPILER_H
#define RUDIMENTS_COMPILER_H
#include <rudiments/private/compilerincludes.h>
class compilerprivate;
class compilermodule;
class compilerpreprocessor;
class compilerprocessor;
class compilerpostprocessor;
class RUDIMENTS_DLLSPEC compiler {
public:
compiler();
virtual ~compiler();
void appendModulePath(const char *path);
void clearModulePaths();
linkedlist< char * > *getModulePaths();
void appendPreProcessor(compilerpreprocessor *module);
bool appendPreProcessor(const char *filename,
const char *classname,
const char *id,
xmldomnode *parameters);
bool appendPreProcessor(const char *filename,
const char *classname,
const char *id,
const char *parameters);
void clearPreProcessors();
linkedlist< compilermodule * > *getPreProcessors();
void appendProcessor(compilerprocessor *module);
bool appendProcessor(const char *filename,
const char *classname,
const char *id,
xmldomnode *parameters);
bool appendProcessor(const char *filename,
const char *classname,
const char *id,
const char *parameters);
void clearProcessors();
linkedlist< compilermodule * > *getProcessors();
void appendPostProcessor(compilerpostprocessor *module);
bool appendPostProcessor(const char *filename,
const char *classname,
const char *id,
xmldomnode *parameters);
bool appendPostProcessor(const char *filename,
const char *classname,
const char *id,
const char *parameters);
void clearPostProcessors();
linkedlist< compilermodule * > *getPostProcessors();
bool setInputGrammar(const char *grammar,
const char *startsymbol);
bool setOutputGrammar(const char *grammar);
void setMetaData(xmldomnode *metadata);
bool compile(const char *input, stringbuffer *output);
bool process(xmldomnode *root);
const char *getError();
void setDebugLevel(uint8_t debuglevel);
#include <rudiments/private/compiler.h>
};
class RUDIMENTS_DLLSPEC compilermodule {
public:
compilermodule();
virtual ~compilermodule();
void setId(const char *id);
bool setParameters(const char *parameters);
void setParameters(xmldomnode *parameters);
const char *getId();
xmldomnode *getParameters();
protected:
const char *id;
xmldomnode *parameters;
private:
xmldom *xmld;
};
class RUDIMENTS_DLLSPEC compilerpreprocessor : public compilermodule {
public:
compilerpreprocessor();
virtual ~compilerpreprocessor();
virtual bool process(const char *input,
stringbuffer *output,
xmldomnode *metadata)=0;
};
class RUDIMENTS_DLLSPEC compilerprocessor : public compilermodule {
public:
compilerprocessor();
virtual ~compilerprocessor();
virtual bool process(xmldomnode *tree,
xmldomnode *metadata)=0;
};
class RUDIMENTS_DLLSPEC compilerpostprocessor : public compilermodule {
public:
compilerpostprocessor();
virtual ~compilerpostprocessor();
virtual bool process(const char *input,
stringbuffer *output,
xmldomnode *metadata)=0;
};
#endif
xmldomnode
Definition: xmldomnode.h:123
linkedlist
Definition: linkedlist.h:60
stringbuffer
Definition: stringbuffer.h:22
compilerprocessor
Definition: compiler.h:327
process
Definition: process.h:19
compilerpostprocessor
Definition: compiler.h:352
compiler
Definition: compiler.h:64
compilermodule
Definition: compiler.h:263
compilerpreprocessor
Definition: compiler.h:302
xmldom
Definition: xmldom.h:12