Signed-off-by: Paul Beckingham <paul@beckingham.net>

Bug #836

 - Make A3 use same the number representation as the user.
This commit is contained in:
Matt Kraai 2011-11-14 23:44:05 -05:00 committed by Paul Beckingham
parent 6473c9f39b
commit 3a4871e975
5 changed files with 25 additions and 9 deletions

View file

@ -377,7 +377,7 @@ bool Nibbler::getUnsignedInt (int& result)
// e:
// e|E (+|-)?
//
bool Nibbler::getNumber (double& result)
bool Nibbler::getNumber (std::string& result)
{
std::string::size_type i = _cursor;
@ -417,7 +417,7 @@ bool Nibbler::getNumber (double& result)
while (i < _length && isdigit (_input[i]))
++i;
result = strtof (_input.substr (_cursor, i - _cursor).c_str (), NULL);
result = _input.substr (_cursor, i - _cursor);
_cursor = i;
return true;
}
@ -425,7 +425,7 @@ bool Nibbler::getNumber (double& result)
return false;
}
result = strtof (_input.substr (_cursor, i - _cursor).c_str (), NULL);
result = _input.substr (_cursor, i - _cursor);
_cursor = i;
return true;
}
@ -433,6 +433,20 @@ bool Nibbler::getNumber (double& result)
return false;
}
////////////////////////////////////////////////////////////////////////////////
bool Nibbler::getNumber (double &result)
{
bool isnumber;
std::string s;
isnumber = getNumber (s);
if (isnumber)
{
result = strtof (s.c_str (), NULL);
}
return isnumber;
}
////////////////////////////////////////////////////////////////////////////////
// number:
// int frac? exp?