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 )
89 static double ToDouble(
const std::string& aString,
double aDefault = NAN );
91 static int ToInt(
const std::string& aString,
int aDefault = -1 );
93 static bool Equal(
double aLH,
const std::string& aRH );
99 template <NOTATION Notation>
103 struct digits : plus<tao::pegtl::digit> {};
105 struct sign : one<'+', '-'> {};
114 template <SIM_VALUE::TYPE ValueType>
118 sor<seq<intPart, one<'.'>, fracPart>,
119 seq<intPart, one<'.'>>,
121 seq<one<'.'>, fracPart>,
133 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
137 : one<'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
139 : sor<TAO_PEGTL_ISTRING( "k" ),
140 TAO_PEGTL_ISTRING( "Meg" ),
141 TAO_PEGTL_ISTRING( "G" ),
142 TAO_PEGTL_ISTRING( "T" )> {};
145 : one<'a', 'f', 'p', 'n', 'u', 'm', 'k', 'K', 'M', 'G', 'T', 'P', 'E'> {};
147 : sor<TAO_PEGTL_ISTRING( "f" ),
148 TAO_PEGTL_ISTRING( "p" ),
149 TAO_PEGTL_ISTRING( "n" ),
150 TAO_PEGTL_ISTRING( "u" ),
151 TAO_PEGTL_ISTRING( "Meg" ),
152 TAO_PEGTL_ISTRING( "m" ),
154 TAO_PEGTL_ISTRING( "k" ),
155 TAO_PEGTL_ISTRING( "G" ),
156 TAO_PEGTL_ISTRING( "T" )> {};
159 template <NOTATION Notation>
166 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
167 struct number : seq<opt<significand<ValueType>>,
168 opt<exponentWithPrefix>,
169 opt<unitPrefix<ValueType, Notation>>,
170 garbageSuffix<Notation>> {};
172 template <SIM_VALUE::TYPE ValueType, NOTATION Notation>
173 struct numberGrammar : must<number<ValueType, Notation>, tao::pegtl::eof> {};
176 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 std::string ToSpice(const std::string &aString)
static double ToDouble(const std::string &aString, double aDefault=NAN)
static int ToInt(const std::string &aString, int aDefault=-1)
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