| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef PARSER_H |
| 23 |
#define PARSER_H |
| 24 |
|
| 25 |
#include <QObject> |
| 26 |
#include <QTextStream> |
| 27 |
#include <QByteArray> |
| 28 |
#include "../common.h" |
| 29 |
|
| 30 |
class QString; |
| 31 |
class Symbol; |
| 32 |
|
| 33 |
class Parser: public QObject { |
| 34 |
Q_OBJECT |
| 35 |
public: |
| 36 |
Parser(); |
| 37 |
virtual ~Parser(); |
| 38 |
|
| 39 |
void run(char *textBuf, int textBufLen, Symbol *symbols); |
| 40 |
void stop(); |
| 41 |
|
| 42 |
Language language() const { return mLanguage; }; |
| 43 |
void setLanguage(Language value) { mLanguage = value; }; |
| 44 |
|
| 45 |
protected: |
| 46 |
int fileGetc(); |
| 47 |
void fileUngetc(int c); |
| 48 |
const char *fileReadLine(); |
| 49 |
void resetText(); |
| 50 |
|
| 51 |
unsigned long getSourceLineNumber(); |
| 52 |
unsigned long getInputLineNumber() ; |
| 53 |
|
| 54 |
virtual void parse()=0; |
| 55 |
|
| 56 |
Symbol *mSymbols; |
| 57 |
|
| 58 |
private: |
| 59 |
Language mLanguage; |
| 60 |
int mUngetChar; |
| 61 |
char *mTextBuf; |
| 62 |
char *mTextBufEnd; |
| 63 |
|
| 64 |
char *mCurPos; |
| 65 |
char *mRChar; |
| 66 |
char *mNChar; |
| 67 |
bool mStopped; |
| 68 |
unsigned long mLineNum; |
| 69 |
}; |
| 70 |
|
| 71 |
|
| 72 |
typedef struct sKindOption { |
| 73 |
bool enabled; |
| 74 |
int letter; |
| 75 |
const char* name; |
| 76 |
const char* description; |
| 77 |
} kindOption; |
| 78 |
|
| 79 |
#endif |