Sim: Rename Value field's "principal value" to "primary value"
This commit is contained in:
parent
d06155f6af
commit
d14de1ce78
|
@ -67,7 +67,7 @@ namespace SIM_MODEL_PARSER
|
|||
|
||||
template <typename Rule> struct fieldInferValueSelector : std::false_type {};
|
||||
template <> struct fieldInferValueSelector<fieldInferValueType> : std::true_type {};
|
||||
template <> struct fieldInferValueSelector<fieldInferValuePrincipalValue> : std::true_type {};
|
||||
template <> struct fieldInferValueSelector<fieldInferValuePrimaryValue> : std::true_type {};
|
||||
template <> struct fieldInferValueSelector<number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>> : std::true_type {};
|
||||
template <> struct fieldInferValueSelector<fieldParamValuePairs> : std::true_type {};
|
||||
}
|
||||
|
@ -1182,7 +1182,7 @@ void SIM_MODEL::doReadDataFields( unsigned aSymbolPinCount, const std::vector<T>
|
|||
|
||||
template <typename T>
|
||||
void SIM_MODEL::InferredReadDataFields( unsigned aSymbolPinCount, const std::vector<T>* aFields,
|
||||
bool aAllowPrincipalValueWithoutName )
|
||||
bool aAllowPrimaryValueWithoutName )
|
||||
{
|
||||
// TODO: Make a subclass SIM_MODEL_NONE.
|
||||
if( GetType() == SIM_MODEL::TYPE::NONE )
|
||||
|
@ -1208,9 +1208,9 @@ void SIM_MODEL::InferredReadDataFields( unsigned aSymbolPinCount, const std::vec
|
|||
|
||||
for( const auto& node : root->children )
|
||||
{
|
||||
if( node->is_type<SIM_MODEL_PARSER::fieldInferValuePrincipalValue>() )
|
||||
if( node->is_type<SIM_MODEL_PARSER::fieldInferValuePrimaryValue>() )
|
||||
{
|
||||
if( aAllowPrincipalValueWithoutName )
|
||||
if( aAllowPrimaryValueWithoutName )
|
||||
{
|
||||
for( const auto& subnode : node->children )
|
||||
{
|
||||
|
@ -1224,7 +1224,7 @@ void SIM_MODEL::InferredReadDataFields( unsigned aSymbolPinCount, const std::vec
|
|||
else
|
||||
{
|
||||
THROW_IO_ERROR(
|
||||
wxString::Format( _( "Simulation model of type '%s' cannot have a principal value (which is '%s') in Value field" ),
|
||||
wxString::Format( _( "Simulation model of type '%s' cannot have a primary value (which is '%s') in Value field" ),
|
||||
GetTypeInfo().fieldValue,
|
||||
node->string() ) );
|
||||
}
|
||||
|
|
|
@ -83,24 +83,24 @@ namespace SIM_MODEL_GRAMMAR
|
|||
tao::pegtl::eof> {};
|
||||
|
||||
struct fieldInferValueType : plus<upper> {};
|
||||
struct fieldInferValuePrincipalValue : seq<// HACK: Because `number` matches empty string,
|
||||
// ensure it is not empty.
|
||||
at<sor<tao::pegtl::digit,
|
||||
seq<one<'.'>>,
|
||||
tao::pegtl::digit>>,
|
||||
struct fieldInferValuePrimaryValue : seq<// HACK: Because `number` matches empty string,
|
||||
// ensure it is not empty.
|
||||
at<sor<tao::pegtl::digit,
|
||||
seq<one<'.'>>,
|
||||
tao::pegtl::digit>>,
|
||||
// END HACK.
|
||||
number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>,
|
||||
number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>,
|
||||
// Hackish: match anything until param-value pairs.
|
||||
// Because the user may want to write something like
|
||||
// "10k 30% 30mW w=0.4", but we care only about the
|
||||
// "10k" and "w=0.4".
|
||||
star<not_at<sep,
|
||||
fieldParamValuePairs>,
|
||||
any>> {};
|
||||
star<not_at<sep,
|
||||
fieldParamValuePairs>,
|
||||
any>> {};
|
||||
struct fieldInferValue : sor<seq<fieldInferValueType,
|
||||
opt<sep,
|
||||
fieldParamValuePairs>>,
|
||||
seq<opt<fieldInferValuePrincipalValue>,
|
||||
seq<opt<fieldInferValuePrimaryValue>,
|
||||
opt<sep>,
|
||||
opt<fieldParamValuePairs>>> {};
|
||||
struct fieldInferValueGrammar : must<opt<sep>,
|
||||
|
@ -113,7 +113,7 @@ namespace SIM_MODEL_GRAMMAR
|
|||
template <> inline constexpr auto errorMessage<opt<sep>> = "";
|
||||
template <> inline constexpr auto errorMessage<opt<pinSequence>> = "";
|
||||
template <> inline constexpr auto errorMessage<opt<sor<fieldInferValueType,
|
||||
fieldInferValuePrincipalValue>>> = "";
|
||||
fieldInferValuePrimaryValue>>> = "";
|
||||
template <> inline constexpr auto errorMessage<one<'='>> =
|
||||
"expected '='";
|
||||
template <> inline constexpr auto errorMessage<sor<quotedString,
|
||||
|
@ -123,7 +123,7 @@ namespace SIM_MODEL_GRAMMAR
|
|||
"expected parameter=value pairs";
|
||||
template <> inline constexpr auto errorMessage<opt<fieldParamValuePairs>> = "";
|
||||
template <> inline constexpr auto errorMessage<fieldInferValue> =
|
||||
"expected parameter=value pairs, together possibly preceded by a type or principal value";
|
||||
"expected parameter=value pairs, together possibly preceded by a type or primary value";
|
||||
template <> inline constexpr auto errorMessage<tao::pegtl::eof> =
|
||||
"expected end of string";
|
||||
|
||||
|
@ -631,7 +631,7 @@ protected:
|
|||
|
||||
template <typename T>
|
||||
void InferredReadDataFields( unsigned aSymbolPinCount, const std::vector<T>* aFields,
|
||||
bool aAllowPrincipalValueWithoutName = false );
|
||||
bool aAllowPrimaryValueWithoutName = false );
|
||||
std::vector<PARAM> m_params;
|
||||
const SIM_MODEL* m_baseModel;
|
||||
|
||||
|
|
Loading…
Reference in New Issue