src/grammar.cpp
vector<shared_ptr<MatchInfo>> Grammar::matchesRule(const shared_ptr<Rule> rule, const string & test) const {
    vector<string> words = Grammar::splitString(test, " ");
    string* wordArray = &words[0];
    vector<shared_ptr<MatchInfo>> m1 = getMatchingExpansions(rule->getRuleExpansion(), wordArray, words.size(), 0);
    unsigned int matchCount = 0;
    for (shared_ptr<MatchInfo> mi2 : m1) {
	//std::cout << "MI: " << mi2->getMatchingSection() << ", " << matchCount << ", " << printExpansionType(mi2->getExpansion().get()) << std::endl;

        if (mi2->getMatchingSection() != "") {
            matchCount++;
        }
    }
    if(matchCount != words.size()) { // Must match all the words!
        m1.clear();
    }

    return m1;
}
/**
  * Matches a string of words (test) against the specified Rule.
  * If the test string does not match the Rule, will return a vector with a length/size of 0.
  * \param [in] rule Rule being matched against
  * \param [in] test std::string being matched
  * \return vector<shared_ptr<MatchInfo>> - vector of MatchInfo objects. Can have a size of 0 if test string does not match.
  */
Matches a string of words (test) against the specified Rule.
If the test string does not match the Rule, will return a vector with a length/size of 0.
\param [in] rule Rule being matched against
\param [in] test std::string being matched
\return vector> - vector of MatchInfo objects. Can have a size of 0 if test string does not match.
Matches a string of words ( test ) against the specified Rule . If the test string does not match the Rule will return a vector with a length / size of 0 . \ param [ in ] rule Rule being matched against \ param [ in ] test std :: string being matched \ return vector > - vector of MatchInfo objects . Can have a size of 0 if test string does not match .
vector<shared_ptr<MatchInfo>> Grammar::matchesRule(const shared_ptr<Rule> rule, const string & test) const {
    vector<string> words = Grammar::splitString(test, " ");
    string* wordArray = &words[0];
    vector<shared_ptr<MatchInfo>> m1 = getMatchingExpansions(rule->getRuleExpansion(), wordArray, words.size(), 0);
    unsigned int matchCount = 0;
    for (shared_ptr<MatchInfo> mi2 : m1) {
        if (mi2->getMatchingSection() != "") {
            matchCount++;
        }
    }
    if(matchCount != words.size()) { 
        m1.clear();
    }
    return m1;
}
vector < shared_ptr < MatchInfo > > Grammar :: matchesRule ( const shared_ptr < Rule > rule , const string & test ) const { vector < string > words = Grammar :: splitString ( test , " " ) ; string * wordArray = & words [ 0 ] ; vector < shared_ptr < MatchInfo > > m1 = getMatchingExpansions ( rule -> getRuleExpansion ( ) , wordArray , words . size ( ) , 0 ) ; unsigned int matchCount = 0 ; for ( shared_ptr < MatchInfo > mi2 : m1 ) { if ( mi2 -> getMatchingSection ( ) != " " ) { matchCount ++ ; } } if ( matchCount != words . size ( ) ) { m1 . clear ( ) ; } return m1 ; }
Matches a string of words (test) against the specified Rule.
Matches a string of words ( test ) against the specified Rule .
//std::cout << "MI: " << mi2->getMatchingSection() << ", " << matchCount << ", " << printExpansionType(mi2->getExpansion().get()) << std::endl; // Must match all the words!