Sim: Slightly simplify grammars
This commit is contained in:
parent
2a0c31ed97
commit
d48ec3aa8c
|
@ -49,9 +49,7 @@ namespace SIM_MODEL_GRAMMAR
|
||||||
|
|
||||||
|
|
||||||
struct legacyPinNumber : digits {};
|
struct legacyPinNumber : digits {};
|
||||||
struct legacyPinSequence : seq<opt<legacyPinNumber>,
|
struct legacyPinSequence : list<legacyPinNumber, sep> {};
|
||||||
star<sep,
|
|
||||||
legacyPinNumber>> {};
|
|
||||||
|
|
||||||
struct legacyPinSequenceGrammar : must<legacyPinSequence,
|
struct legacyPinSequenceGrammar : must<legacyPinSequence,
|
||||||
tao::pegtl::eof> {};
|
tao::pegtl::eof> {};
|
||||||
|
@ -59,12 +57,9 @@ namespace SIM_MODEL_GRAMMAR
|
||||||
|
|
||||||
struct pinNumber : plus<not_at<sep>,
|
struct pinNumber : plus<not_at<sep>,
|
||||||
any> {};
|
any> {};
|
||||||
struct pinSequence : seq<opt<pinNumber>,
|
struct pinSequence : list<pinNumber, sep> {};
|
||||||
star<sep,
|
|
||||||
pinNumber>> {};
|
|
||||||
|
|
||||||
struct pinSequenceGrammar : must<opt<sep>,
|
struct pinSequenceGrammar : must<opt<sep>,
|
||||||
pinSequence,
|
opt<pinSequence>,
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
tao::pegtl::eof> {};
|
tao::pegtl::eof> {};
|
||||||
|
|
||||||
|
@ -90,17 +85,12 @@ namespace SIM_MODEL_GRAMMAR
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
one<'='>,
|
one<'='>,
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
sor<//number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>,
|
sor<quotedString,
|
||||||
//number<SIM_VALUE::TYPE_INT, NOTATION::SI>,
|
|
||||||
quotedString,
|
|
||||||
unquotedString>> {};
|
unquotedString>> {};
|
||||||
|
|
||||||
struct fieldParamValuePairs : seq<opt<fieldParamValuePair>,
|
struct fieldParamValuePairs : list<fieldParamValuePair, sep> {};
|
||||||
star<sep,
|
|
||||||
fieldParamValuePair>> {};
|
|
||||||
|
|
||||||
struct fieldParamValuePairsGrammar : must<opt<sep>,
|
struct fieldParamValuePairsGrammar : must<opt<sep>,
|
||||||
fieldParamValuePairs,
|
opt<fieldParamValuePairs>,
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
tao::pegtl::eof> {};
|
tao::pegtl::eof> {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,33 +107,10 @@ namespace SPICE_GRAMMAR
|
||||||
struct paramValuePair : seq<param,
|
struct paramValuePair : seq<param,
|
||||||
sep,
|
sep,
|
||||||
paramValue> {};
|
paramValue> {};
|
||||||
|
struct paramValuePairs : list<paramValuePair, sep> {};
|
||||||
|
|
||||||
struct paramValuePairs : seq<opt<paramValuePair>,
|
|
||||||
star<sep,
|
|
||||||
paramValuePair>> {};
|
|
||||||
struct modelName : plus<not_at<garbage>, any> {};
|
struct modelName : plus<not_at<garbage>, any> {};
|
||||||
/*sor<alnum,
|
|
||||||
one<'!', '#', '$', '%', '[', ']', '_'>>> {};*/
|
|
||||||
/*seq<alpha,
|
|
||||||
star<sor<alnum,
|
|
||||||
one<'!', '#', '$', '%', '[', ']', '_'>>>> {};*/
|
|
||||||
/*struct dotModelType : sor<TAO_PEGTL_ISTRING( "R" ),
|
|
||||||
TAO_PEGTL_ISTRING( "C" ),
|
|
||||||
TAO_PEGTL_ISTRING( "L" ),
|
|
||||||
TAO_PEGTL_ISTRING( "SW" ),
|
|
||||||
TAO_PEGTL_ISTRING( "CSW" ),
|
|
||||||
TAO_PEGTL_ISTRING( "URC" ),
|
|
||||||
TAO_PEGTL_ISTRING( "LTRA" ),
|
|
||||||
TAO_PEGTL_ISTRING( "D" ),
|
|
||||||
TAO_PEGTL_ISTRING( "NPN" ),
|
|
||||||
TAO_PEGTL_ISTRING( "PNP" ),
|
|
||||||
TAO_PEGTL_ISTRING( "NJF" ),
|
|
||||||
TAO_PEGTL_ISTRING( "PJF" ),
|
|
||||||
TAO_PEGTL_ISTRING( "NMOS" ),
|
|
||||||
TAO_PEGTL_ISTRING( "PMOS" ),
|
|
||||||
TAO_PEGTL_ISTRING( "NMF" ),
|
|
||||||
TAO_PEGTL_ISTRING( "PMF" ),
|
|
||||||
TAO_PEGTL_ISTRING( "VDMOS" )> {};*/
|
|
||||||
struct dotModelType : plus<alpha> {};
|
struct dotModelType : plus<alpha> {};
|
||||||
struct dotModel : seq<opt<sep>,
|
struct dotModel : seq<opt<sep>,
|
||||||
TAO_PEGTL_ISTRING( ".model" ),
|
TAO_PEGTL_ISTRING( ".model" ),
|
||||||
|
@ -141,15 +118,8 @@ namespace SPICE_GRAMMAR
|
||||||
modelName,
|
modelName,
|
||||||
sep,
|
sep,
|
||||||
dotModelType,
|
dotModelType,
|
||||||
opt<sor<seq<opt<sep>,
|
opt<sep,
|
||||||
one<'('>,
|
paramValuePairs>,
|
||||||
opt<sep>,
|
|
||||||
paramValuePairs,
|
|
||||||
opt<sep>,
|
|
||||||
// Ngspice doesn't require the parentheses to match, though.
|
|
||||||
one<')'>>,
|
|
||||||
seq<sep,
|
|
||||||
paramValuePairs>>>,
|
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
newline> {};
|
newline> {};
|
||||||
|
|
||||||
|
@ -157,9 +127,7 @@ namespace SPICE_GRAMMAR
|
||||||
struct dotSubcktPinName : seq<not_at<TAO_PEGTL_ISTRING( "params:" )>,
|
struct dotSubcktPinName : seq<not_at<TAO_PEGTL_ISTRING( "params:" )>,
|
||||||
plus<not_at<space>,
|
plus<not_at<space>,
|
||||||
any>> {};
|
any>> {};
|
||||||
struct dotSubcktPinSequence : seq<opt<dotSubcktPinName>,
|
struct dotSubcktPinSequence : list<dotSubcktPinName, sep> {};
|
||||||
star<sep,
|
|
||||||
dotSubcktPinName>> {};
|
|
||||||
struct dotSubcktParams : seq<TAO_PEGTL_ISTRING( "params:" ),
|
struct dotSubcktParams : seq<TAO_PEGTL_ISTRING( "params:" ),
|
||||||
sep,
|
sep,
|
||||||
paramValuePairs> {};
|
paramValuePairs> {};
|
||||||
|
|
Loading…
Reference in New Issue