- Localized more files.
This commit is contained in:
Paul Beckingham 2011-06-25 23:32:40 -04:00
parent 42ead6b34d
commit c9cc43dc5f
9 changed files with 71 additions and 39 deletions

View file

@ -25,8 +25,10 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream> // TODO Remove.
#define L10N // Localization complete.
#include <text.h>
#include <i18n.h>
#include <utf8.h>
#include <JSON.h>
@ -198,8 +200,7 @@ json::array* json::array::parse (Nibbler& nibbler)
else
{
delete arr;
throw std::string ("Error: missing value after ',' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
}
}
}
@ -210,8 +211,7 @@ json::array* json::array::parse (Nibbler& nibbler)
return arr;
}
else
throw std::string ("Error: missing ']' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_BRACKET, (int) n.cursor ());
delete arr;
}
@ -287,8 +287,7 @@ json::object* json::object::parse (Nibbler& nibbler)
else
{
delete obj;
throw std::string ("Error: missing value after ',' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE, (int) n.cursor ());
}
}
}
@ -299,8 +298,7 @@ json::object* json::object::parse (Nibbler& nibbler)
return obj;
}
else
throw std::string ("Error: missing '}' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_BRACE, (int) n.cursor ());
delete obj;
}
@ -328,12 +326,10 @@ bool json::object::parse_pair (
return true;
}
else
throw std::string ("Error: missing value at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_VALUE2, (int) n.cursor ());
}
else
throw std::string ("Error: missing ':' at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_MISSING_COLON, (int) n.cursor ());
}
return NULL;
@ -378,16 +374,14 @@ json::value* json::parse (const std::string& input)
if (n.next () == '{') root = json::object::parse (n);
else if (n.next () == '[') root = json::array::parse (n);
else
throw std::string ("Error: expected '{' or '[' at position ") +
format ((int)n.cursor ());
throw format (STRING_JSON_MISSING_OPEN, (int) n.cursor ());
// Check for end condition.
n.skipWS ();
if (!n.depleted ())
{
delete root;
throw std::string ("Error: extra characters found at position ") +
format ((int) n.cursor ());
throw format (STRING_JSON_EXTRA_CHARACTERS, (int) n.cursor ());
}
return root;