[DEBUG] correction of end of file regexp change
This commit is contained in:
parent
7952872980
commit
67a08dd775
@ -10,43 +10,51 @@
|
||||
<ext>*.m</ext>
|
||||
<ext>*.mm</ext>
|
||||
<pass1><!-- multiline section & parse all file (now) and when modification retrive previous modification -->
|
||||
<rule name="my comment multiline doxygen">
|
||||
<rule name="doxygen multiline">
|
||||
<color>commentDoxygen</color>
|
||||
<regex>/\*\*(.|\r|\n)*?\*/</regex>
|
||||
<regex>/\*(\*|!)(.|\r|\n)*?\*/</regex>
|
||||
</rule>
|
||||
<rule name="code Review">
|
||||
<rule name="comment multiline TODO">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>/\*[ \t]*TODO :(.|\r|\n)*?\*/</regex>
|
||||
<regex>/\*[ \t]*TODO :(.|\r|\n)*?(\*/|\0)</regex>
|
||||
</rule>
|
||||
<rule name="my comment multiline">
|
||||
<rule name="comment multiline">
|
||||
<color>comment</color>
|
||||
<regex>/\*(.|\r|\n)*?\*/</regex>
|
||||
<regex>/\*(.|\r|\n)*?(\*/|\0)</regex>
|
||||
</rule>
|
||||
<rule name="my if 0">
|
||||
<rule name="comment miltiline ERROR">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>/\*(.|\r|\n)*</regex>
|
||||
</rule>
|
||||
<rule name="#if 0">
|
||||
<color>preprocesseur</color>
|
||||
<regex>#[ \t]*if 0(.|\r|\n)*?#(endif|else)</regex>
|
||||
<regex>#[ \t]*if 0(.|\r|\n)*?(#endif|else)</regex>
|
||||
</rule>
|
||||
<rule name="my preprocesseur">
|
||||
<rule name="#if 0 ERROR">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>#[ \t]*if 0(.|\r|\n)*</regex>
|
||||
</rule>
|
||||
<rule name="#preproc">
|
||||
<color>preprocesseur</color>
|
||||
<regex>#(.|\\[\\\n])*</regex>
|
||||
</rule>
|
||||
<rule name="my comment doxygen">
|
||||
<rule name="inline doxygen">
|
||||
<color>commentDoxygen</color>
|
||||
<regex>//!.*</regex>
|
||||
</rule>
|
||||
<rule name="my todo comment">
|
||||
<rule name="inline comment TODO">
|
||||
<color>SYNTAX_ERROR</color>
|
||||
<regex>//[ \t]*TODO[ \t]*:.*</regex>
|
||||
</rule>
|
||||
<rule name="my comment">
|
||||
<rule name="inline comment">
|
||||
<color>comment</color>
|
||||
<regex>//.*</regex>
|
||||
</rule>
|
||||
<rule name="doubleQuteText">
|
||||
<rule name="double quote text">
|
||||
<color>doubleQuoteText</color>
|
||||
<regex>"(.|\\[\\"])*"</regex>
|
||||
<regex>"(.|\\[\\"])*?"</regex> <!-- " -->
|
||||
</rule>
|
||||
<rule name="simpleQuteText">
|
||||
<rule name="simple quote text">
|
||||
<color>doubleQuoteText</color>
|
||||
<regex>'\\?.'</regex>
|
||||
</rule>
|
||||
|
@ -723,7 +723,7 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
return;
|
||||
}
|
||||
// normal case
|
||||
//APPL_INFO("(pos="<<pos<<", nbDeleted="<<nbDeleted<<", nbAdded=" << nbAdded << "\");");
|
||||
APPL_VERBOSE("(_pos="<<_pos<<", _nbDeleted="<<_nbDeleted<<", _nbAdded=" << _nbAdded << "\");");
|
||||
int64_t posEnd = _pos + _nbDeleted;
|
||||
// search position of the old element to reparse IT...
|
||||
int64_t startId;
|
||||
@ -737,31 +737,44 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
// find element previous
|
||||
findMainHighLightPosition(_pos, posEnd, startId, stopId, true);
|
||||
|
||||
APPL_VERBOSE(" list old parse:");
|
||||
for (auto &elem : m_HLDataPass1) {
|
||||
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
|
||||
}
|
||||
// Remove previous element to prevent many errors like parsing of // for example
|
||||
startId--;
|
||||
APPL_VERBOSE("Find startId=" << startId << " stopId=" << stopId << " list size=" << m_HLDataPass1.size());
|
||||
|
||||
// remove deprecated element
|
||||
if ( startId == -1
|
||||
&& stopId == -1) {
|
||||
if ( startId <= -1
|
||||
&& stopId <= -1) {
|
||||
m_HLDataPass1.clear();
|
||||
} else if (startId == -1) {
|
||||
APPL_VERBOSE("1 * clear");
|
||||
} else if (startId <= -1) {
|
||||
if (stopId == 0){
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin());
|
||||
//APPL_DEBUG("1 * Erase 0");
|
||||
APPL_VERBOSE("1 * Erase 0");
|
||||
} else {
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin(), m_HLDataPass1.begin()+stopId);
|
||||
//APPL_DEBUG("2 * Erase 0->" << stopId);
|
||||
APPL_VERBOSE("2 * Erase 0->" << stopId);
|
||||
}
|
||||
} else if (stopId == -1) {
|
||||
//APPL_DEBUG("3 * Erase " << startId+1 << "-> end");
|
||||
} else if (stopId <= -1) {
|
||||
APPL_VERBOSE("3 * Erase " << startId+1 << "-> end");
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.end());
|
||||
stopId = -1;
|
||||
} else {
|
||||
int32_t currentSize = m_HLDataPass1.size();
|
||||
//APPL_DEBUG("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId);
|
||||
APPL_VERBOSE("4 * Erase " << startId+1 << "->" << stopId << " in " << currentSize << " elements" );
|
||||
m_HLDataPass1.erase(m_HLDataPass1.begin()+startId+1, m_HLDataPass1.begin()+stopId+1);
|
||||
if (stopId == currentSize-1) {
|
||||
stopId = -1;
|
||||
}
|
||||
}
|
||||
//APPL_DEBUG("new size=" << (int32_t)m_HLDataPass1.size()-1);
|
||||
APPL_VERBOSE(" list afterRemove:");
|
||||
for (auto &elem : m_HLDataPass1) {
|
||||
APPL_VERBOSE(" " << elem.start << "=>" << elem.stop);
|
||||
}
|
||||
|
||||
// update position after the range position :
|
||||
int64_t elemStart;
|
||||
if (startId == -1) {
|
||||
@ -775,18 +788,18 @@ void appl::Buffer::regenerateHighLightAt(int64_t _pos, int64_t _nbDeleted, int64
|
||||
it->stop += _nbAdded - _nbDeleted;
|
||||
}
|
||||
//Regenerate Element inside range
|
||||
if ( startId == -1
|
||||
&& stopId == -1) {
|
||||
//APPL_DEBUG("******* Regenerate ALL");
|
||||
if ( startId <= -1
|
||||
&& stopId <= -1) {
|
||||
APPL_VERBOSE("******* Regenerate ALL");
|
||||
generateHighLightAt(0, m_data.size());
|
||||
} else if(-1 == startId) {
|
||||
//APPL_DEBUG("******* Regenerate START");
|
||||
} else if(startId <= -1) {
|
||||
APPL_VERBOSE("******* Regenerate START");
|
||||
generateHighLightAt(0, m_HLDataPass1[0].start, 0);
|
||||
} else if(-1 == stopId) {
|
||||
//APPL_DEBUG("******* Regenerate STOP");
|
||||
} else if(stopId <= -1) {
|
||||
APPL_VERBOSE("******* Regenerate STOP");
|
||||
generateHighLightAt(m_HLDataPass1[m_HLDataPass1.size() -1].stop, m_data.size(), m_HLDataPass1.size());
|
||||
} else {
|
||||
//APPL_DEBUG("******* Regenerate RANGE");
|
||||
APPL_VERBOSE("******* Regenerate RANGE");
|
||||
generateHighLightAt(m_HLDataPass1[startId].stop, m_HLDataPass1[startId+1].start, startId+1);
|
||||
}
|
||||
}
|
||||
|
@ -179,52 +179,34 @@ void appl::Highlight::parse(int64_t _start,
|
||||
appl::HighlightInfo resultat;
|
||||
int64_t startTime = ewol::getTime();
|
||||
while (elementStart <= elementStop) {
|
||||
//APPL_DEBUG("Parse element in the buffer pos=" << elementStart);
|
||||
appl::HighlightInfo resultatLast;
|
||||
int64_t findAnOtherId = -1;
|
||||
//HL_DEBUG("Parse element in the buffer pos=" << elementStart);
|
||||
int64_t currentTime = ewol::getTime();
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
|
||||
enum resultFind ret = HLP_FIND_OK;
|
||||
/*
|
||||
if (_buffer[elementStart] == '\n') {
|
||||
APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='\\n' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='\\n' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||
} else {
|
||||
APPL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj]->getPaternString());
|
||||
}
|
||||
*/
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
ret = m_listHighlightPass1[jjj]->find(elementStart, _buffer.size(), resultat, _buffer);
|
||||
if (HLP_FIND_ERROR != ret) {
|
||||
if (elementStart == resultat.start) {
|
||||
//APPL_DEBUG(" native Find");
|
||||
findAnOtherId = jjj;
|
||||
resultatLast = resultat;
|
||||
break;
|
||||
} else {
|
||||
// stack last find to prevent a unneded seach:
|
||||
if ( findAnOtherId == -1
|
||||
|| resultat.start < resultatLast.start) {
|
||||
findAnOtherId = jjj;
|
||||
resultatLast = resultat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int64_t currentTimeEnd = ewol::getTime();
|
||||
int64_t deltaTime = currentTimeEnd - currentTime;
|
||||
if (findAnOtherId != -1) {
|
||||
//APPL_DEBUG("Find Pattern in the Buffer : time=" << (float)deltaTime/1000.0f << " ms (" << resultatLast.start << "," << resultatLast.stop << ") startPos=" << elementStart << " for=" << m_listHighlightPass1[findAnOtherId]->getPaternString());
|
||||
HL_DEBUG("Find Pattern in the Buffer : time=" << (float)deltaTime/1000.0f << " ms (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart << " for=" << m_listHighlightPass1[jjj]->getPaternString());
|
||||
// remove element in the current List where the current Element have a end inside the next...
|
||||
int64_t kkk=_addingPos;
|
||||
while(kkk < (int64_t)_metaData.size() ) {
|
||||
if (_metaData[kkk].start <= resultatLast.stop) {
|
||||
if (_metaData[kkk].start <= resultat.stop) {
|
||||
// remove element
|
||||
APPL_DEBUG("Erase element=" << kkk);
|
||||
HL_DEBUG("Erase element=" << kkk);
|
||||
_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
|
||||
// Increase the end of search
|
||||
if (kkk < (int64_t)_metaData.size()) {
|
||||
// just befor the end of the next element
|
||||
// just before the end of the next element
|
||||
elementStop = _metaData[kkk].start-1;
|
||||
} else {
|
||||
// end of the buffer
|
||||
@ -236,16 +218,15 @@ void appl::Highlight::parse(int64_t _start,
|
||||
}
|
||||
}
|
||||
// add curent element in the list ...
|
||||
_metaData.insert(_metaData.begin()+_addingPos, resultatLast);
|
||||
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultatLast.start << " E=" << resultatLast.stop );
|
||||
_metaData.insert(_metaData.begin()+_addingPos, resultat);
|
||||
HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.start << " E=" << resultat.stop );
|
||||
// update the current research starting element: (set position at the end of the current element
|
||||
elementStart = resultatLast.stop-1;
|
||||
elementStart = resultat.stop-1;
|
||||
// increment the position of insertion:
|
||||
_addingPos++;
|
||||
// We find a pattern == > Stop search for the current element
|
||||
} else {
|
||||
//APPL_DEBUG("loose time : time=" << deltaTime << " us");
|
||||
//break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Go to the next element (and search again ...).
|
||||
elementStart++;
|
||||
@ -276,41 +257,20 @@ void appl::Highlight::parse2(int64_t _start,
|
||||
if (elementStart == 306) {
|
||||
//etk::log::setLevel(etk::log::logLevelVerbose);
|
||||
}
|
||||
appl::HighlightInfo resultatLast;
|
||||
int64_t findAnOtherId = -1;
|
||||
//HL2_DEBUG("Parse element in the buffer pos=" << elementStart << "," << _buffer.size() << ")" );
|
||||
//try to fond the HL in ALL of we have
|
||||
for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass2.size(); jjj++){
|
||||
enum resultFind ret;
|
||||
HL_DEBUG("Parse HL id=" << jjj << " position search: (" <<
|
||||
HL2_DEBUG("Parse HL id=" << jjj << " position search: (" <<
|
||||
elementStart << "," << elementStop << ") in='"
|
||||
<< _buffer[elementStart] << "' " << m_listHighlightPass2[jjj]->getPaternString());
|
||||
// Stop the search to the end (to get the end of the pattern)
|
||||
ret = m_listHighlightPass2[jjj]->find(elementStart, elementStop, resultat, _buffer);
|
||||
if (ret != HLP_FIND_ERROR) {
|
||||
if (elementStart == resultat.start) {
|
||||
//APPL_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart );
|
||||
findAnOtherId = jjj;
|
||||
resultatLast = resultat;
|
||||
break;
|
||||
} else {
|
||||
// stack last find to prevent a unneded seach:
|
||||
if ( findAnOtherId == -1
|
||||
|| resultat.start < resultatLast.start) {
|
||||
findAnOtherId = jjj;
|
||||
resultatLast = resultat;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (findAnOtherId != -1) {
|
||||
//APPL_DEBUG("Find Pattern in the Buffer : (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart );
|
||||
// add curent element in the list ...
|
||||
_metaData.push_back(resultat);
|
||||
elementStart = resultat.stop-1;
|
||||
} else {
|
||||
//break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Go to the next element (and search again ...).
|
||||
elementStart++;
|
||||
|
@ -115,19 +115,8 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
||||
return HLP_FIND_ERROR;
|
||||
}
|
||||
|
||||
/*
|
||||
// when we have only one element:
|
||||
if (true == m_regExp.processOneElement(_buffer, _start, _stop)) {
|
||||
_resultat.start = m_regExp->start();
|
||||
_resultat.stop = m_regExp->stop();
|
||||
return HLP_FIND_OK;
|
||||
}
|
||||
//APPL_DEBUG("NOT find hightlightpatern ...");
|
||||
return HLP_FIND_ERROR;
|
||||
*/
|
||||
|
||||
std::smatch resultMatch;
|
||||
std::regex_constants::match_flag_type flags = std::regex_constants::match_continuous;
|
||||
std::regex_constants::match_flag_type flags = std::regex_constants::match_continuous; // check only the match at the first character.
|
||||
|
||||
//APPL_DEBUG("find data at : start=" << _start << " stop=" << _stop << " regex='" << m_regexValue << "'");
|
||||
if ((int64_t)_stop <= (int64_t)_buffer.size()) {
|
||||
@ -147,9 +136,9 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
||||
if (_start>0) {
|
||||
flags |= std::regex_constants::match_prev_avail;
|
||||
}
|
||||
std::regex_search(_buffer.begin() + _start, _buffer.begin() + _stop, resultMatch, m_regExp, flags);
|
||||
std::regex_search(_buffer.begin() + _start, _buffer.end(), resultMatch, m_regExp, flags);
|
||||
if (resultMatch.size() > 0) {
|
||||
_resultat.start = std::distance(_buffer.begin(), resultMatch[0].first);;
|
||||
_resultat.start = std::distance(_buffer.begin(), resultMatch[0].first);
|
||||
_resultat.stop = std::distance(_buffer.begin(), resultMatch[0].second);
|
||||
//APPL_DEBUG("find data at : start=" << _resultat.start << " stop=" << _resultat.stop << " data='" <<std::string(_buffer, _resultat.start, _resultat.stop-_resultat.start) << "'" );
|
||||
/*
|
||||
@ -163,19 +152,6 @@ enum resultFind appl::HighlightPattern::find(int32_t _start,
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
if (false){
|
||||
TK_DEBUG("in line : '" << etk::to_string(_buffer) << "'");
|
||||
TK_DEBUG(" Find " << resultMatch.size() << " elements");
|
||||
for (size_t iii=0; iii<resultMatch.size(); ++iii) {
|
||||
int32_t posStart = std::distance(_buffer.begin(), resultMatch[iii].first);
|
||||
int32_t posStop = std::distance(_buffer.begin(), resultMatch[iii].second);
|
||||
TK_DEBUG(" [" << iii << "] " << *resultMatch[iii].first);
|
||||
TK_DEBUG(" [" << iii << "] " << *resultMatch[iii].second);
|
||||
TK_DEBUG(" [" << iii << "] " << std::string(_buffer, posStart, posStop-posStart));
|
||||
}
|
||||
}
|
||||
*/
|
||||
return HLP_FIND_OK;
|
||||
}
|
||||
return HLP_FIND_ERROR;
|
||||
|
Loading…
x
Reference in New Issue
Block a user