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" ),
186 opt<plusContinuation>,
188 opt<plusContinuation>,
194 dotSubcktParamValuePairs> {};
197 plus<not_at<space>, any>> {};
200 TAO_PEGTL_ISTRING( ".ends" ),
204 if_must<TAO_PEGTL_ISTRING( ".subckt" ),
208 dotSubcktPinSequence>,
226 TAO_PEGTL_ISTRING( ".control" ),
227 until<TAO_PEGTL_ISTRING( ".endc" )>,
234 TAO_PEGTL_ISTRING( ".title" ),
245 TAO_PEGTL_ISTRING( ".inc" ),
246 star<not_at<garbageOrEolf>, any>,
249 dotIncludePathWithoutQuotes,
252 dotIncludePathWithoutApostrophes,
294 template <
typename>
inline constexpr const char*
errorMessage =
nullptr;
298 "expected token separator (one or more whitespace, parenthesis, '=', ',', or line continuation)";
299 template <>
inline constexpr auto errorMessage<opt<sep>> =
302 "expected model name";
304 "expected model type";
305 template <>
inline constexpr auto errorMessage<opt<sep, dotModelType>> =
307 template <>
inline constexpr auto errorMessage<opt<sep, paramValuePairs>> =
309 template <>
inline constexpr auto errorMessage<opt<sep, cplParamValuePairs>> =
311 template <>
inline constexpr auto errorMessage<opt<sep, dotSubcktPinSequence>> =
313 template <>
inline constexpr auto errorMessage<opt<sep, dotSubcktParams>> =
315 template <>
inline constexpr auto errorMessage<until<dotSubcktEnd, spiceUnit>> =
316 "expected (possibly empty) sequence of Spice lines followed by an .ends line";
318 "expected Spice directive, item, subcircuit definitions, or empty or commented-out line";
320 "expected zero or more Spice directives, items, subcircuit definitions, or empty or commented-out lines";
326 template <
typename Rule>
static constexpr auto message = errorMessage<Rule>;
329 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