Nibbler: Remove unused function argument
This commit is contained in:
@@ -66,7 +66,7 @@ json::string::string (const std::string& other)
|
|||||||
json::string* json::string::parse (Nibbler& nibbler)
|
json::string* json::string::parse (Nibbler& nibbler)
|
||||||
{
|
{
|
||||||
std::string value;
|
std::string value;
|
||||||
if (nibbler.getQuoted ('"', value, false))
|
if (nibbler.getQuoted ('"', value))
|
||||||
{
|
{
|
||||||
json::string* s = new json::string ();
|
json::string* s = new json::string ();
|
||||||
s->_data = value;
|
s->_data = value;
|
||||||
@@ -303,7 +303,7 @@ bool json::object::parse_pair (
|
|||||||
{
|
{
|
||||||
Nibbler n (nibbler);
|
Nibbler n (nibbler);
|
||||||
|
|
||||||
if (n.getQuoted ('"', name, false))
|
if (n.getQuoted ('"', name))
|
||||||
{
|
{
|
||||||
n.skipWS ();
|
n.skipWS ();
|
||||||
if (n.skip (':'))
|
if (n.skip (':'))
|
||||||
|
|||||||
@@ -180,10 +180,7 @@ bool Nibbler::getN (const int quantity, std::string& result)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool Nibbler::getQuoted (
|
bool Nibbler::getQuoted (char c, std::string& result)
|
||||||
char c,
|
|
||||||
std::string& result,
|
|
||||||
bool quote /* = false */)
|
|
||||||
{
|
{
|
||||||
bool inquote = false;
|
bool inquote = false;
|
||||||
bool inescape = false;
|
bool inescape = false;
|
||||||
@@ -210,9 +207,6 @@ bool Nibbler::getQuoted (
|
|||||||
|
|
||||||
if (current == c && !inescape)
|
if (current == c && !inescape)
|
||||||
{
|
{
|
||||||
if (quote)
|
|
||||||
result += current;
|
|
||||||
|
|
||||||
if (!inquote)
|
if (!inquote)
|
||||||
{
|
{
|
||||||
inquote = true;
|
inquote = true;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public:
|
|||||||
bool getUntilEOS (std::string&);
|
bool getUntilEOS (std::string&);
|
||||||
|
|
||||||
bool getN (const int, std::string&);
|
bool getN (const int, std::string&);
|
||||||
bool getQuoted (char, std::string&, bool quote = false);
|
bool getQuoted (char, std::string&);
|
||||||
bool getDigit (int&);
|
bool getDigit (int&);
|
||||||
bool getDigit4 (int&);
|
bool getDigit4 (int&);
|
||||||
bool getDigit3 (int&);
|
bool getDigit3 (int&);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ Context context;
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
UnitTest t (240);
|
UnitTest t (236);
|
||||||
|
|
||||||
// Ensure environment has no influence.
|
// Ensure environment has no influence.
|
||||||
unsetenv ("TASKDATA");
|
unsetenv ("TASKDATA");
|
||||||
@@ -167,28 +167,16 @@ int main (int, char**)
|
|||||||
t.notok (n.getQuoted ('\'', s), "\"one\\\"two\" : getQuoted (''') -> false");
|
t.notok (n.getQuoted ('\'', s), "\"one\\\"two\" : getQuoted (''') -> false");
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\"two\"");
|
n = Nibbler ("\"one\\\"two\"");
|
||||||
t.ok (n.getQuoted ('"', s, false), "\"one\\\"two\" : getQuoted ('\"', false, false) -> true");
|
t.ok (n.getQuoted ('"', s), "\"one\\\"two\" : getQuoted ('\"', s) -> true");
|
||||||
t.is (s, "one\\\"two", "getQuoted ('\"', false) -> one\\\"two");
|
t.is (s, "one\\\"two", "getQuoted ('\"', s) -> one\\\"two");
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\"two\"");
|
n = Nibbler ("\"one\\\"two\"");
|
||||||
t.ok (n.getQuoted ('"', s, true), "\"one\\\"two\" : getQuoted ('\"', false, true) -> true");
|
t.ok (n.getQuoted ('"', s), "\"one\\\"two\" : getQuoted ('\"', s) -> true");
|
||||||
t.is (s, "\"one\\\"two\"", "getQuoted ('\"', true) -> \"one\\\"two\"");
|
t.is (s, "one\\\"two", "getQuoted ('\"', s) -> one\\\"two");
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\"two\"");
|
|
||||||
t.ok (n.getQuoted ('"', s, false), "\"one\\\"two\" : getQuoted ('\"', true, false) -> true");
|
|
||||||
t.is (s, "one\\\"two", "getQuoted ('\"', false) -> one\\\"two");
|
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\"two\"");
|
|
||||||
t.ok (n.getQuoted ('"', s, true), "\"one\\\"two\" : getQuoted ('\"', s, true) -> true");
|
|
||||||
t.is (s, "\"one\\\"two\"", "getQuoted ('\"', s, true) -> \"one\\\"two\"");
|
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\\\"");
|
n = Nibbler ("\"one\\\\\"");
|
||||||
t.ok (n.getQuoted ('\"', s, true), "\"one\\\" : getQuoted ('\"', s, true) -> true");
|
t.ok (n.getQuoted ('\"', s), "one\\ : getQuoted ('\"', s) -> true");
|
||||||
t.is (s, "\"one\\\\\"", "getQuoted ('\"', s, true) -> \"one\\\\\"");
|
t.is (s, "one\\\\", "getQuoted ('\"', s) -> \"one\\\\\"");
|
||||||
|
|
||||||
n = Nibbler ("\"one\\\\\"");
|
|
||||||
t.ok (n.getQuoted ('\"', s, false), "one\\ : getQuoted ('\"', s, false) -> true");
|
|
||||||
t.is (s, "one\\\\", "getQuoted ('\"', s, false) -> \"one\\\\\"");
|
|
||||||
|
|
||||||
// bool getDigit (int&);
|
// bool getDigit (int&);
|
||||||
t.diag ("Nibbler::getDigit");
|
t.diag ("Nibbler::getDigit");
|
||||||
|
|||||||
Reference in New Issue
Block a user