Source-highlight Library
langelem.h
1//
2// Author: Lorenzo Bettini <http://www.lorenzobettini.it>, (C) 1999-2009
3//
4// Copyright: See COPYING file that comes with this distribution
5//
6
7#ifndef LANGELEM_H
8#define LANGELEM_H
9
10#include "parserinfo.h"
11
12namespace srchilite {
13
17// doublecpp: forward declarations, DO NOT MODIFY
18class HighlightState; // file: highlightstate.h
19class HighlightStateBuilder; // file: highlightstatebuilder.h
20class LangElemsPrinter; // file: langelemsprinter.h
21// doublecpp: end, DO NOT MODIFY
22
23class LangElem : public ParserInfo
24{
25private:
27 const std::string name;
29 bool redef;
30 // whether this substitutes an existing language element
31 bool subst;
32
33public:
34 LangElem(const std::string &n) :
35 name(n), redef(false), subst(false) {
36 }
37
38 virtual ~LangElem() {
39 }
40
41 const std::string getName() const {
42 return name;
43 }
44
49 virtual const std::string toString() const {
50 return name;
51 }
52
58 virtual const std::string toStringOriginal() const = 0;
59
60 bool isRedef() const {
61 return redef;
62 }
63 void setRedef() {
64 redef = true;
65 }
66 bool isSubst() const {
67 return subst;
68 }
69 void setSubst() {
70 subst = true;
71 }
72
76 const std::string toStringParserInfo() const;
77
78// doublecpp: dispatch methods, DO NOT MODIFY
79public:
80virtual void dispatch_build(HighlightStateBuilder *, HighlightState * state);
81virtual void dispatch_collect_const(LangElemsPrinter *);
82// doublecpp: end, DO NOT MODIFY
83};
84
85}
86
87#endif
Definition: langelem.h:24
const std::string toStringParserInfo() const
Definition: langelem.cpp:16
virtual const std::string toString() const
return the string representation (with preprocessing)
Definition: langelem.h:49
const std::string name
the name for this language element
Definition: langelem.h:27
bool redef
whether this redefs an existing language element
Definition: langelem.h:29
virtual const std::string toStringOriginal() const =0
return the original representation (without any preprocessing); this is useful for printing errors
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
Stores information about the file name and the line number of a generic element created during parsin...
Definition: parserinfo.h:23