Reimplement bracedExpr and token lists for CPL models only.
This prevents the incompatibility between token lists
and single-token param-value pairs.
(cherry picked from commit 086e609c3d
)
This commit is contained in:
parent
a96e16b766
commit
f52a51dce3
|
@ -122,10 +122,8 @@ namespace SPICE_GRAMMAR
|
||||||
// Param names cannot be `token` because LTspice models contain spurious values without
|
// Param names cannot be `token` because LTspice models contain spurious values without
|
||||||
// parameter names, which we need to skip, and because tokens can include a very limited
|
// parameter names, which we need to skip, and because tokens can include a very limited
|
||||||
// subset of un-braced expressions
|
// subset of un-braced expressions
|
||||||
// Note: we must support lists of both braced expressions and tokens for CPL models...
|
|
||||||
// ... but lists of tokens breaks cases where we have single-token name/values.
|
|
||||||
struct param : identifier {};
|
struct param : identifier {};
|
||||||
struct paramValue : sor<list<bracedExpr, opt<one<' '>>>,
|
struct paramValue : sor<bracedExpr,
|
||||||
vectorExpr,
|
vectorExpr,
|
||||||
token> {};
|
token> {};
|
||||||
|
|
||||||
|
@ -133,6 +131,16 @@ namespace SPICE_GRAMMAR
|
||||||
sep,
|
sep,
|
||||||
paramValue> {};
|
paramValue> {};
|
||||||
struct paramValuePairs : list<paramValuePair, sep> {};
|
struct paramValuePairs : list<paramValuePair, sep> {};
|
||||||
|
|
||||||
|
struct cplSep : opt<one<' '>> {};
|
||||||
|
struct cplParamValue : sor<list<bracedExpr, cplSep>,
|
||||||
|
vectorExpr,
|
||||||
|
list<token, cplSep>> {};
|
||||||
|
struct cplParamValuePair : seq<param,
|
||||||
|
sep,
|
||||||
|
cplParamValue> {};
|
||||||
|
struct cplParamValuePairs : list<cplParamValuePair, sep> {};
|
||||||
|
|
||||||
struct dotModelAko : seq<opt<sep>,
|
struct dotModelAko : seq<opt<sep>,
|
||||||
if_must<seq<TAO_PEGTL_ISTRING( ".model" ),
|
if_must<seq<TAO_PEGTL_ISTRING( ".model" ),
|
||||||
sep,
|
sep,
|
||||||
|
@ -158,6 +166,17 @@ namespace SPICE_GRAMMAR
|
||||||
paramValuePairs>,
|
paramValuePairs>,
|
||||||
opt<sep>,
|
opt<sep>,
|
||||||
newline>> {};
|
newline>> {};
|
||||||
|
|
||||||
|
struct dotModelCPL : seq<opt<sep>,
|
||||||
|
if_must<TAO_PEGTL_ISTRING( ".model" ),
|
||||||
|
sep,
|
||||||
|
modelName,
|
||||||
|
sep,
|
||||||
|
TAO_PEGTL_ISTRING( "CPL" ),
|
||||||
|
opt<sep,
|
||||||
|
cplParamValuePairs>,
|
||||||
|
opt<sep>,
|
||||||
|
newline>> {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue