diff --git a/etk/RegExp.cpp b/etk/RegExp.cpp index 23f5402..13392b6 100644 --- a/etk/RegExp.cpp +++ b/etk/RegExp.cpp @@ -13,54 +13,54 @@ const etk::convertionTable_ts etk::constConvertionTable[] = { // haveBackSlash, inputValue, newValue - { false , '(' , REGEXP_OPCODE_PTHESE_IN}, - { true , '(' , (int16_t)'('}, - { false , ')' , REGEXP_OPCODE_PTHESE_OUT}, - { true , ')' , (int16_t)')'}, - { false , '[' , REGEXP_OPCODE_BRACKET_IN}, - { true , '[' , (int16_t)'['}, - { false , ']' , REGEXP_OPCODE_BRACKET_OUT}, - { true , ']' , (int16_t)']'}, - { false , '{' , REGEXP_OPCODE_BRACE_IN}, - { true , '{' , (int16_t)'{'}, - { false , '}' , REGEXP_OPCODE_BRACE_OUT}, - { true , '}' , (int16_t)'}'}, - { false , '-' , REGEXP_OPCODE_TO}, - { true , '-' , (int16_t)'-'}, - { false , '*' , REGEXP_OPCODE_STAR}, - { true , '*' , (int16_t)'*'}, - { false , '.' , REGEXP_OPCODE_DOT}, - { true , '.' , (int16_t)'.'}, - { false , '?' , REGEXP_OPCODE_QUESTION}, - { true , '?' , (int16_t)'?'}, - { false , '+' , REGEXP_OPCODE_PLUS}, - { true , '+' , (int16_t)'+'}, - { false , '|' , REGEXP_OPCODE_PIPE}, - { true , '|' , (int16_t)'|'}, - { false , '^' , REGEXP_OPCODE_START_OF_LINE}, - { true , '^' , (int16_t)'^'}, - { false , '$' , REGEXP_OPCODE_END_OF_LINE}, - { true , '$' , (int16_t)'$'}, - { true , 'd' , REGEXP_OPCODE_DIGIT}, - { true , 'D' , REGEXP_OPCODE_DIGIT_NOT}, - { true , 'l' , REGEXP_OPCODE_LETTER}, - { true , 'L' , REGEXP_OPCODE_LETTER_NOT}, - { true , 's' , REGEXP_OPCODE_SPACE}, - { true , 'S' , REGEXP_OPCODE_SPACE_NOT}, - { true , 'w' , REGEXP_OPCODE_WORD}, - { true , 'W' , REGEXP_OPCODE_WORD_NOT}, - { true , 'a' , (int16_t)'\a'}, - { true , 'b' , (int16_t)'\b'}, - { true , 'e' , 0x001B}, // Escape character - { true , 'f' , (int16_t)'\f'}, - { true , 'n' , (int16_t)'\n'}, - { true , 'r' , (int16_t)'\r'}, - { true , 't' , (int16_t)'\t'}, - { true , 'v' , (int16_t)'\v'}, - { true , '\\' , (int16_t)'\\'}, - { true , '&' , (int16_t)'&'}, - { true , '0' , (int16_t)'\0'}, - { true , '@' , REGEXP_OPCODE_NO_CHAR}, + { false , '(' , 0 , REGEXP_OPCODE_PTHESE_IN}, + { true , '(' , '(' , REGEXP_OPCODE_ERROR}, + { false , ')' , 0 , REGEXP_OPCODE_PTHESE_OUT}, + { true , ')' , ')' , REGEXP_OPCODE_ERROR}, + { false , '[' , 0 , REGEXP_OPCODE_BRACKET_IN}, + { true , '[' , '[' , REGEXP_OPCODE_ERROR}, + { false , ']' , 0 , REGEXP_OPCODE_BRACKET_OUT}, + { true , ']' , ']' , REGEXP_OPCODE_ERROR}, + { false , '{' , 0 , REGEXP_OPCODE_BRACE_IN}, + { true , '{' , '{' , REGEXP_OPCODE_ERROR}, + { false , '}' , 0 , REGEXP_OPCODE_BRACE_OUT}, + { true , '}' , '}' , REGEXP_OPCODE_ERROR}, + { false , '-' , 0 , REGEXP_OPCODE_TO}, + { true , '-' , '-' , REGEXP_OPCODE_ERROR}, + { false , '*' , 0 , REGEXP_OPCODE_STAR}, + { true , '*' , '*' , REGEXP_OPCODE_ERROR}, + { false , '.' , 0 , REGEXP_OPCODE_DOT}, + { true , '.' , '.' , REGEXP_OPCODE_ERROR}, + { false , '?' , 0 , REGEXP_OPCODE_QUESTION}, + { true , '?' , '?' , REGEXP_OPCODE_ERROR}, + { false , '+' , 0 , REGEXP_OPCODE_PLUS}, + { true , '+' , '+' , REGEXP_OPCODE_ERROR}, + { false , '|' , 0 , REGEXP_OPCODE_PIPE}, + { true , '|' , '|' , REGEXP_OPCODE_ERROR}, + { false , '^' , 0 , REGEXP_OPCODE_START_OF_LINE}, + { true , '^' , '^' , REGEXP_OPCODE_ERROR}, + { false , '$' , 0 , REGEXP_OPCODE_END_OF_LINE}, + { true , '$' , '$' , REGEXP_OPCODE_ERROR}, + { true , 'd' , 0 , REGEXP_OPCODE_DIGIT}, + { true , 'D' , 0 , REGEXP_OPCODE_DIGIT_NOT}, + { true , 'l' , 0 , REGEXP_OPCODE_LETTER}, + { true , 'L' , 0 , REGEXP_OPCODE_LETTER_NOT}, + { true , 's' , 0 , REGEXP_OPCODE_SPACE}, + { true , 'S' , 0 , REGEXP_OPCODE_SPACE_NOT}, + { true , 'w' , 0 , REGEXP_OPCODE_WORD}, + { true , 'W' , 0 , REGEXP_OPCODE_WORD_NOT}, + { true , 'a' , '\a', REGEXP_OPCODE_ERROR}, + { true , 'b' , '\b', REGEXP_OPCODE_ERROR}, + { true , 'e' , 0x1B, REGEXP_OPCODE_ERROR}, // Escape character + { true , 'f' , '\f', REGEXP_OPCODE_ERROR}, + { true , 'n' , '\n', REGEXP_OPCODE_ERROR}, + { true , 'r' , '\r', REGEXP_OPCODE_ERROR}, + { true , 't' , '\t', REGEXP_OPCODE_ERROR}, + { true , 'v' , '\v', REGEXP_OPCODE_ERROR}, + { true , '\\' , '\\', REGEXP_OPCODE_ERROR}, + { true , '&' , '&' , REGEXP_OPCODE_ERROR}, + { true , '0' , '\0', REGEXP_OPCODE_ERROR}, + { true , '@' , 0 , REGEXP_OPCODE_NO_CHAR}, }; const int32_t etk::constConvertionTableSize = sizeof(etk::constConvertionTable) / sizeof(etk::convertionTable_ts) ; @@ -95,7 +95,7 @@ void etk::DisplayElem(const etk::Vector& _data, int32_t _start, in case REGEXP_OPCODE_WORD_NOT: etk::cout< #include + +#define TK_REG_EXP_DBG_MODE TK_VERBOSE +//#define TK_REG_EXP_DBG_MODE TK_DEBUG + namespace etk { /* @@ -44,9 +48,10 @@ multiplicity : */ typedef struct { - bool haveBackSlash; - uint32_t inputValue; - uint32_t newValue; + bool haveBackSlash; + char inputValue; + char newValue; + etk::regExpPrivateSection_te specialChar; }convertionTable_ts; extern const convertionTable_ts constConvertionTable[]; @@ -109,12 +114,6 @@ template class RegExpNode * @return false : Find nothing */ virtual bool Parse(const CLASS_TYPE& _data, int32_t _currentPos, int32_t _lenMax, int32_t& _findLen)=0; - /* - { - findLen = 0; - return false; - }; - */ /** * @brief Display the current node properties * @param[in] level of the node @@ -169,7 +168,7 @@ template class RegExpNodeValue : public RegExpNode int32_t Generate(const etk::Vector& _data) { RegExpNode::m_RegExpData = _data; - //TK_DEBUG("Request Parse \"Value\" data="; DisplayElem(RegExpNode::m_RegExpData);); + TK_REG_EXP_DBG_MODE("Request Parse \"Value\" data="; DisplayElem(RegExpNode::m_RegExpData);); m_data.Clear(); for (int32_t i=0; i::m_RegExpData.Size(); i++) { m_data.PushBack(RegExpNode::m_RegExpData[i]); @@ -180,12 +179,12 @@ template class RegExpNodeValue : public RegExpNode virtual bool Parse(const CLASS_TYPE& _data, int32_t _currentPos, int32_t _lenMax, int32_t& _findLen) { _findLen = 0; - //TK_INFO("Parse node : Value{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : Value{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); if (0==m_data.Size()) { TK_ERROR("No data inside type elemTypeValue"); return false; } - //TK_DEBUG("check element value : '" << m_data[0] << "'"); + TK_REG_EXP_DBG_MODE("check element value : '" << m_data[0] << "'"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind == true; j++) { @@ -211,10 +210,10 @@ template class RegExpNodeValue : public RegExpNode && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -248,7 +247,7 @@ template class RegExpNodeBracket : public RegExpNode& _data) { RegExpNode::m_RegExpData = _data; - //TK_DEBUG("Request Parse [...] data="; DisplayElem(RegExpNode::m_RegExpData);); + TK_REG_EXP_DBG_MODE("Request Parse [...] data="; DisplayElem(_data);); m_data.Clear(); etk::UniChar lastElement = 'a'; @@ -282,12 +281,12 @@ template class RegExpNodeBracket : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : [...]{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); if (0==m_data.Size()) { TK_ERROR("No data inside type elemTypeValue"); return false; } - //TK_DEBUG("one of element value List : "; DisplayElem(element->m_data);); + TK_REG_EXP_DBG_MODE("one of element value List : "; DisplayElem(m_data);); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -305,10 +304,10 @@ template class RegExpNodeBracket : public RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -338,16 +337,16 @@ template class RegExpNodeDigit : public RegExpNode virtual bool Parse(const CLASS_TYPE& _data, int32_t _currentPos, int32_t _lenMax, int32_t& _findLen) { _findLen = 0; - //TK_INFO("Parse node : Digit{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "} : "<< data[currentPos] << " lenMax=" << lenMax); + TK_REG_EXP_DBG_MODE("Parse node : Digit{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "} : "<< _data[_currentPos] << " lenMax=" << _lenMax); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { etk::UniChar tmpVal = _data[_currentPos+j]; - //TK_DEBUG("compare : " << tmpVal); + TK_REG_EXP_DBG_MODE("compare : " << tmpVal); if( tmpVal >= '0' && tmpVal <= '9') { - //TK_DEBUG("find ++"); + TK_REG_EXP_DBG_MODE("find ++"); _findLen += 1; } else { tmpFind=false; @@ -357,10 +356,10 @@ template class RegExpNodeDigit : public RegExpNode && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -390,7 +389,7 @@ template class RegExpNodeDigitNot : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : DigitNot{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -405,10 +404,10 @@ template class RegExpNodeDigitNot : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -439,7 +438,7 @@ template class RegExpNodeLetter : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : Letter{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -456,10 +455,10 @@ template class RegExpNodeLetter : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -490,7 +489,7 @@ template class RegExpNodeLetterNot : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : LetterNot{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -507,10 +506,10 @@ template class RegExpNodeLetterNot : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -541,7 +540,7 @@ template class RegExpNodeWhiteSpace : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -560,10 +559,10 @@ template class RegExpNodeWhiteSpace : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -594,7 +593,7 @@ template class RegExpNodeWhiteSpaceNot : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : SpaceNot{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -613,10 +612,10 @@ template class RegExpNodeWhiteSpaceNot : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -646,7 +645,7 @@ template class RegExpNodeWordChar : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : Word{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -665,10 +664,10 @@ template class RegExpNodeWordChar : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -698,7 +697,7 @@ template class RegExpNodeWordCharNot : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : WordNot{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); bool tmpFind = true; int32_t j; for (j=0; j::m_multipleMax && tmpFind ==true && j < _lenMax; j++) { @@ -717,10 +716,10 @@ template class RegExpNodeWordCharNot : public RegExpNode=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -751,7 +750,7 @@ template class RegExpNodeDot : public RegExpNode virtual bool Parse(const CLASS_TYPE& _data, int32_t _currentPos, int32_t _lenMax, int32_t& _findLen) { _findLen = 0; - //TK_INFO("Parse node : '.'{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : '.'{" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); // equivalent a : [^\x00-\x08\x0A-\x1F\x7F] bool tmpFind = true; int32_t j; @@ -771,10 +770,10 @@ template class RegExpNodeDot : public RegExpNode if( j>=RegExpNode::m_multipleMin && j<=RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -876,7 +875,7 @@ template class RegExpNodePTheseElem : public RegExpNode& _data) { RegExpNode::m_RegExpData = _data; - //TK_DEBUG("Request Parse (elem) data="; DisplayElem(RegExpNode::m_RegExpData);); + TK_REG_EXP_DBG_MODE("Request Parse (elem) data="; DisplayElem(RegExpNode::m_RegExpData);); int32_t pos = 0; int32_t elementSize = 0; etk::Vector tmpData; @@ -1007,7 +1006,7 @@ template class RegExpNodePTheseElem : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : (Elem){" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); // NOTE 1 : Must done only one time in EVERY case ... // NOTE 2 : All element inside must be OK if (0 == m_subNode.Size()) { @@ -1084,7 +1083,7 @@ template class RegExpNodePThese : public RegExpNode& _data) { RegExpNode::m_RegExpData = _data; - //TK_DEBUG("Request Parse (...) data="; DisplayElem(RegExpNode::m_RegExpData);); + TK_REG_EXP_DBG_MODE("Request Parse (...) data="; DisplayElem(RegExpNode::m_RegExpData);); //Find all the '|' in the string (and at the good level ...) int32_t pos = 0; int32_t elementSize = GetLenOfPTheseElem(RegExpNode::m_RegExpData, pos); @@ -1100,9 +1099,9 @@ template class RegExpNodePThese : public RegExpNode class RegExpNodePThese : public RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); + TK_REG_EXP_DBG_MODE("Parse node : (...){" << RegExpNode::m_multipleMin << "," << RegExpNode::m_multipleMax << "}"); if (0 == m_subNode.Size()) { return false; } @@ -1134,10 +1133,10 @@ template class RegExpNodePThese : public RegExpNode::m_multipleMax && _findLen>0 ) { - //TK_DEBUG("find " << findLen); + TK_REG_EXP_DBG_MODE("find " << _findLen); return true; } else if( 0 == RegExpNode::m_multipleMin ) { - //TK_DEBUG("find size=0"); + TK_REG_EXP_DBG_MODE("find size=0"); return true; } return false; @@ -1205,7 +1204,8 @@ template class RegExp m_expressionRequested = _regexp; etk::Vector tmpExp; - //TK_DEBUG("Parse RegExp : " << expressionRequested.c_str() ); + TK_REG_EXP_DBG_MODE("---------------------------------------------------------------------"); + TK_REG_EXP_DBG_MODE("Parse RegExp : (" << _regexp << ")" ); m_isOk = false; m_areaFind.start=0; m_areaFind.stop=0; @@ -1233,7 +1233,11 @@ template class RegExp if( true == constConvertionTable[j].haveBackSlash && _regexp[iii+1] == constConvertionTable[j].inputValue) { - tmpExp.PushBack(constConvertionTable[j].newValue); + if (constConvertionTable[j].newValue==0) { + tmpExp.PushBack(constConvertionTable[j].specialChar); + } else { + tmpExp.PushBack(constConvertionTable[j].newValue); + } break; } } @@ -1265,14 +1269,18 @@ template class RegExp if( false == constConvertionTable[j].haveBackSlash && _regexp[iii] == constConvertionTable[j].inputValue) { - tmpExp.PushBack(constConvertionTable[j].newValue); + if (constConvertionTable[j].newValue==0) { + tmpExp.PushBack(constConvertionTable[j].specialChar); + } else { + tmpExp.PushBack(constConvertionTable[j].newValue); + } break; } } // not find : normal element if (j==constConvertionTableSize) { - // TODO : It might have an error ... -// tmpExp.PushBack(_regexp[iii]); + //TK_REG_EXP_DBG_MODE("parse : '" << _regexp[iii] << "'" ); + tmpExp.PushBack(_regexp[iii]); } } } @@ -1297,7 +1305,7 @@ template class RegExp return; } - //TK_DEBUG("Main element :"; DisplayElem(tmpExp, 0, tmpExp.Size()); ); + TK_REG_EXP_DBG_MODE("Main element :"; DisplayElem(tmpExp); ); if( tmpExp.Size()>0 && tmpExp[0] == REGEXP_OPCODE_NO_CHAR) { diff --git a/etk/Stream.cpp b/etk/Stream.cpp index 7019585..fea6f8c 100644 --- a/etk/Stream.cpp +++ b/etk/Stream.cpp @@ -141,7 +141,9 @@ etk::CCout::~CCout() etk::CCout& etk::CCout::operator << (const etk::UniChar& t) { - snprintf(tmp, MAX_LOG_SIZE_TMP, "%u", t.Get()); + char output[5]; + int32_t len = t.GetUtf8(output); + snprintf(tmp, MAX_LOG_SIZE_TMP, "%s", output); strncat(m_tmpChar, tmp, MAX_LOG_SIZE); return *this; } diff --git a/etk/UString.h b/etk/UString.h index 892e85b..5bac580 100644 --- a/etk/UString.h +++ b/etk/UString.h @@ -27,7 +27,7 @@ namespace etk printModeString, } printMode_te; private : - etk::Vector m_data; //!< internal data is stored in the Unicode properties ... + etk::Vector m_data; //!< internal data is stored in the Unicode properties ... public: // Constructeurs UString(void); @@ -114,10 +114,10 @@ namespace etk /***************************************************** * [] operator *****************************************************/ - const uniChar_t& operator[] (int32_t _pos) const { + const etk::UniChar& operator[] (int32_t _pos) const { return m_data[_pos]; } - uniChar_t& operator[] (int32_t _pos) { + etk::UniChar& operator[] (int32_t _pos) { return m_data[_pos]; } diff --git a/etk/UniChar.h b/etk/UniChar.h index 3851627..047d258 100644 --- a/etk/UniChar.h +++ b/etk/UniChar.h @@ -38,6 +38,7 @@ namespace etk REGEXP_OPCODE_WORD,/* \w */ REGEXP_OPCODE_WORD_NOT,/* \W */ REGEXP_OPCODE_NO_CHAR,/* \@ */ + REGEXP_OPCODE_ERROR, // not used } regExpPrivateSection_te; class UniChar