Beispiel #1
0
 bool RawKeyword::tryParseKeyword(const std::string& keywordCandidate, std::string& result) {
     result = boost::trim_right_copy_if(keywordCandidate.substr(0, 8), boost::is_any_of("- \t"));
     if (isValidKeyword(result))
         return true;
     else
         return false;
 }
Beispiel #2
0
 void RawKeyword::setKeywordName(const std::string& name) {
     m_name = boost::algorithm::trim_right_copy(name);
     if (!isValidKeyword(m_name)) {
         throw std::invalid_argument("Not a valid keyword:" + name);
     } else if (m_name.size() > Opm::RawConsts::maxKeywordLength) {
         throw std::invalid_argument("Too long keyword:" + name);
     } else if (boost::algorithm::trim_left_copy(m_name) != m_name) {
         throw std::invalid_argument("Illegal whitespace start of keyword:" + name);
     }
 }
Beispiel #3
0
void
RuleParser::getKeyType(const UnicodeString& token, tokenType& keyType, UErrorCode &status)
{
    if (U_FAILURE(status)) {
        return;
    }
    if ( keyType==tNumber) {
    }
    else if (0 == token.compare(PK_VAR_N, 1)) {
        keyType = tVariableN;
    }
    else if (0 == token.compare(PK_IS, 2)) {
        keyType = tIs;
    }
    else if (0 == token.compare(PK_AND, 3)) {
        keyType = tAnd;
    }
    else if (0 == token.compare(PK_IN, 2)) {
        keyType = tIn;
    }
    else if (0 == token.compare(PK_WITHIN, 6)) {
        keyType = tWithin;
    }
    else if (0 == token.compare(PK_NOT, 3)) {
        keyType = tNot;
    }
    else if (0 == token.compare(PK_MOD, 3)) {
        keyType = tMod;
    }
    else if (0 == token.compare(PK_OR, 2)) {
        keyType = tOr;
    }
    else if ( isValidKeyword(token) ) {
        keyType = tKeyword;
    }
    else {
        status = U_UNEXPECTED_TOKEN;
    }
}
Beispiel #4
0
 bool HelpersQmlWrapper::isKeywordValid(const QString &keyword) const {
     return isValidKeyword(keyword);
 }