00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __LEXER_H__
00018 #define __LEXER_H__
00019
00020 #include <map>
00021 #include <string>
00022 #include <vector>
00023 #include <list>
00024 #include <qextscintilla.h>
00025 #include "py_config.h"
00026
00027 namespace Config{
00028
00029 class LexerManager;
00031 class Lexer
00032 {
00033 friend class LexerManager;
00034 public:
00036 Lexer(int scintillaID, char*name);
00038 void setFileExt( const char** );
00040 void initScintilla(QextScintilla *sc);
00042 void addProperty(std::string name, int scintillaID, int fore, char *font=0, int size=0,
00043 bool bold=false, bool italic=false, bool underline=false, int back=0, bool filleol=false);
00045 void addKeywords(const char *keyWordList);
00047 void setLangName(const char* name) { lang_name=name; }
00049 const char* langName() { return lang_name; }
00051 void setStreamComment( QString start, QString end );
00053 void setBlockComment( QString start );
00055 QString streamCommentStart();
00057 QString streamCommentEnd();
00059 QString blockCommentStart();
00060 private:
00062 std::map<std::string, int> property_names;
00064 std::vector<const char*> keywords;
00066 const char **file_ext;
00068 const char *lang_name;
00070 int lexerID;
00072 ConfigModule configModule;
00073 };
00074
00076 class LexerManager
00077 {
00078 public:
00080 static Lexer *lexer(int);
00082 static Lexer *lexer(const char *filename);
00084 static Lexer *lexerByLang(const char* name);
00086 static std::list<std::string> langStringList();
00088 static void addLexer(Lexer*);
00090 static void initLexers();
00091 private:
00093 static std::map<int, Lexer*> lexers;
00095 static std::list<Lexer*> lexer_list;
00096 };
00097
00098 }
00099
00100 #endif