From d48ec3aa8c832841b8a22ef2d9ae8064db52899a Mon Sep 17 00:00:00 2001 From: Mikolaj Wielgus Date: Sat, 17 Sep 2022 02:17:54 +0200 Subject: [PATCH] Sim: Slightly simplify grammars --- eeschema/sim/sim_model.h | 22 ++++++------------- eeschema/sim/spice_grammar.h | 42 +++++------------------------------- 2 files changed, 11 insertions(+), 53 deletions(-) diff --git a/eeschema/sim/sim_model.h b/eeschema/sim/sim_model.h index bca8ded446..740e01880c 100644 --- a/eeschema/sim/sim_model.h +++ b/eeschema/sim/sim_model.h @@ -49,9 +49,7 @@ namespace SIM_MODEL_GRAMMAR struct legacyPinNumber : digits {}; - struct legacyPinSequence : seq, - star> {}; + struct legacyPinSequence : list {}; struct legacyPinSequenceGrammar : must {}; @@ -59,12 +57,9 @@ namespace SIM_MODEL_GRAMMAR struct pinNumber : plus, any> {}; - struct pinSequence : seq, - star> {}; - + struct pinSequence : list {}; struct pinSequenceGrammar : must, - pinSequence, + opt, opt, tao::pegtl::eof> {}; @@ -90,17 +85,12 @@ namespace SIM_MODEL_GRAMMAR opt, one<'='>, opt, - sor, - //number, - quotedString, + sor> {}; - struct fieldParamValuePairs : seq, - star> {}; - + struct fieldParamValuePairs : list {}; struct fieldParamValuePairsGrammar : must, - fieldParamValuePairs, + opt, opt, tao::pegtl::eof> {}; } diff --git a/eeschema/sim/spice_grammar.h b/eeschema/sim/spice_grammar.h index 0bc4b0af58..8cc7bf9418 100644 --- a/eeschema/sim/spice_grammar.h +++ b/eeschema/sim/spice_grammar.h @@ -107,33 +107,10 @@ namespace SPICE_GRAMMAR struct paramValuePair : seq {}; + struct paramValuePairs : list {}; - struct paramValuePairs : seq, - star> {}; struct modelName : plus, any> {}; - /*sor>> {};*/ - /*seq>>> {};*/ - /*struct dotModelType : sor {};*/ + struct dotModelType : plus {}; struct dotModel : seq, TAO_PEGTL_ISTRING( ".model" ), @@ -141,15 +118,8 @@ namespace SPICE_GRAMMAR modelName, sep, dotModelType, - opt, - one<'('>, - opt, - paramValuePairs, - opt, - // Ngspice doesn't require the parentheses to match, though. - one<')'>>, - seq>>, + opt, opt, newline> {}; @@ -157,9 +127,7 @@ namespace SPICE_GRAMMAR struct dotSubcktPinName : seq, plus, any>> {}; - struct dotSubcktPinSequence : seq, - star> {}; + struct dotSubcktPinSequence : list {}; struct dotSubcktParams : seq {};