[DEV] RegExp work correctly, slow, but it is OK
This commit is contained in:
parent
a0bc4f8cc0
commit
d85bd98911
152
etk/RegExp.h
152
etk/RegExp.h
@ -16,12 +16,15 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
//#define TK_REG_EXP_DBG_MODE TK_HIDDEN
|
#define TK_REG_DEBUG TK_HIDDEN
|
||||||
//#define TK_REG_EXP_DBG_MODE TK_VERBOSE
|
//#define TK_REG_DEBUG TK_VERBOSE
|
||||||
#define TK_REG_EXP_DBG_MODE TK_DEBUG
|
//#define TK_REG_DEBUG TK_DEBUG
|
||||||
|
|
||||||
#define TK_REG_EXP_DBG_MODE2 TK_HIDDEN
|
#define TK_REG_DEBUG_3 TK_VERBOSE
|
||||||
//#define TK_REG_EXP_DBG_MODE2 TK_VERBOSE
|
//#define TK_REG_DEBUG_3 TK_DEBUG
|
||||||
|
|
||||||
|
#define TK_REG_DEBUG_2 TK_HIDDEN
|
||||||
|
//#define TK_REG_DEBUG_2 TK_VERBOSE
|
||||||
|
|
||||||
//regular colors
|
//regular colors
|
||||||
#define ETK_BASH_COLOR_BLACK "\e[0;30m"
|
#define ETK_BASH_COLOR_BLACK "\e[0;30m"
|
||||||
@ -356,7 +359,7 @@ template<class CLASS_TYPE> class NodeValue : public Node<CLASS_TYPE> {
|
|||||||
|
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
Node<CLASS_TYPE>::m_regExpData = _data;
|
Node<CLASS_TYPE>::m_regExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse \"Value\" data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
TK_REG_DEBUG("Request Parse \"Value\" data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
||||||
m_data.clear();
|
m_data.clear();
|
||||||
for (int32_t i=0; i<(int64_t)Node<CLASS_TYPE>::m_regExpData.size(); i++) {
|
for (int32_t i=0; i<(int64_t)Node<CLASS_TYPE>::m_regExpData.size(); i++) {
|
||||||
m_data.push_back(Node<CLASS_TYPE>::m_regExpData[i]);
|
m_data.push_back(Node<CLASS_TYPE>::m_regExpData[i]);
|
||||||
@ -364,7 +367,8 @@ template<class CLASS_TYPE> class NodeValue : public Node<CLASS_TYPE> {
|
|||||||
return _data.size();
|
return _data.size();
|
||||||
};
|
};
|
||||||
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
||||||
TK_REG_EXP_DBG_MODE("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " Value{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "} : " << (char)m_data[0]);
|
TK_REG_DEBUG("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " Value{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "} : " << (char)m_data[0]);
|
||||||
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " Value " << _property);
|
||||||
if (m_data.size() == 0) {
|
if (m_data.size() == 0) {
|
||||||
TK_ERROR("No data inside type elemTypeValue");
|
TK_ERROR("No data inside type elemTypeValue");
|
||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
@ -384,7 +388,7 @@ template<class CLASS_TYPE> class NodeValue : public Node<CLASS_TYPE> {
|
|||||||
uint32_t ofset = 0;
|
uint32_t ofset = 0;
|
||||||
int64_t kkk;
|
int64_t kkk;
|
||||||
for (kkk=0; findLen+kkk<_lenMax && kkk < (int64_t)m_data.size(); kkk++) {
|
for (kkk=0; findLen+kkk<_lenMax && kkk < (int64_t)m_data.size(); kkk++) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel)
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel)
|
||||||
<< " check element value : '"
|
<< " check element value : '"
|
||||||
<< etk::regexp::autoStr((char)m_data[kkk])
|
<< etk::regexp::autoStr((char)m_data[kkk])
|
||||||
<< "' ?= '"
|
<< "' ?= '"
|
||||||
@ -411,11 +415,11 @@ template<class CLASS_TYPE> class NodeValue : public Node<CLASS_TYPE> {
|
|||||||
&& _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
&& _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
||||||
&& findLen > 0) {
|
&& findLen > 0) {
|
||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " value find " << _property);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " value find " << _property);
|
||||||
return;
|
return;
|
||||||
} else if (Node<CLASS_TYPE>::m_multipleMin == 0) {
|
} else if (Node<CLASS_TYPE>::m_multipleMin == 0) {
|
||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " value find " << _property);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " value find " << _property);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
@ -465,8 +469,8 @@ template<class CLASS_TYPE> class NodeRangeValue : public Node<CLASS_TYPE> {
|
|||||||
// Truc a faire : multipliciter min, return partiel, et ...
|
// Truc a faire : multipliciter min, return partiel, et ...
|
||||||
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
||||||
int32_t findLen = 0;
|
int32_t findLen = 0;
|
||||||
TK_REG_EXP_DBG_MODE("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << "{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_DEBUG("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << "{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " input property :" << _property);
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " " << _property);
|
||||||
if ( _property.getPositionStop() < 0
|
if ( _property.getPositionStop() < 0
|
||||||
&& Node<CLASS_TYPE>::m_multipleMin == 0
|
&& Node<CLASS_TYPE>::m_multipleMin == 0
|
||||||
&& _property.getMultiplicity() == 0) {
|
&& _property.getMultiplicity() == 0) {
|
||||||
@ -478,8 +482,10 @@ template<class CLASS_TYPE> class NodeRangeValue : public Node<CLASS_TYPE> {
|
|||||||
bool find = false;
|
bool find = false;
|
||||||
// Check range
|
// Check range
|
||||||
for (auto &it : m_rangeList) {
|
for (auto &it : m_rangeList) {
|
||||||
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " range : " << autoStr(it.first) << " < " << autoStr(tmpVal) << " < " << autoStr(it.second));
|
||||||
if ( tmpVal >= it.first
|
if ( tmpVal >= it.first
|
||||||
&& tmpVal <= it.second) {
|
&& tmpVal <= it.second) {
|
||||||
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " OK");
|
||||||
find = true;
|
find = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -487,8 +493,9 @@ template<class CLASS_TYPE> class NodeRangeValue : public Node<CLASS_TYPE> {
|
|||||||
// Check Value
|
// Check Value
|
||||||
if (find == false) {
|
if (find == false) {
|
||||||
for (auto &it : m_dataList) {
|
for (auto &it : m_dataList) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : '" << autoStr(tmpVal) << "'=?='" << autoStr(it) << "'");
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " value : '" << autoStr(tmpVal) << "'=?='" << autoStr(it) << "'");
|
||||||
if (tmpVal == it) {
|
if (tmpVal == it) {
|
||||||
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " OK");
|
||||||
find = true;
|
find = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -500,9 +507,9 @@ template<class CLASS_TYPE> class NodeRangeValue : public Node<CLASS_TYPE> {
|
|||||||
|| ( find == false
|
|| ( find == false
|
||||||
&& m_invert == true) ) {
|
&& m_invert == true) ) {
|
||||||
find = true;
|
find = true;
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : Find (invert=" << m_invert << ")");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : Find (invert=" << m_invert << ")");
|
||||||
} else {
|
} else {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : Not find (invert=" << m_invert << ")");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : Not find (invert=" << m_invert << ")");
|
||||||
find = false;
|
find = false;
|
||||||
}
|
}
|
||||||
if (find == true) {
|
if (find == true) {
|
||||||
@ -543,7 +550,7 @@ template<class CLASS_TYPE> class NodeRangeValue : public Node<CLASS_TYPE> {
|
|||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : out=" << _property);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " " << getDescriptiveName() << " : out=" << _property);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
virtual void display() {
|
virtual void display() {
|
||||||
@ -576,7 +583,7 @@ template<class CLASS_TYPE> class NodeBracket : public NodeRangeValue<CLASS_TYPE>
|
|||||||
}
|
}
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
Node<CLASS_TYPE>::m_regExpData = _data;
|
Node<CLASS_TYPE>::m_regExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse [...] data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
TK_REG_DEBUG("Request Parse [...] data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
||||||
|
|
||||||
char32_t lastElement = 0;
|
char32_t lastElement = 0;
|
||||||
bool multipleElement = false;
|
bool multipleElement = false;
|
||||||
@ -828,7 +835,7 @@ template<class CLASS_TYPE> class NodeSOL : public Node<CLASS_TYPE> {
|
|||||||
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
||||||
int32_t findLen = 0;
|
int32_t findLen = 0;
|
||||||
bool tmpFind = false;
|
bool tmpFind = false;
|
||||||
TK_REG_EXP_DBG_MODE("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " SOL{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_DEBUG("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " SOL{" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
// TODO : is it really what I want ... (maybe next ellement will be requested... (check if previous element is \r or \n
|
// TODO : is it really what I want ... (maybe next ellement will be requested... (check if previous element is \r or \n
|
||||||
while ( _property.getMultiplicity() < Node<CLASS_TYPE>::m_multipleMax
|
while ( _property.getMultiplicity() < Node<CLASS_TYPE>::m_multipleMax
|
||||||
&& tmpFind == true
|
&& tmpFind == true
|
||||||
@ -847,11 +854,11 @@ template<class CLASS_TYPE> class NodeSOL : public Node<CLASS_TYPE> {
|
|||||||
if( _property.getMultiplicity()>=Node<CLASS_TYPE>::m_multipleMin
|
if( _property.getMultiplicity()>=Node<CLASS_TYPE>::m_multipleMin
|
||||||
&& _property.getMultiplicity()<=Node<CLASS_TYPE>::m_multipleMax
|
&& _property.getMultiplicity()<=Node<CLASS_TYPE>::m_multipleMax
|
||||||
&& findLen>0 ) {
|
&& findLen>0 ) {
|
||||||
TK_REG_EXP_DBG_MODE("find " << findLen);
|
TK_REG_DEBUG("find " << findLen);
|
||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
return;
|
return;
|
||||||
} else if( 0 == Node<CLASS_TYPE>::m_multipleMin ) {
|
} else if( 0 == Node<CLASS_TYPE>::m_multipleMin ) {
|
||||||
TK_REG_EXP_DBG_MODE("find size=0");
|
TK_REG_DEBUG("find size=0");
|
||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -907,7 +914,7 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
};
|
};
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
Node<CLASS_TYPE>::m_regExpData = _data;
|
Node<CLASS_TYPE>::m_regExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse (elem) data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
TK_REG_DEBUG("Request Parse (elem) data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
||||||
int64_t pos = 0;
|
int64_t pos = 0;
|
||||||
int64_t elementSize = 0;
|
int64_t elementSize = 0;
|
||||||
std::vector<char32_t> tmpData;
|
std::vector<char32_t> tmpData;
|
||||||
@ -1025,7 +1032,8 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
return _data.size();
|
return _data.size();
|
||||||
};
|
};
|
||||||
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
||||||
TK_REG_EXP_DBG_MODE2("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) data to parse : '" << autoStr(std::string(_data, _currentPos, _lenMax-_currentPos)) << "'");
|
TK_REG_DEBUG_2("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) data to parse : '" << autoStr(std::string(_data, _currentPos, _lenMax-_currentPos)) << "'");
|
||||||
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) " << _property);
|
||||||
int findLen = 0;
|
int findLen = 0;
|
||||||
bool error = false;
|
bool error = false;
|
||||||
size_t iii = 0;
|
size_t iii = 0;
|
||||||
@ -1041,7 +1049,7 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
tmpCurrentPos = prop.getPositionStop();
|
tmpCurrentPos = prop.getPositionStop();
|
||||||
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
||||||
iii = jjj;
|
iii = jjj;
|
||||||
TK_REG_EXP_DBG_MODE("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) rewind=" << iii);
|
TK_REG_DEBUG("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) rewind=" << iii);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1055,10 +1063,10 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
prop.setPositionStart(tmpCurrentPos);
|
prop.setPositionStart(tmpCurrentPos);
|
||||||
}
|
}
|
||||||
while (iii < m_subNode.size()) {
|
while (iii < m_subNode.size()) {
|
||||||
TK_REG_EXP_DBG_MODE2(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") data='" << autoStr(std::string(_data, tmpCurrentPos, _lenMax-tmpCurrentPos)) << "'");
|
TK_REG_DEBUG_2(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") data='" << autoStr(std::string(_data, tmpCurrentPos, _lenMax-tmpCurrentPos)) << "'");
|
||||||
m_subNode[iii]->parse(_data, tmpCurrentPos, _lenMax, prop);
|
m_subNode[iii]->parse(_data, tmpCurrentPos, _lenMax, prop);
|
||||||
if (prop.getStatus() == parseStatusNone) {
|
if (prop.getStatus() == parseStatusNone) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") ===None=== : " << prop);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") ===None=== : " << prop);
|
||||||
// rewind the list:
|
// rewind the list:
|
||||||
bool findPartialNode = false;
|
bool findPartialNode = false;
|
||||||
for (int64_t jjj=_property.m_subProperty.size()-1; jjj>=0; --jjj) {
|
for (int64_t jjj=_property.m_subProperty.size()-1; jjj>=0; --jjj) {
|
||||||
@ -1068,13 +1076,14 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
tmpCurrentPos = prop.getPositionStop();
|
tmpCurrentPos = prop.getPositionStop();
|
||||||
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
||||||
iii = jjj;
|
iii = jjj;
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=?/" << m_subNode.size() << ") == rewind at " << iii << "");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=?/" << m_subNode.size() << ") == rewind at " << iii << "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We did not find the element :
|
// We did not find the element :
|
||||||
if (findPartialNode == false) {
|
if (findPartialNode == false) {
|
||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) return=" << _property);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
//prop.setPositionStart(tmpCurrentPos);
|
//prop.setPositionStart(tmpCurrentPos);
|
||||||
@ -1083,7 +1092,7 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
}
|
}
|
||||||
tmpCurrentPos = prop.getPositionStop();
|
tmpCurrentPos = prop.getPositionStop();
|
||||||
_property.m_subProperty.push_back(prop);
|
_property.m_subProperty.push_back(prop);
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") === OK === find : " << prop);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem=" << iii << "/" << m_subNode.size() << ") === OK === find : " << prop);
|
||||||
prop.reset();
|
prop.reset();
|
||||||
prop.setPositionStart(tmpCurrentPos);
|
prop.setPositionStart(tmpCurrentPos);
|
||||||
iii++;
|
iii++;
|
||||||
@ -1091,7 +1100,7 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
// Display sub List :
|
// Display sub List :
|
||||||
for (auto &it : _property.m_subProperty) {
|
for (auto &it : _property.m_subProperty) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) sub=" << it);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) sub=" << it);
|
||||||
}
|
}
|
||||||
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
||||||
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
||||||
@ -1100,6 +1109,7 @@ template<class CLASS_TYPE> class NodePTheseElem : public Node<CLASS_TYPE> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_property.setPositionStop( _property.m_subProperty.back().getPositionStop() );
|
_property.setPositionStop( _property.m_subProperty.back().getPositionStop() );
|
||||||
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (elem) return=" << _property);
|
||||||
}
|
}
|
||||||
|
|
||||||
void display() {
|
void display() {
|
||||||
@ -1159,7 +1169,7 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
}
|
}
|
||||||
int32_t generate(const std::vector<char32_t>& _data) {
|
int32_t generate(const std::vector<char32_t>& _data) {
|
||||||
Node<CLASS_TYPE>::m_regExpData = _data;
|
Node<CLASS_TYPE>::m_regExpData = _data;
|
||||||
TK_REG_EXP_DBG_MODE("Request Parse (...) data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
TK_REG_DEBUG("Request Parse (...) data=" << createString(Node<CLASS_TYPE>::m_regExpData) );
|
||||||
//Find all the '|' in the string (and at the good level ...)
|
//Find all the '|' in the string (and at the good level ...)
|
||||||
int64_t pos = 0;
|
int64_t pos = 0;
|
||||||
int32_t elementSize = getLenOfPTheseElem(Node<CLASS_TYPE>::m_regExpData, pos);
|
int32_t elementSize = getLenOfPTheseElem(Node<CLASS_TYPE>::m_regExpData, pos);
|
||||||
@ -1173,9 +1183,9 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
// add to the subnode list :
|
// add to the subnode list :
|
||||||
m_subNode.push_back(new NodePTheseElem<CLASS_TYPE>(tmpData, Node<CLASS_TYPE>::m_nodeLevel+1));
|
m_subNode.push_back(new NodePTheseElem<CLASS_TYPE>(tmpData, Node<CLASS_TYPE>::m_nodeLevel+1));
|
||||||
pos += elementSize+1;
|
pos += elementSize+1;
|
||||||
TK_REG_EXP_DBG_MODE("plop=" << createString(Node<CLASS_TYPE>::m_regExpData, pos, pos+1) );
|
TK_REG_DEBUG("plop=" << createString(Node<CLASS_TYPE>::m_regExpData, pos, pos+1) );
|
||||||
elementSize = getLenOfPTheseElem(Node<CLASS_TYPE>::m_regExpData, pos);
|
elementSize = getLenOfPTheseElem(Node<CLASS_TYPE>::m_regExpData, pos);
|
||||||
TK_REG_EXP_DBG_MODE("find " << elementSize << " elements");
|
TK_REG_DEBUG("find " << elementSize << " elements");
|
||||||
}
|
}
|
||||||
if ( pos == 0
|
if ( pos == 0
|
||||||
&& elementSize == 0) {
|
&& elementSize == 0) {
|
||||||
@ -1185,10 +1195,10 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
return _data.size();
|
return _data.size();
|
||||||
};
|
};
|
||||||
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
virtual void parse(const CLASS_TYPE& _data, int64_t _currentPos, int64_t _lenMax, FindProperty& _property) {
|
||||||
int32_t findLen = _property.getFindLen();
|
|
||||||
TK_REG_EXP_DBG_MODE("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) {" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
TK_REG_DEBUG("Parse " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) {" << Node<CLASS_TYPE>::m_multipleMin << "," << Node<CLASS_TYPE>::m_multipleMax << "}");
|
||||||
TK_REG_EXP_DBG_MODE2(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) data='" << autoStr(std::string(_data, _currentPos, _lenMax-_currentPos)) << "'");
|
TK_REG_DEBUG_2(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) data='" << autoStr(std::string(_data, _currentPos, _lenMax-_currentPos)) << "'");
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) input property=" << _property);
|
TK_REG_DEBUG_3(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) input property=" << _property);
|
||||||
if (0 == m_subNode.size()) {
|
if (0 == m_subNode.size()) {
|
||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
return;
|
return;
|
||||||
@ -1196,7 +1206,7 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
bool haveSubPartial = false;
|
bool haveSubPartial = false;
|
||||||
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
||||||
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) Have partial");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) Have partial");
|
||||||
haveSubPartial = true;
|
haveSubPartial = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1215,8 +1225,9 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
prop = _property.m_subProperty[jjj];
|
prop = _property.m_subProperty[jjj];
|
||||||
tmpCurrentPos = prop.getPositionStop();
|
tmpCurrentPos = prop.getPositionStop();
|
||||||
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
_property.m_subProperty.erase(_property.m_subProperty.begin()+jjj, _property.m_subProperty.end());
|
||||||
|
_property.setPositionStop(tmpCurrentPos);
|
||||||
iiiStartPos = prop.getSubIndex();
|
iiiStartPos = prop.getSubIndex();
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) Rewind to " << iiiStartPos);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) Rewind to " << iiiStartPos << " last elem=" << prop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1228,36 +1239,42 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
_property.setStatus(parseStatusPartial);
|
_property.setStatus(parseStatusPartial);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
prop.setPositionStart(tmpCurrentPos);
|
||||||
}
|
}
|
||||||
prop.setPositionStart(tmpCurrentPos);
|
int32_t findLen = _property.getFindLen();
|
||||||
|
int32_t offset = 0;
|
||||||
_property.setStatus(parseStatusFull);
|
_property.setStatus(parseStatusFull);
|
||||||
bool tmpFind = true;
|
bool tmpFind = true;
|
||||||
while ( _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
while ( _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
||||||
&& tmpFind == true) {
|
&& tmpFind == true) {
|
||||||
tmpFind = false;
|
tmpFind = false;
|
||||||
for (size_t iii=iiiStartPos; iii<m_subNode.size(); ++iii) {
|
if (tmpCurrentPos+offset>=_lenMax) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ")");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... ---/" << m_subNode.size() << ") ==> out of range : " << tmpCurrentPos << "+" << offset << " >= " << _lenMax);
|
||||||
m_subNode[iii]->parse(_data, tmpCurrentPos+findLen, _lenMax, prop);
|
}
|
||||||
|
for (size_t iii=iiiStartPos; iii<m_subNode.size() && tmpCurrentPos+offset<_lenMax; ++iii) {
|
||||||
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ")");
|
||||||
|
m_subNode[iii]->parse(_data, tmpCurrentPos+offset, _lenMax, prop);
|
||||||
//offset = prop.getFindLen();
|
//offset = prop.getFindLen();
|
||||||
if ( prop.getStatus() == parseStatusFull
|
if ( prop.getStatus() == parseStatusFull
|
||||||
|| prop.getStatus() == parseStatusPartial) {
|
|| prop.getStatus() == parseStatusPartial) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ") --- OK --- prop=" << prop);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ") --- OK --- prop=" << prop);
|
||||||
findLen += prop.getFindLen();
|
findLen += prop.getFindLen();
|
||||||
|
offset += prop.getFindLen();
|
||||||
prop.setSubIndex(iii);
|
prop.setSubIndex(iii);
|
||||||
_property.m_subProperty.push_back(prop);
|
_property.m_subProperty.push_back(prop);
|
||||||
tmpFind = true;
|
tmpFind = true;
|
||||||
prop.reset();
|
prop.reset();
|
||||||
prop.setPositionStart(tmpCurrentPos+findLen);
|
prop.setPositionStart(tmpCurrentPos+offset);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ") ---NONE---");
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (... " << iii << "/" << m_subNode.size() << ") ---NONE---");
|
||||||
prop.reset();
|
prop.reset();
|
||||||
prop.setPositionStart(tmpCurrentPos+findLen);
|
prop.setPositionStart(tmpCurrentPos+offset);
|
||||||
}
|
}
|
||||||
iiiStartPos = 0;
|
iiiStartPos = 0;
|
||||||
if (tmpFind == true) {
|
if (tmpFind == true) {
|
||||||
_property.setMultiplicity(_property.m_subProperty.size());
|
_property.setMultiplicity(_property.m_subProperty.size());
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) mult=" << _property.getMultiplicity() << " find " << findLen);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) mult=" << _property.getMultiplicity() << " find " << findLen);
|
||||||
if (_property.getMultiplicity() >= Node<CLASS_TYPE>::m_multipleMin) {
|
if (_property.getMultiplicity() >= Node<CLASS_TYPE>::m_multipleMin) {
|
||||||
_property.setStatus(parseStatusPartial);
|
_property.setStatus(parseStatusPartial);
|
||||||
break;
|
break;
|
||||||
@ -1265,19 +1282,24 @@ template<class CLASS_TYPE> class NodePThese : public Node<CLASS_TYPE> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
for (int64_t iii=_property.m_subProperty.size()-1; iii>=0; --iii) {
|
||||||
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) sub=" << _property.m_subProperty[iii]);
|
||||||
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
if (_property.m_subProperty[iii].getStatus() == parseStatusPartial) {
|
||||||
_property.setStatus(parseStatusPartial);
|
_property.setStatus(parseStatusPartial);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_property.setPositionStop(_property.getPositionStart() + findLen);
|
if (_property.m_subProperty.size() == 0) {
|
||||||
|
_property.setPositionStop(_property.getPositionStart());
|
||||||
|
} else {
|
||||||
|
_property.setPositionStop(_property.m_subProperty.back().getPositionStop());
|
||||||
|
}
|
||||||
if( _property.getMultiplicity() >= Node<CLASS_TYPE>::m_multipleMin
|
if( _property.getMultiplicity() >= Node<CLASS_TYPE>::m_multipleMin
|
||||||
&& _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
&& _property.getMultiplicity() <= Node<CLASS_TYPE>::m_multipleMax
|
||||||
&& findLen> 0 ) {
|
&& findLen> 0 ) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) return=" << _property);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) return=" << _property);
|
||||||
return;
|
return;
|
||||||
} else if( 0 == Node<CLASS_TYPE>::m_multipleMin ) {
|
} else if( 0 == Node<CLASS_TYPE>::m_multipleMin ) {
|
||||||
TK_REG_EXP_DBG_MODE(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) return=" << _property);
|
TK_REG_DEBUG(" " << levelSpace(Node<CLASS_TYPE>::m_nodeLevel) << " (...) return=" << _property);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_property.setStatus(parseStatusNone);
|
_property.setStatus(parseStatusNone);
|
||||||
@ -1403,7 +1425,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
*/
|
*/
|
||||||
void compile(const std::string &_exp) {
|
void compile(const std::string &_exp) {
|
||||||
if (_exp.size() != 0) {
|
if (_exp.size() != 0) {
|
||||||
TK_REG_EXP_DBG_MODE("normal string parse : '" << _exp << "'");
|
TK_REG_DEBUG("normal string parse : '" << _exp << "'");
|
||||||
compile(std::to_u32string(_exp));
|
compile(std::to_u32string(_exp));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1414,8 +1436,8 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
m_expressionRequested = _regexp;
|
m_expressionRequested = _regexp;
|
||||||
std::vector<char32_t> tmpExp;
|
std::vector<char32_t> tmpExp;
|
||||||
|
|
||||||
TK_REG_EXP_DBG_MODE("---------------------------------------------------------------------");
|
TK_REG_DEBUG("---------------------------------------------------------------------");
|
||||||
TK_REG_EXP_DBG_MODE("Parse RegExp : (" << m_expressionRequested << ")" );
|
TK_REG_DEBUG("Parse RegExp : (" << m_expressionRequested << ")" );
|
||||||
m_isOk = false;
|
m_isOk = false;
|
||||||
m_areaFind.start=0;
|
m_areaFind.start=0;
|
||||||
m_areaFind.stop=0;
|
m_areaFind.stop=0;
|
||||||
@ -1488,7 +1510,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
}
|
}
|
||||||
// not find : normal element
|
// not find : normal element
|
||||||
if (jjj==regexp::constConvertionTableSize) {
|
if (jjj==regexp::constConvertionTableSize) {
|
||||||
//TK_REG_EXP_DBG_MODE("parse : '" << _regexp[iii] << "'" );
|
//TK_REG_DEBUG("parse : '" << _regexp[iii] << "'" );
|
||||||
tmpExp.push_back(_regexp[iii]);
|
tmpExp.push_back(_regexp[iii]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1514,7 +1536,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TK_REG_EXP_DBG_MODE("Main element :" << createString(tmpExp) );
|
//TK_REG_DEBUG("Main element :" << createString(tmpExp) );
|
||||||
if ( tmpExp.size()>0
|
if ( tmpExp.size()>0
|
||||||
&& tmpExp[0] == regexpOpcodeNoChar)
|
&& tmpExp[0] == regexpOpcodeNoChar)
|
||||||
{
|
{
|
||||||
@ -1572,13 +1594,11 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
* @param[in] _SearchIn Data where to search the regular expression.
|
* @param[in] _SearchIn Data where to search the regular expression.
|
||||||
* @param[in] _startPos start position to search
|
* @param[in] _startPos start position to search
|
||||||
* @param[in] _endPos end position to search
|
* @param[in] _endPos end position to search
|
||||||
* @param[in] _escapeChar special char that remove other char real type
|
|
||||||
* @return true : find something, false otherwise
|
* @return true : find something, false otherwise
|
||||||
*/
|
*/
|
||||||
bool parse(const CLASS_TYPE& _SearchIn,
|
bool parse(const CLASS_TYPE& _SearchIn,
|
||||||
int64_t _startPos,
|
int64_t _startPos,
|
||||||
int64_t _endPos,
|
int64_t _endPos) {
|
||||||
char32_t _escapeChar=0) {
|
|
||||||
if (false == m_isOk) {
|
if (false == m_isOk) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1592,8 +1612,8 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
for (int64_t iii=_startPos; iii<_endPos; iii++) {
|
for (int64_t iii=_startPos; iii<_endPos; iii++) {
|
||||||
int64_t findLen=0;
|
int64_t findLen=0;
|
||||||
int64_t maxlen = _endPos-iii;
|
int64_t maxlen = _endPos-iii;
|
||||||
TK_REG_EXP_DBG_MODE("----------------------------------------------");
|
TK_REG_DEBUG("----------------------------------------------");
|
||||||
TK_REG_EXP_DBG_MODE("parse element : " << iii << " : '" << _SearchIn[iii] << "'");
|
TK_REG_DEBUG("parse element : " << iii << " : '" << _SearchIn[iii] << "'");
|
||||||
if (true == m_notBeginWithChar) {
|
if (true == m_notBeginWithChar) {
|
||||||
if (iii>0) {
|
if (iii>0) {
|
||||||
char32_t tmpVal = _SearchIn[iii-1];
|
char32_t tmpVal = _SearchIn[iii-1];
|
||||||
@ -1618,7 +1638,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if ( prop.getStatus() == regexp::parseStatusFull
|
if ( prop.getStatus() == regexp::parseStatusFull
|
||||||
|| prop.getStatus() == regexp::parseStatusPartial ) {
|
|| prop.getStatus() == regexp::parseStatusPartial ) {
|
||||||
findLen = prop.getFindLen();
|
findLen = prop.getFindLen();
|
||||||
TK_DEBUG("main search find : " << findLen << " elements data=" << std::string(_SearchIn, prop.getPositionStart(), prop.getFindLen()));
|
TK_REG_DEBUG_3("main search find : " << findLen << " elements data=" << std::string(_SearchIn, prop.getPositionStart(), prop.getFindLen()));
|
||||||
// Check end :
|
// Check end :
|
||||||
if (m_notEndWithChar == true) {
|
if (m_notEndWithChar == true) {
|
||||||
TK_DEBUG("Check end is not a char: '" << (char)_SearchIn[iii+findLen] << "'");
|
TK_DEBUG("Check end is not a char: '" << (char)_SearchIn[iii+findLen] << "'");
|
||||||
@ -1642,6 +1662,10 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
m_areaFind.stop = iii + findLen;
|
m_areaFind.stop = iii + findLen;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (prop.getStatus() == regexp::parseStatusFull) {
|
||||||
|
// We really not find the elemnent ==> stop ...
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1651,8 +1675,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
|
|
||||||
bool processOneElement(const CLASS_TYPE& _SearchIn,
|
bool processOneElement(const CLASS_TYPE& _SearchIn,
|
||||||
int64_t _startPos,
|
int64_t _startPos,
|
||||||
int64_t _endPos,
|
int64_t _endPos) {
|
||||||
char32_t _escapeChar=0) {
|
|
||||||
if (false == m_isOk) {
|
if (false == m_isOk) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1689,6 +1712,7 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
if ( prop.getStatus() == regexp::parseStatusFull
|
if ( prop.getStatus() == regexp::parseStatusFull
|
||||||
|| prop.getStatus() == regexp::parseStatusPartial ) {
|
|| prop.getStatus() == regexp::parseStatusPartial ) {
|
||||||
findLen = prop.getFindLen();
|
findLen = prop.getFindLen();
|
||||||
|
TK_REG_DEBUG_3("main search find : " << findLen << " elements");
|
||||||
// Check end :
|
// Check end :
|
||||||
if (m_notEndWithChar == true) {
|
if (m_notEndWithChar == true) {
|
||||||
if (_startPos+findLen < (int64_t)_SearchIn.size() ) {
|
if (_startPos+findLen < (int64_t)_SearchIn.size() ) {
|
||||||
@ -1710,6 +1734,10 @@ template<class CLASS_TYPE> class RegExp {
|
|||||||
m_areaFind.stop = _startPos + findLen;
|
m_areaFind.stop = _startPos + findLen;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (prop.getStatus() == regexp::parseStatusFull) {
|
||||||
|
// We really not find the elemnent ==> stop ...
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -200,6 +200,7 @@ void testRegExpSingle(const std::string& _expression, const std::string& _search
|
|||||||
|
|
||||||
|
|
||||||
void testRegExp() {
|
void testRegExp() {
|
||||||
|
std::string data;
|
||||||
//std::string data = " a /* plop */ \n int eee = 22; // error value \nint main(void) {\n return 0;\n}\n";
|
//std::string data = " a /* plop */ \n int eee = 22; // error value \nint main(void) {\n return 0;\n}\n";
|
||||||
//std::string data = "alpha /* plop */ test";
|
//std::string data = "alpha /* plop */ test";
|
||||||
//std::string data = "pp \n // qdfqdfsdf \nde";
|
//std::string data = "pp \n // qdfqdfsdf \nde";
|
||||||
@ -222,8 +223,41 @@ void testRegExp() {
|
|||||||
//std::string data = "p// TODO : sdfgsdfsd \ndse";
|
//std::string data = "p// TODO : sdfgsdfsd \ndse";
|
||||||
//testRegExpSingle("//[ \\t]*TODO[ \\t]*:.*$", data);
|
//testRegExpSingle("//[ \\t]*TODO[ \\t]*:.*$", data);
|
||||||
|
|
||||||
std::string data = "abc m_def ghi";
|
data = "abc m_def ghi";
|
||||||
testRegExpSingle("\\@m_[A-Za-z_0-9]*\\@", data);
|
data = " protected:\n"
|
||||||
|
" vec2 m_offset; \n";
|
||||||
|
//testRegExpSingle("\\@m_[A-Za-z_0-9]*\\@", data);
|
||||||
|
|
||||||
|
|
||||||
|
data = " * @param[in] _mode Configuring mode.\n"
|
||||||
|
" * @param[in] _time Time in second of the annimation display\n"
|
||||||
|
" */\n"
|
||||||
|
" void setAnnimationTime(enum ";
|
||||||
|
data = "virtual vec2 relativePosition(const vec2& _pos);";
|
||||||
|
|
||||||
|
//testRegExpSingle("\\@(\\w|_)+[ \\t]*\\(", data);
|
||||||
|
|
||||||
|
data = "include <ewol/Dimensio2n.h>\n"
|
||||||
|
"#include <ewol/Dimension.h>\n"
|
||||||
|
"'dfgd\'fg'\n"
|
||||||
|
"\"dqf\\\"gsdfg\" // \"\n"
|
||||||
|
"// TODO : sqdkfjsdldkqfj\n"
|
||||||
|
"\n"
|
||||||
|
"namespace ewol {\n"
|
||||||
|
" class Widget;\n"
|
||||||
|
" namespace widget {\n"
|
||||||
|
" class Manager;\n"
|
||||||
|
" class Windows;\n"
|
||||||
|
" };\n"
|
||||||
|
"};\n"
|
||||||
|
"#include <etk/types.h>\n";
|
||||||
|
//testRegExpSingle("#(\\\\[\\\\\\n]|.)*$", data);
|
||||||
|
|
||||||
|
|
||||||
|
data = " 'dfgd\\'fg' \n"
|
||||||
|
" vec2 m_offset; \n";
|
||||||
|
testRegExpSingle("'((\\\\[\\\\'])|.)*'", data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, const char *argv[]) {
|
int main(int argc, const char *argv[]) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user