7 #ifndef HIGHLIGHTRULE_H_
8 #define HIGHLIGHTRULE_H_
11 #include <boost/shared_ptr.hpp>
13 #include "highlightstate.h"
17 struct HighlightToken;
21 typedef std::deque<std::string>
ElemList;
86 virtual bool tryToMatch(std::string::const_iterator start,
90 virtual const std::string toString()
const = 0;
109 nextState = _nextState;
116 void addElem(
const std::string &name);
118 const ElemList &getElemList()
const {
122 int getExitLevel()
const {
125 void setExitLevel(
int l) {
129 bool isNested()
const {
132 void setNested(
bool n) {
136 bool getNeedsReferenceReplacement()
const {
140 void setNeedsReferenceReplacement(
bool b =
true) {
141 needsReferenceReplacement = b;
144 bool getHasSubexpressions()
const {
148 void setHasSubexpressions(
bool b =
true) {
149 hasSubexpressions = b;
152 std::string getAdditionalInfo()
const {
156 void setAdditionalInfo(
const std::string &info) {
157 additionalInfo = info;
virtual void replaceReferences(const ReplacementList &rep)=0
Performs replacement of references in this rule.
std::string additionalInfo
additional information about this rule
Definition: highlightrule.h:36
Structure for passing parameters to the matching algorithm, for instance, "not beginning of line"...
Definition: matchingparameters.h:16
bool nested
tells that if this rule matches we must enter the same state once again
Definition: highlightrule.h:43
HighlightStatePtr nextState
if set, it represents the state to enter if this rule matches this class does not delete nextState ...
Definition: highlightrule.h:33
virtual bool tryToMatch(const std::string &s, HighlightToken &token, const MatchingParameters ¶ms)
Try to match this rule against the passed string (implemented by calling the pure virtual function tr...
Definition: highlightrule.cpp:34
C++ class: doctemplate.h.
Definition: bufferedoutput.cpp:13
void addElem(const std::string &name)
Adds an element name to the list of this rule.
Definition: highlightrule.cpp:30
ElemList elemList
the list of program elements detected by this rule
Definition: highlightrule.h:29
Base class for highlight rules.
Definition: highlightrule.h:27
int exitLevel
how many state must we exit if we match this rule: 0: none, -1: all, otherwise the number of states t...
Definition: highlightrule.h:40
boost::shared_ptr< HighlightState > HighlightStatePtr
the reference to an HighlightState
Definition: highlightstate.h:38
std::vector< std::string > ReplacementList
the values for replacing references (it should contain 9 possibly empty elements, because 9 is usuall...
Definition: highlightstate.h:36
Token containing information for performing the highlight.
Definition: highlighttoken.h:33
std::deque< std::string > ElemList
list representing the names of parts of a program
Definition: highlightrule.h:18
virtual HighlightRule * clone()=0
bool needsReferenceReplacement
whether this rule has dynamic references to be replaced
Definition: highlightrule.h:46
bool hasSubexpressions
whether this rule can match subexpressions
Definition: highlightrule.h:49