diff --git a/eci/Lexer.cpp b/eci/Lexer.cpp index c770134..9e12fa4 100644 --- a/eci/Lexer.cpp +++ b/eci/Lexer.cpp @@ -18,20 +18,35 @@ eci::Lexer::~Lexer() { } void eci::Lexer::append(int32_t _tokenId, const std::string& _regularExpression) { - m_searchList.insert(std::make_pair(_tokenId, std::regex(_regularExpression))); + try { + m_searchList.insert(std::make_pair(_tokenId, std::regex(_regularExpression, std::regex_constants::basic))); + } catch (std::regex_error e) { + ECI_ERROR("plop : " << e.what() << " from '" << _regularExpression << "'"); + } } eci::LexerResult eci::Lexer::interprete(const std::string& _data) { eci::LexerResult result; + ECI_INFO("Parse : \n" << _data); for (auto &it : m_searchList) { ECI_INFO("Parse RegEx : " << it.first);// << " : '" << it.second.str() << "'"); - std::sregex_iterator it_search(_data.begin(), _data.end(), it.second); - std::sregex_iterator it_end; + std::smatch m; + std::regex_search (_data, m, it.second); + for (unsigned i=0; i