diff --git a/eeschema/sim/sim_model_subckt.cpp b/eeschema/sim/sim_model_subckt.cpp index 89cf407f81..5fc4571499 100644 --- a/eeschema/sim/sim_model_subckt.cpp +++ b/eeschema/sim/sim_model_subckt.cpp @@ -41,6 +41,7 @@ namespace SIM_MODEL_SUBCKT_SPICE_PARSER template <> struct spiceUnitSelector : std::true_type {}; template <> struct spiceUnitSelector : std::true_type {}; template <> struct spiceUnitSelector : std::true_type {}; + template <> struct spiceUnitSelector : std::true_type {}; template <> struct spiceUnitSelector> : std::true_type {}; template <> struct spiceUnitSelector> @@ -111,22 +112,17 @@ void SPICE_MODEL_PARSER_SUBCKT::ReadModel( const SIM_LIBRARY_SPICE& aLibrary, model.AddParam( *model.m_paramInfos.back() ); } + else if( subsubnode->is_type() ) + { + wxASSERT( model.m_paramInfos.size() > 0 ); + model.m_paramInfos.back()->defaultValue = subsubnode->string(); + } else { wxFAIL_MSG( "Unhandled parse tree subsubnode" ); } } } - else if( subnode->is_type< - SIM_MODEL_SUBCKT_SPICE_PARSER::number>() - || subnode->is_type< - SIM_MODEL_SUBCKT_SPICE_PARSER::number>() ) - { - wxASSERT( model.m_paramInfos.size() > 0 ); - model.m_paramInfos.back()->defaultValue = subnode->string(); - } } } else diff --git a/eeschema/sim/spice_grammar.h b/eeschema/sim/spice_grammar.h index 2696eb9eec..1a7fcfee6a 100644 --- a/eeschema/sim/spice_grammar.h +++ b/eeschema/sim/spice_grammar.h @@ -110,7 +110,6 @@ namespace SPICE_GRAMMAR // Param names cannot be `token` because LTspice models contain spurious values without // parameter names, which we need to skip. struct param : identifier {}; - struct paramValue : token {}; struct paramValuePair : seq, + struct dotSubcktParamValuePair : seq`s match Ngspice's + // behavior. + star, + one<'='>, + star, + paramValue> {}; + struct dotSubcktParamValuePairs : list {}; + struct dotSubcktParams : seq>, + dotSubcktParamValuePairs> {}; + struct dotSubcktPinName : seq, plus, any>> {}; struct dotSubcktPinSequence : list {}; - struct dotSubcktParams : seq {}; struct dotSubcktEnd : seq> {}; struct spiceUnit;