36#if defined (__MINGW32__)
37#if defined ( LoadLibrary )
40#if defined ( GetClassInfo )
48 using namespace tao::pegtl;
82 static std::string
Normalize(
double aValue );
84 static std::string
ToSpice(
const std::string& aString );
86 static double ToDouble(
const std::string& aString,
double aDefault = NAN );
88 static int ToInt(
const std::string& aString,
int aDefault = -1 );
90 static bool Equal(
double aLH,
const std::string& aRH );
96 template <NOTATION Notation>
100 struct digits : plus<tao::pegtl::digit> {};
102 struct sign : one<'+', '-'> {};
111 template <SIM_VALUE::TYPE ValueType>
115 sor<seq<intPart, one<'.'>, fracPart>,
116 seq<intPart, one<'.'>>,
118 seq<one<'.'>, fracPart>,
130 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
134 : one<'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
136 : sor<TAO_PEGTL_ISTRING( "k" ),
137 TAO_PEGTL_ISTRING( "Meg" ),
138 TAO_PEGTL_ISTRING( "G" ),
139 TAO_PEGTL_ISTRING( "T" )> {};
142 : one<'a', 'f', 'p', 'n', 'u', 'm', 'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
144 : sor<TAO_PEGTL_ISTRING( "f" ),
145 TAO_PEGTL_ISTRING( "p" ),
146 TAO_PEGTL_ISTRING( "n" ),
147 TAO_PEGTL_ISTRING( "u" ),
148 TAO_PEGTL_ISTRING( "Meg" ),
149 TAO_PEGTL_ISTRING( "m" ),
151 TAO_PEGTL_ISTRING( "k" ),
152 TAO_PEGTL_ISTRING( "G" ),
153 TAO_PEGTL_ISTRING( "T" )> {};
156 template <NOTATION Notation>
163 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
164 struct number : seq<opt<significand<ValueType>>,
165 opt<exponentWithPrefix>,
166 opt<unitPrefix<ValueType, Notation>>,
167 garbageSuffix<Notation>> {};
169 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
170 struct numberGrammar : must<number<ValueType, Notation>, tao::pegtl::eof> {};
173 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