Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members

lexer.h

00001 /***************************************************************************
00002                           lexer.h  -  represents a scintilla lexer
00003                              -------------------
00004     begin                : Sam, 22 Feb 2003
00005     copyright            : (C) 2003 by Heiko Köhler
00006     email                : heicom@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017  
00018 #ifndef __LEXER_H__
00019 #define __LEXER_H__
00020 
00021 #include <map>
00022 #include <string>
00023 #include <vector>
00024 #include <list>
00025 #include <qstringlist.h>
00026 #include <qextscintilla.h>
00027 #include "py_config.h"
00028 
00029 namespace Config{
00030 
00031 class LexerManager;
00033 class Lexer
00034 {
00035     friend class LexerManager;
00036 public:
00038     Lexer(int scintillaID, char*name);
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 setFileExtensions( QString fileExt );
00049     void setLangName(const char* name) { lang_name=name; }
00051     const char* langName() { return lang_name; }
00053     void setStreamComment( QString start, QString end );
00055     void setBlockComment( QString start );
00057     QString streamCommentStart();
00059     QString streamCommentEnd();
00061     QString blockCommentStart();
00062 private:
00064     std::map<std::string, int> property_names;
00066     std::vector<const char*> keywords;
00068     const char *lang_name;
00070     int lexerID;
00072     ConfigModule configModule;
00074     QStringList fileExtensions;
00076     QFont defaultFont;
00077 };
00078 
00080 class LexerManager
00081 {
00082 public:
00084     static Lexer *lexer(int);
00086     static Lexer *lexer(const char *filename);
00088     static Lexer *lexerByLang(const char* name);
00090     static std::list<std::string> langStringList();
00092     static void addLexer(Lexer*);
00094     static void initLexers();
00095 private:
00097     static std::map<int, Lexer*> lexers;
00099     static std::list<Lexer*> lexer_list;
00100 };
00101 
00102 }   // namespace Config
00103 
00104 #endif

Generated on Sun May 2 20:02:57 2004 by doxygen 1.3.2