Internalize UDQ tokens in the UDQ define keyword
This commit is contained in:
parent
de9a93377c
commit
bd0c0f6356
@ -58,12 +58,10 @@ public:
|
|||||||
UDQWellSet eval_wells(const UDQContext& context) const;
|
UDQWellSet eval_wells(const UDQContext& context) const;
|
||||||
UDQSet eval(const UDQContext& context) const;
|
UDQSet eval(const UDQContext& context) const;
|
||||||
const std::string& keyword() const;
|
const std::string& keyword() const;
|
||||||
/*
|
const std::vector<std::string>& tokens() const;
|
||||||
Should not be internalized at all - and will go away; but temporarily needed for testing.
|
|
||||||
*/
|
|
||||||
std::vector<std::string> tokens;
|
|
||||||
UDQVarType var_type() const;
|
UDQVarType var_type() const;
|
||||||
private:
|
private:
|
||||||
|
std::vector<std::string> input_tokens;
|
||||||
const UDQParams& udq_params; // Beacuse of the shared RNG stream this must be a reference.
|
const UDQParams& udq_params; // Beacuse of the shared RNG stream this must be a reference.
|
||||||
std::string m_keyword;
|
std::string m_keyword;
|
||||||
std::shared_ptr<UDQASTNode> ast;
|
std::shared_ptr<UDQASTNode> ast;
|
||||||
|
@ -122,7 +122,7 @@ UDQDefine::UDQDefine(const UDQParams& udq_params,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->ast = std::make_shared<UDQASTNode>( UDQParser::parse(this->udq_params, tokens, parseContext, errors) );
|
this->ast = std::make_shared<UDQASTNode>( UDQParser::parse(this->udq_params, tokens, parseContext, errors) );
|
||||||
this->tokens = tokens;
|
this->input_tokens = tokens;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,6 +143,9 @@ UDQVarType UDQDefine::var_type() const {
|
|||||||
return this->m_var_type;
|
return this->m_var_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::vector<std::string>& UDQDefine::tokens() const {
|
||||||
|
return this->input_tokens;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& UDQDefine::keyword() const {
|
const std::string& UDQDefine::keyword() const {
|
||||||
return this->m_keyword;
|
return this->m_keyword;
|
||||||
|
@ -924,13 +924,13 @@ BOOST_AUTO_TEST_CASE(UDQPARSE_TEST1) {
|
|||||||
UDQDefine def1(udqp, "WUBHP", {"1/(WWCT", "'W1*')"});
|
UDQDefine def1(udqp, "WUBHP", {"1/(WWCT", "'W1*')"});
|
||||||
std::vector<std::string> tokens1 = {"1", "/", "(", "WWCT", "W1*", ")"};
|
std::vector<std::string> tokens1 = {"1", "/", "(", "WWCT", "W1*", ")"};
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(tokens1.begin(), tokens1.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS(tokens1.begin(), tokens1.end(),
|
||||||
def1.tokens.begin(), def1.tokens.end());
|
def1.tokens().begin(), def1.tokens().end());
|
||||||
|
|
||||||
|
|
||||||
UDQDefine def2(udqp, "WUBHP", {"2*(1", "+" , "WBHP)"});
|
UDQDefine def2(udqp, "WUBHP", {"2*(1", "+" , "WBHP)"});
|
||||||
std::vector<std::string> tokens2 = {"2", "*", "(", "1", "+", "WBHP", ")"};
|
std::vector<std::string> tokens2 = {"2", "*", "(", "1", "+", "WBHP", ")"};
|
||||||
BOOST_CHECK_EQUAL_COLLECTIONS(tokens2.begin(), tokens2.end(),
|
BOOST_CHECK_EQUAL_COLLECTIONS(tokens2.begin(), tokens2.end(),
|
||||||
def2.tokens.begin(), def2.tokens.end());
|
def2.tokens().begin(), def2.tokens().end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user