[DEBUG] correct pattern

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

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Assembleur">
<ext>.*\.(s|S|asm|ASM)</ext>
<ext>(s|S|asm|ASM)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Bash script">
<ext>.*\.sh</ext>
<ext>(sh|bash|zsh)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="first line">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Boulou log">
<ext>.*\.(boo|BOO)</ext>
<ext>(boo|BOO)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="comment ##">
<color>SYNTAX_ERROR</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C">
<ext>.*\.(c|C|m|M)</ext>
<ext>(c|C|m|M)</ext>
<!--might be : <ext>.*\.(c|h|m)</ext>-->
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="cmake">
<ext>CMakeLists.txt</ext>
<ext>CMakeCache.txt</ext>
<file>CMakeLists.txt</file>
<file>CMakeCache.txt</file>
<pass1>
<rule name="my comment doxygen">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="C++">
<ext>.*\.(cpp|CPP|cxx|CXX|cc|CC|hpp|HPP|hxx|HXX|hh|h|H|mm|MM|c\+\+|C\+\+|m\+\+|M\+\+|mpp|MPP)</ext>
<ext>(cpp|CPP|cxx|CXX|cc|CC|hpp|HPP|hxx|HXX|hh|h|H|mm|MM|c\+\+|C\+\+|m\+\+|M\+\+|mpp|MPP)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="gcov">
<ext>.*\.(gcov)</ext>
<ext>(gcov)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Not parsed">
<color>normal</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Glsl">
<ext>.*\.(glsl|vert|frag|prog)</ext>
<ext>(glsl|vert|frag|prog)</ext>
<pass1>
<rule name="my comment multiline doxygen">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Kernel conf file">
<ext>.*\.in</ext>
<ext>in</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur">
<color>preprocesseur</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Java">
<ext>.*\.(java|JAVA)</ext>
<ext>(java|JAVA)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Json">
<ext>.*\.(json|JSON)</ext>
<ext>(json|JSON)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doubleQuteText">
<color>doubleQuoteText</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Lua">
<ext>.*\.lua</ext>
<ext>lua</ext>
<pass1>
<rule name="Comment multiline">
<color>comment</color>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Makefiles">
<ext>Makefile</ext>
<ext>.*\.(mk|global)</ext>
<file>Makefile</file>
<ext>(mk|global)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my preprocesseur">
<color>preprocesseur</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Matlab">
<ext>.*\.(m|M)</ext>
<ext>(m|M)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment doxygen">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="PHP">
<ext>.*\.(php(3|4|5|6|7|8)|PHP(3|4|5|6|7|8)|phtml|php|PHP)</ext>
<ext>(php(3|4|5|6|7|8)|PHP(3|4|5|6|7|8)|phtml|php|PHP)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="doxygen multiline">
<color>commentDoxygen</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Python">
<ext>.*\.(py|PY)</ext>
<ext>(py|PY)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="my comment multiline">
<color>comment</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.2" lang="XML">
<ext>.*\.(xml|XML|svg|SVG|html|HTML|htm|HTM|tpl|TPL)</ext>
<ext>(xml|XML|svg|SVG|html|HTML|htm|HTM|tpl|TPL)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="Comment">
<color>comment</color>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<EdnLang version="0.1" lang="Zeus-IDL">
<ext>.*\.zeus\.idl</ext>
<ext>(zeus|idl)</ext>
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
<rule name="comment multiline">
<color>comment</color>

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;