From b8df5cc3abef284fff491a536b58f453ef6cb4a5 Mon Sep 17 00:00:00 2001 From: Markus Frank <Markus.Frank@cern.ch> Date: Mon, 21 Nov 2022 11:13:12 +0100 Subject: [PATCH] Test properties in DDDigi --- DDCore/include/DD4hep/GrammarParsed.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/DDCore/include/DD4hep/GrammarParsed.h b/DDCore/include/DD4hep/GrammarParsed.h index 9b2c09dd2..553ef2265 100644 --- a/DDCore/include/DD4hep/GrammarParsed.h +++ b/DDCore/include/DD4hep/GrammarParsed.h @@ -85,6 +85,16 @@ namespace dd4hep { /// Item evaluator template <typename T> inline int eval_item(T* ptr, std::string val) { + try { + T temp; + int sc = ::dd4hep::Parsers::parse(temp,val); + if ( sc ) { + *ptr = temp; + return 1; + } + } + catch (...) { + } auto result = grammar_evaluate_item(val); if (result.first != tools::Evaluator::OK) { return 0; @@ -272,6 +282,7 @@ namespace dd4hep { namespace dd4hep { namespace detail { \ template<> int grammar_eval<xx>(const BasicGrammar&, void* _p, const std::string& _v) { return func ((xx*)_p,_v); }}} + #define DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(serial,xx) \ namespace dd4hep { \ template class Grammar< xx >; \ -- GitLab