32#if defined (__MINGW32__)
33#if defined ( LoadLibrary )
36#if defined ( GetClassInfo )
44 using namespace tao::pegtl;
78 static std::string
Normalize(
double aValue );
80 static std::string
ToSpice(
const std::string& aString );
82 static double ToDouble(
const std::string& aString,
double aDefault = NAN );
84 static int ToInt(
const std::string& aString,
int aDefault = -1 );
86 static bool Equal(
double aLH,
const std::string& aRH );
92 template <NOTATION Notation>
96 struct digits : plus<tao::pegtl::digit> {};
98 struct sign : one<'+', '-'> {};
107 template <SIM_VALUE::TYPE ValueType>
111 sor<seq<intPart, one<'.'>, fracPart>,
112 seq<intPart, one<'.'>>,
114 seq<one<'.'>, fracPart>,
126 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
130 : one<'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
132 : sor<TAO_PEGTL_ISTRING( "k" ),
133 TAO_PEGTL_ISTRING( "Meg" ),
134 TAO_PEGTL_ISTRING( "G" ),
135 TAO_PEGTL_ISTRING( "T" )> {};
138 : one<'a', 'f', 'p', 'n', 'u', 'm', 'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
140 : sor<TAO_PEGTL_ISTRING( "f" ),
141 TAO_PEGTL_ISTRING( "p" ),
142 TAO_PEGTL_ISTRING( "n" ),
143 TAO_PEGTL_ISTRING( "u" ),
144 TAO_PEGTL_ISTRING( "Meg" ),
145 TAO_PEGTL_ISTRING( "m" ),
147 TAO_PEGTL_ISTRING( "k" ),
148 TAO_PEGTL_ISTRING( "G" ),
149 TAO_PEGTL_ISTRING( "T" )> {};
152 template <NOTATION Notation>
159 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
160 struct number : seq<opt<significand<ValueType>>,
161 opt<exponentWithPrefix>,
162 opt<unitPrefix<ValueType, Notation>>,
163 garbageSuffix<Notation>> {};
165 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
166 struct numberGrammar : must<number<ValueType, Notation>, tao::pegtl::eof> {};
169 bool IsValid(
const std::string& aString,
static std::string Normalize(double aValue)
static bool Equal(double aLH, const std::string &aRH)
static std::string ConvertNotation(const std::string &aString, NOTATION aFromNotation, NOTATION aToNotation)
static double ToDouble(const std::string &aString, double aDefault=NAN)
static int ToInt(const std::string &aString, int aDefault=-1)
static std::string ToSpice(const std::string &aString)
SIM_VALUE_GRAMMAR::NOTATION NOTATION
bool IsValid(const std::string &aString, SIM_VALUE::TYPE aValueType=SIM_VALUE::TYPE_FLOAT, NOTATION aNotation=NOTATION::SI)
std::string allowedIntChars