From d92b12b3e1c9c21c566f2357c51dd259a3d24cf3 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Sun, 20 Jul 2014 20:21:33 +0200 Subject: [PATCH] [DEV] add test for regExp --- eci/Lexer.cpp | 20 +------------------- eci/eci.cpp | 4 ++++ eci/lang/ParserCpp.cpp | 1 + 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/eci/Lexer.cpp b/eci/Lexer.cpp index 4b369cd..7b21495 100644 --- a/eci/Lexer.cpp +++ b/eci/Lexer.cpp @@ -29,26 +29,8 @@ eci::LexerResult eci::Lexer::interprete(const std::string& _data) { ECI_INFO("Parse RegEx : " << it.first << " : " << it.second.getRegExDecorated()); if (it.second.parse(_data, 0, _data.size()) == true) { ECI_INFO(" match [" << it.second.start() << ".." << it.second.stop() << "] "); - ECI_INFO(" ==> '" << std::string(_data, it.second.start(), it.second.stop()) << "'"); + ECI_INFO(" ==> '" << std::string(_data, it.second.start(), it.second.stop()-it.second.start()) << "'"); } - /* - std::smatch m; - std::regex_search (_data, m, it.second); - for (unsigned i=0; i int main(int argc, char** argv) { + etk::log::setLevel(etk::log::logLevelDebug); + etk::log::setLevel(etk::log::logLevelInfo); ECI_INFO("Start Application interpeter languages"); if (argc<=1) { ECI_CRITICAL("need the file to parse"); @@ -19,6 +21,8 @@ int main(int argc, char** argv) { } eci::ParserCpp tmpParser; std::string data = "/* plop */ \n int eee = 22; // error value \nint main(void) {\n return 0;\n}\n";//etk::FSNodeReadAllData(argv[1]); + //std::string data = "alpha /* plop */ test"; + //std::string data = "pp \n // qdfqdfsdf \nde"; tmpParser.parse(data); return 0; diff --git a/eci/lang/ParserCpp.cpp b/eci/lang/ParserCpp.cpp index 1c0b828..2e71794 100644 --- a/eci/lang/ParserCpp.cpp +++ b/eci/lang/ParserCpp.cpp @@ -18,6 +18,7 @@ enum cppTokenList { eci::ParserCpp::ParserCpp() { m_lexer.append(tokenCppMultilineComment, "/\\*.*\\*/"); m_lexer.append(tokenCppSingleLineComment, "//.*$"); + m_lexer.append(82939, "/\\*.*"); m_lexer.append(tokenCppString, "[a-z]"); }