Allow vector param values.

Fixes https://gitlab.com/kicad/code/kicad/issues/13431
This commit is contained in:
Jeff Young 2023-01-13 21:58:45 +00:00
parent 453f1f393e
commit e7e2085b2a
1 changed files with 10 additions and 5 deletions

View File

@ -99,10 +99,14 @@ namespace SPICE_GRAMMAR
TAO_PEGTL_ISTRING( "pchan" )>>, TAO_PEGTL_ISTRING( "pchan" )>>,
plus<alpha>> {}; plus<alpha>> {};
struct numparamBracedExpr : seq<one<'{'>, struct vectorExpr : seq<one<'['>,
star<sor<numparamBracedExpr, star<not_one<']'>>,
not_one<'}'>>>, one<']'>> {};
one<'}'>> {};
struct bracedExpr : seq<one<'{'>,
star<sor<bracedExpr,
not_one<'}'>>>,
one<'}'>> {};
// Ngspice has some heuristic logic to allow + and - in tokens. We replicate that here. // Ngspice has some heuristic logic to allow + and - in tokens. We replicate that here.
struct tokenStart : seq<opt<one<'+', '-'>>, struct tokenStart : seq<opt<one<'+', '-'>>,
@ -120,7 +124,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. // parameter names, which we need to skip.
struct param : identifier {}; struct param : identifier {};
struct paramValue : sor<numparamBracedExpr, struct paramValue : sor<bracedExpr,
vectorExpr,
token> {}; token> {};
struct paramValuePair : seq<param, struct paramValuePair : seq<param,