From 8582198e7cd7c3e1348f324d46c01459b577c700 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sun, 28 Jul 2013 20:00:18 +0100 Subject: [PATCH] Issue #28 work. Converted requirement and incompatibility messages are now labelled as such. --- src/backend/legacy-parser.h | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/backend/legacy-parser.h b/src/backend/legacy-parser.h index 9a21e72d..b891f843 100644 --- a/src/backend/legacy-parser.h +++ b/src/backend/legacy-parser.h @@ -69,8 +69,8 @@ namespace boss { add //New Message keywords. ("say",g_message_say) ("tag",g_message_tag) - ("req",g_message_say) - ("inc", g_message_say) + // ("req",g_message_say) + // ("inc", g_message_say) ("dirty",g_message_warn) ("warn",g_message_warn) ("error",g_message_error) @@ -181,7 +181,7 @@ namespace boss { pluginMessages %= ( +qi::eol - >> pluginMessage % +qi::eol + >> ( pluginMessage | pluginReqMessage | pluginIncMessage ) % +qi::eol ) | qi::eps [qi::_1 = noMessages]; pluginMessage = @@ -191,6 +191,30 @@ namespace boss { >> charString) [phoenix::bind(&LegacyMasterlistGrammar::MakeMessage, this, qi::_val, qi::_1, qi::_2, qi::_3)] //The double >> matters. A single > doesn't work. ; + pluginReqMessage = + ( + conditionals [phoenix::ref(lastConditional) = qi::_1] + >> reqMessageKeyword + >> ':' + >> charString[qi::_1 = "Requires: " + qi::_1] + ) [phoenix::bind(&LegacyMasterlistGrammar::MakeMessage, this, qi::_val, qi::_1, qi::_2, qi::_3)] //The double >> matters. A single > doesn't work. + ; + + pluginIncMessage = + ( + conditionals [phoenix::ref(lastConditional) = qi::_1] + >> incMessageKeyword + >> ':' + >> charString[qi::_1 = "Incompatible with: " + qi::_1] + ) [phoenix::bind(&LegacyMasterlistGrammar::MakeMessage, this, qi::_val, qi::_1, qi::_2, qi::_3)] //The double >> matters. A single > doesn't work. + ; + + incMessageKeyword = + unicode::no_case[qi::lit("inc")] [qi::_val = g_message_say]; + + reqMessageKeyword = + unicode::no_case[qi::lit("req")] [qi::_val = g_message_say]; + charString %= qi::lexeme[+(unicode::char_ - qi::eol)]; //String, with no skipper. messageKeyword %= unicode::no_case[masterlistMsgKey]; @@ -318,8 +342,8 @@ namespace boss { qi::rule > listVar, groupLine; qi::rule > listPlugin; qi::rule(), Skipper > pluginMessages; - qi::rule > globalMessage, pluginMessage; - qi::rule messageKeyword; + qi::rule > globalMessage, pluginMessage, pluginReqMessage, pluginIncMessage; + qi::rule messageKeyword, reqMessageKeyword, incMessageKeyword; qi::rule > charString, andOr, conditional, conditionals, ifIfnot, functCondition, variable, file, checksum, version, comparator, regex, language; std::map varConditionMap;