Source-highlight Library
|
00001 // 00002 // Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 1999-2009 00003 // 00004 // Copyright: See COPYING file that comes with this distribution 00005 // 00006 00007 #ifndef LANGELEM_H 00008 #define LANGELEM_H 00009 00010 #include "parserinfo.h" 00011 00012 namespace srchilite { 00013 00017 // doublecpp: forward declarations, DO NOT MODIFY 00018 class HighlightState; // file: highlightstate.h 00019 class HighlightStateBuilder; // file: highlightstatebuilder.h 00020 class LangElemsPrinter; // file: langelemsprinter.h 00021 // doublecpp: end, DO NOT MODIFY 00022 00023 class LangElem : public ParserInfo 00024 { 00025 private: 00027 const std::string name; 00029 bool redef; 00030 // whether this substitutes an existing language element 00031 bool subst; 00032 00033 public: 00034 LangElem(const std::string &n) : 00035 name(n), redef(false), subst(false) { 00036 } 00037 00038 virtual ~LangElem() { 00039 } 00040 00041 const std::string getName() const { 00042 return name; 00043 } 00044 00049 virtual const std::string toString() const { 00050 return name; 00051 } 00052 00058 virtual const std::string toStringOriginal() const = 0; 00059 00060 bool isRedef() const { 00061 return redef; 00062 } 00063 void setRedef() { 00064 redef = true; 00065 } 00066 bool isSubst() const { 00067 return subst; 00068 } 00069 void setSubst() { 00070 subst = true; 00071 } 00072 00076 const std::string toStringParserInfo() const; 00077 00078 // doublecpp: dispatch methods, DO NOT MODIFY 00079 public: 00080 virtual void dispatch_build(HighlightStateBuilder *, HighlightState * state); 00081 virtual void dispatch_collect_const(LangElemsPrinter *); 00082 // doublecpp: end, DO NOT MODIFY 00083 }; 00084 00085 } 00086 00087 #endif