diff --git a/src/A3.cpp b/src/A3.cpp index 1ff492ae8..0c4ef6cb1 100644 --- a/src/A3.cpp +++ b/src/A3.cpp @@ -815,6 +815,7 @@ const A3 A3::expand (const A3& input) const { A3 expanded; std::vector ::const_iterator arg; + std::vector ::const_iterator previous = input.begin (); for (arg = input.begin (); arg != input.end (); ++arg) { // name:value --> name = value @@ -950,7 +951,9 @@ const A3 A3::expand (const A3& input) const } // word --> description ~ word - else if (arg->_category == "word") + // Note: use of previous prevents desc~foo --> desc~desc~foo + else if (arg->_category == "word" && + previous->_category != "op") { expanded.push_back (Arg ("description", "dom")); expanded.push_back (Arg ("~", "op")); @@ -971,6 +974,8 @@ const A3 A3::expand (const A3& input) const // Default --> preserve else expanded.push_back (*arg); + + previous = arg; } return expanded; diff --git a/src/E9.cpp b/src/E9.cpp index 6a646b03b..fbe2c3c93 100644 --- a/src/E9.cpp +++ b/src/E9.cpp @@ -216,12 +216,14 @@ void E9::operator_and (Term& result, Term& left, Term& right) result._category = "bool"; } +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " and " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -238,12 +240,14 @@ void E9::operator_or (Term& result, Term& left, Term& right) result._category = "bool"; } +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " or " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -263,12 +267,14 @@ void E9::operator_xor (Term& result, Term& left, Term& right) result._category = "bool"; } +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " xor " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -344,13 +350,20 @@ void E9::operator_inequal ( Term& right, bool case_sensitive) { + operator_equal (result, left, right, case_sensitive); + if (result._raw == "false") + result._raw = result._value = "true"; + else + result._raw = result._value = "false"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " != " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -397,12 +410,14 @@ void E9::operator_equal ( } } +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " = " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -419,12 +434,14 @@ void E9::operator_match ( else result._raw = result._value = "false"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " ~ " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } //////////////////////////////////////////////////////////////////////////////// @@ -451,12 +468,14 @@ void E9::operator_nomatch ( else result._raw = result._value = "false"; +/* std::cout << "# " << left._raw << "/" << left._value << "/" << left._category << " !~ " << right._raw << "/" << right._value << "/" << right._category << " --> " << result._raw << "/" << result._value << "/" << result._category << "\n"; +*/ } ////////////////////////////////////////////////////////////////////////////////