Base class for highlight rules.
More...
#include <highlightrule.h>
|
| HighlightRule (const std::string &name) |
| Creates a rule for the given element (Although each rule can concern more than one program element, we provide only this convenience constructor with only one name: if the rule concerns more than one element one can use addElem method) More...
|
|
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 tryToMatch below). More...
|
|
virtual bool | tryToMatch (std::string::const_iterator start, std::string::const_iterator end, HighlightToken &token, const MatchingParameters ¶ms)=0 |
| Try to match this rule against the passed string. More...
|
|
virtual const std::string | toString () const =0 |
|
virtual void | replaceReferences (const ReplacementList &rep)=0 |
| Performs replacement of references in this rule. More...
|
|
virtual HighlightRule * | clone ()=0 |
|
const HighlightStatePtr | getNextState () const |
|
void | setNextState (HighlightStatePtr _nextState) |
|
void | addElem (const std::string &name) |
| Adds an element name to the list of this rule. More...
|
|
const ElemList & | getElemList () const |
|
int | getExitLevel () const |
|
void | setExitLevel (int l) |
|
bool | isNested () const |
|
void | setNested (bool n) |
|
bool | getNeedsReferenceReplacement () const |
|
void | setNeedsReferenceReplacement (bool b=true) |
|
bool | getHasSubexpressions () const |
|
void | setHasSubexpressions (bool b=true) |
|
std::string | getAdditionalInfo () const |
|
void | setAdditionalInfo (const std::string &info) |
|
|
ElemList | elemList |
| the list of program elements detected by this rule
|
|
HighlightStatePtr | nextState |
| if set, it represents the state to enter if this rule matches this class does not delete nextState
|
|
std::string | additionalInfo |
| additional information about this rule
|
|
int | exitLevel |
| how many state must we exit if we match this rule: 0: none, -1: all, otherwise the number of states to exit
|
|
bool | nested |
| tells that if this rule matches we must enter the same state once again
|
|
bool | needsReferenceReplacement |
| whether this rule has dynamic references to be replaced
|
|
bool | hasSubexpressions |
| whether this rule can match subexpressions
|
|
Base class for highlight rules.
This abstracts from the actual implementation for matching.
srchilite::HighlightRule::HighlightRule |
( |
const std::string & |
name | ) |
|
Creates a rule for the given element (Although each rule can concern more than one program element, we provide only this convenience constructor with only one name: if the rule concerns more than one element one can use addElem method)
- Parameters
-
name | the element name of this rule |
void srchilite::HighlightRule::addElem |
( |
const std::string & |
name | ) |
|
Adds an element name to the list of this rule.
- Parameters
-
virtual void srchilite::HighlightRule::replaceReferences |
( |
const ReplacementList & |
rep | ) |
|
|
pure virtual |
Performs replacement of references in this rule.
- Parameters
-
the | list of values for the replacement; the first element is the value for replacing the first dynamic back reference, and so on. (it should contain 9 possibly empty elements) |
Implemented in srchilite::RegexHighlightRule.
Try to match this rule against the passed string (implemented by calling the pure virtual function tryToMatch below).
The passed token is assumed to be reset (i.e., no existing matching information is stored in it when passing it to this method).
- Parameters
-
s | the string for trying to match the rule |
token | where results will be inserted, if the rule matched |
params | additional arguments for the matching |
- Returns
- the result of this matching
virtual bool srchilite::HighlightRule::tryToMatch |
( |
std::string::const_iterator |
start, |
|
|
std::string::const_iterator |
end, |
|
|
HighlightToken & |
token, |
|
|
const MatchingParameters & |
params |
|
) |
| |
|
pure virtual |
Try to match this rule against the passed string.
- Parameters
-
start | the beginning of the string for trying to match the rule |
end | the beginning of the string for trying to match the rule |
token | where results will be inserted, if the rule matched |
params | additional arguments for the matching |
- Returns
- the result of this matching
Implemented in srchilite::RegexHighlightRule.
The documentation for this class was generated from the following files:
- /home/bettini/work/source-highlight/src-highlite/lib/srchilite/highlightrule.h
- /home/bettini/work/source-highlight/src-highlite/lib/srchilite/highlightrule.cpp