25#ifndef SPICE_GRAMMAR_H
26#define SPICE_GRAMMAR_H
36 struct garbage : plus<one<' ', '\t', '=', '(', ')', ','>> {};
38 struct trailers : plus<one<' ', '\t', '\v', '\f'>> {};
66 seq<star<not_at<eolf>,
67 not_at<string<'\\', '\\'>,
83 sor<backslashContinuation,
84 commentBackslashContinuation,
90 struct sep : sor<plus<continuation>,
93 struct modelName : plus<not_at<garbageOrEolf>, any> {};
96 seq<TAO_PEGTL_ISTRING( "vdmos" ),
98 sor<TAO_PEGTL_ISTRING( "nchan" ),
99 TAO_PEGTL_ISTRING( "pchan" )>>,
100 plus<not_at<garbageOrEolf>, any>> {};
112 opt<seq<star<sor<tao::pegtl::digit,
115 opt<one<'+', '-'>>>>> {};
119 not_at<backslashContinuation>,
120 not_one<' ', '\t', '=', '(', ')', ',', ';'>>> {};
138 list<token, cplSep>> {};
145 if_must<seq<TAO_PEGTL_ISTRING( ".model" ),
149 TAO_PEGTL_ISTRING( "ako:" )>,
160 if_must<seq<TAO_PEGTL_ISTRING( ".model" ),
164 TAO_PEGTL_ISTRING( "CPL" )>,
171 if_must<TAO_PEGTL_ISTRING( ".model" ),
185 opt<plusContinuation>,
187 opt<plusContinuation>,
193 dotSubcktParamValuePairs> {};
195 plus<not_at<space>, any>> {};
198 TAO_PEGTL_ISTRING( ".ends" ),
202 if_must<TAO_PEGTL_ISTRING( ".subckt" ),
206 dotSubcktPinSequence>,
224 TAO_PEGTL_ISTRING( ".control" ),
225 until<TAO_PEGTL_ISTRING( ".endc" )>,
232 TAO_PEGTL_ISTRING( ".title" ),
243 TAO_PEGTL_ISTRING( ".inc" ),
244 star<not_at<garbageOrEolf>, any>,
247 dotIncludePathWithoutQuotes,
250 dotIncludePathWithoutApostrophes,
292 template <
typename>
inline constexpr const char*
errorMessage =
nullptr;
296 "expected token separator (one or more whitespace, parenthesis, '=', ',', or line continuation)";
297 template <>
inline constexpr auto errorMessage<opt<sep>> =
300 "expected model name";
302 "expected model type";
303 template <>
inline constexpr auto errorMessage<opt<sep, dotModelType>> =
305 template <>
inline constexpr auto errorMessage<opt<sep, paramValuePairs>> =
307 template <>
inline constexpr auto errorMessage<opt<sep, cplParamValuePairs>> =
309 template <>
inline constexpr auto errorMessage<opt<sep, dotSubcktPinSequence>> =
311 template <>
inline constexpr auto errorMessage<opt<sep, dotSubcktParams>> =
313 template <>
inline constexpr auto errorMessage<until<dotSubcktEnd, spiceUnit>> =
314 "expected (possibly empty) sequence of Spice lines followed by an .ends line";
316 "expected Spice directive, item, subcircuit definitions, or empty or commented-out line";
318 "expected zero or more Spice directives, items, subcircuit definitions, or empty or commented-out lines";
324 template <
typename Rule>
static constexpr auto message = errorMessage<Rule>;
327 template <
typename Rule>
using control = must_if<error>::control<Rule>;
constexpr auto errorMessage< dotModelType >
constexpr auto errorMessage< spiceUnit >
constexpr auto errorMessage< sep >
constexpr auto errorMessage< spiceSource >
must_if< error >::control< Rule > control
constexpr auto errorMessage< modelName >
constexpr auto errorMessage< newline >
constexpr const char * errorMessage
static constexpr auto message
static constexpr bool raise_on_failure