Strip the quotes when creating Actionx::Condition instance

This commit is contained in:
Joakim Hove 2021-09-30 17:17:50 +02:00
parent bd4386c79b
commit 21c53158ad
3 changed files with 6 additions and 12 deletions

View File

@ -35,12 +35,8 @@ namespace Action {
class Quantity {
public:
Quantity() = default;
explicit Quantity(const RestartIO::RstAction::Quantity& rst_quantity);
explicit Quantity(const std::string& arg) :
quantity(arg)
{}
explicit Quantity(const std::string& arg);
void add_arg(const std::string& arg);
std::string quantity;

View File

@ -123,13 +123,6 @@ ActionX::ActionX(const DeckKeyword& kw, const Actdims& actdims, std::time_t star
const auto& record = kw.getRecord(record_index);
const auto& cond_tokens = RawString::strings( record.getItem("CONDITION").getData<RawString>() );
/*
The tokens vector is passed to the internal ACTIONX parser to create
the AST used for evaluation, in that context the quotes are removed.
The m_conditions variable is a quite raw representation of the input
*only* retained in order to be able to create a restart file - here
the quotes are retained.
*/
for (const auto& token : cond_tokens)
tokens.push_back(dequote(token, kw.location()));

View File

@ -68,6 +68,11 @@ std::string strip_quotes(const std::string& s) {
}
Quantity::Quantity(const std::string& arg) :
quantity(strip_quotes(arg))
{}
Quantity::Quantity(const RestartIO::RstAction::Quantity& rst_quantity)
{
if (std::holds_alternative<std::string>(rst_quantity.quantity))