[DEBUG] correct pattern

This commit is contained in:
2017-11-06 14:07:04 +01:00
parent 40339d34bd
commit 735bfbc9e9
21 changed files with 40 additions and 27 deletions

View File

@@ -55,6 +55,11 @@ void appl::Highlight::init(const etk::String& _xmlFilename, const etk::String& _
//HL_DEBUG("(l %d) node fined : %s=\"%s\"", child->Row(), child->Value() , myData);
m_listExtentions.pushBack(myData);
}
} else if (child.getValue() == "file") {
etk::String myData = child.getText();
if (myData.size()!=0) {
m_listFiles.pushBack(myData);
}
} else if (child.getValue() == "pass1") {
// get sub Nodes ...
for (const auto it2 : child.nodes) {
@@ -112,35 +117,39 @@ void appl::Highlight::init(const etk::String& _xmlFilename, const etk::String& _
}
appl::Highlight::~Highlight() {
// clear the compleate list
m_listHighlightPass1.clear();
// clear the compleate list
m_listHighlightPass2.clear();
// clear the compleate list
m_listExtentions.clear();
m_listFiles.clear();
}
bool appl::Highlight::isCompatible(const etk::String& _name) {
etk::String extention = _name.extract(_name.rfind('.')+1);
for (auto &it : m_listExtentions) {
APPL_WARNING(" check : " << it << "=?=" << _name);
APPL_WARNING(" check : " << it << "=?=" << extention);
etk::RegEx<etk::String> regex;
regex.compile(it);
if (regex.getStatus() == false) {
APPL_ERROR("can not parse regex: " << it);
continue;
}
if (regex.parse(_name, 0, _name.size()) == false) {
if (regex.parse(extention, 0, extention.size()) == false) {
continue;
}
APPL_WARNING(" - begin=" << regex.start() << " end=" << regex.stop());
if (regex.start() != 0) {
continue;
}
if (regex.stop() != _name.size()) {
if (regex.stop() != extention.size()) {
continue;
}
return true;
}
for (auto &it : m_listFiles) {
if (_name == it) {
return true;
}
}
return false;
}
@@ -169,6 +178,9 @@ void appl::Highlight::display() {
for (auto &it : m_listExtentions) {
APPL_INFO(" Extention : " << it );
}
for (auto &it : m_listFiles) {
APPL_INFO(" File : " << it );
}
// display all elements
for (auto &it : m_listHighlightPass1) {
APPL_INFO(" Pass 1 : " << it.getName() );

View File

@@ -65,6 +65,7 @@ namespace appl {
private:
etk::String m_styleName; //!< curent style name (like "c++" or "c" or "script Bash")
etk::Vector<etk::String> m_listExtentions; //!< List of possible extention for this high-light, like : ".c", ".cpp", ".h"
etk::Vector<etk::String> m_listFiles; //!< List of possible filename
etk::Vector<HighlightPattern> m_listHighlightPass1; //!< List of ALL hightlight modules (pass 1 == > when we load and wride data on the buffer)
etk::Vector<HighlightPattern> m_listHighlightPass2; //!< List of ALL hightlight modules (pass 2 == > When we display the buffer( only the display area (100 lines)) )
// TODO : This is bad ==> the patern ar unordered ...

View File

@@ -173,7 +173,7 @@ bool appl::HighlightPattern::find(int32_t _start,
_start++;
}
_resultat.stop = _stop;
_resultat.notEnded = true; // TODO : Manege back the not ended ...
_resultat.notEnded = true; // TODO : Manage back the not ended ...
return false;
}
return true;