params["space"] = DHCP4_OPTION_SPACE;
params["code"] = "56";
params["data"] = "ABCDEF0105";
- params["csv-format"] = "False";
+ params["csv-format"] = "false";
} else if (parameter == "space") {
params["name"] = "dhcp-message";
params["space"] = param_value;
params["code"] = "56";
params["data"] = "ABCDEF0105";
- params["csv-format"] = "False";
+ params["csv-format"] = "false";
} else if (parameter == "code") {
params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE;
params["code"] = param_value;
params["data"] = "ABCDEF0105";
- params["csv-format"] = "False";
+ params["csv-format"] = "false";
} else if (parameter == "data") {
params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE;
params["code"] = "56";
params["data"] = param_value;
- params["csv-format"] = "False";
+ params["csv-format"] = "false";
} else if (parameter == "csv-format") {
params["name"] = "dhcp-message";
params["space"] = DHCP4_OPTION_SPACE;
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": True,"
+ " \"array\": true,"
" \"space\": \"isc\""
" } ]"
"}";
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"uint32\","
- " \"array\": True,"
+ " \"array\": true,"
" \"space\": \"isc\","
" \"encapsulate\": \"valid-space-name\""
" } ]"
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"default-ip-ttl\","
" \"data\": \"01\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"default-ip-ttl\","
" \"data\": \"01\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ]"
" } ],"
"\"valid-lifetime\": 4000 }";
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"foo\","
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"AB\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.100\" } ],"
" \"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"default-ip-ttl\","
" \"data\": \"01\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ]"
" } ],"
"\"valid-lifetime\": 4000 }";
" \"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"0102030405060708090A\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ]"
" },"
" {"
" \"option-data\": [ {"
" \"name\": \"default-ip-ttl\","
" \"data\": \"FF\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ]"
" } ],"
"\"valid-lifetime\": 4000 }";
params["code"] = "41";
// Specify option values in a CSV (user friendly) format.
params["data"] = "192.0.2.10, 192.0.2.1, 192.0.2.3";
- params["csv-format"] = "True";
+ params["csv-format"] = "true";
std::string config = createConfigWithOption(params);
ElementPtr json = Element::fromJSON(config);
"\"renew-timer\": 1000,"
"\"option-data\": [ {"
" \"name\": \"vendor-encapsulated-options\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"vendor-encapsulated-options-space\","
" \"code\": 2,"
" \"data\": \"192.168.2.1\","
- " \"csv-format\": True"
+ " \"csv-format\": true"
" } ],"
"\"option-def\": [ {"
" \"name\": \"foo\","
" \"space\": \"vendor-4491\"," // VENDOR_ID_CABLE_LABS = 4491
" \"code\": 100," // just a random code
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"option-two\","
" \"space\": \"vendor-1234\","
" \"code\": 100,"
" \"data\": \"1234\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" } ],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1-192.0.2.10\" } ],"
"\"option-data\": [ {"
" \"name\": \"dhcp-message\","
" \"data\": \"ABCDEF0105\","
- " \"csv-format\": False"
+ " \"csv-format\": false"
" },"
" {"
" \"name\": \"foo\","
" \"space\": \"vendor-4491\","
" \"code\": 2,"
" \"data\": \"10.253.175.16\","
- " \"csv-format\": True"
+ " \"csv-format\": true"
" }],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"10.254.226.0/25\" } ],"
" \"space\": \"vendor-4491\","
" \"code\": 2,"
" \"data\": \"192.0.2.1, 192.0.2.2\","
- " \"csv-format\": True"
+ " \"csv-format\": true"
" }],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.0/25\" } ],"
" \"code\": ";
string config_postfix = ","
" \"data\": \"192.0.2.1\","
- " \"csv-format\": True"
+ " \"csv-format\": true"
" }],"
"\"subnet4\": [ { "
" \"pools\": [ { \"pool\": \"192.0.2.1 - 192.0.2.50\" } ],"
return isc::dhcp::Dhcp6Parser::make_NULL_TYPE(driver.loc_);
}
+(?i:true) driver.error (driver.loc_, "JSON true reserved keyword is lower case only");
+
+(?i:false) driver.error (driver.loc_, "JSON false reserved keyword is lower case only");
+
+(?i:null) driver.error (driver.loc_, "JSON null reserved keyword is lower case only");
+
<*>. driver.error (driver.loc_, "Invalid character: " + std::string(yytext));
<<EOF>> {
Parser6Context::PARSER_JSON,
"Can't open include file /foo/bar");
- // case sensitivity
+ // JSON keywords
testError("{ \"foo\": True }",
+ Parser6Context::PARSER_JSON,
+ "<string>:1.10-13: JSON true reserved keyword is lower case only");
+ testError("{ \"foo\": False }",
+ Parser6Context::PARSER_JSON,
+ "<string>:1.10-14: JSON false reserved keyword is lower case only");
+ testError("{ \"foo\": NULL }",
+ Parser6Context::PARSER_JSON,
+ "<string>:1.10-13: JSON null reserved keyword is lower case only");
+ testError("{ \"foo\": Tru }",
Parser6Context::PARSER_JSON,
"<string>:1.10: Invalid character: T");
- testError("{ \"foo\": NULL }",
+ testError("{ \"foo\": nul }",
Parser6Context::PARSER_JSON,
- "<string>:1.10: Invalid character: N");
+ "<string>:1.10: Invalid character: n");
// numbers
testError("123",
#include <fstream>
#include <cerrno>
-#include <boost/algorithm/string.hpp> // for iequals
#include <boost/lexical_cast.hpp>
#include <cmath>
// This will move the pos to the end of the value.
const std::string word = wordFromStringstream(in, pos);
- if (boost::iequals(word, "True")) {
+ if (word == "true") {
return (Element::create(true, Element::Position(file, line,
start_pos)));
- } else if (boost::iequals(word, "False")) {
+ } else if (word == "false") {
return (Element::create(false, Element::Position(file, line,
start_pos)));
} else {
const uint32_t start_pos = pos;
// This will move the pos to the end of the value.
const std::string word = wordFromStringstream(in, pos);
- if (boost::iequals(word, "null")) {
+ if (word == "null") {
return (Element::create(Element::Position(file, line, start_pos)));
} else {
throwJSONError(std::string("Bad null value: ") + word, file,
el_read = true;
break;
case 't':
- case 'T':
case 'f':
- case 'F':
in.putback(c);
--pos;
element = fromStringstreamBool(in, file, line, pos);
el_read = true;
break;
case 'n':
- case 'N':
in.putback(c);
--pos;
element = fromStringstreamNull(in, file, line, pos);
sv.push_back("{1}");
//ElementPtr ep = Element::fromJSON("\"aaa\nbbb\"err");
//std::cout << ep << std::endl;
- sv.push_back("\n\nTru");
+ sv.push_back("\n\nTrue");
+ sv.push_back("\n\ntru");
sv.push_back("{ \n \"aaa\nbbb\"err:");
- sv.push_back("{ \t\n \"aaa\nbbb\"\t\n\n:\n True, \"\\\"");
+ sv.push_back("{ \t\n \"aaa\nbbb\"\t\n\n:\n true, \"\\\"");
sv.push_back("{ \"a\": None}");
sv.push_back("");
+ sv.push_back("NULL");
sv.push_back("nul");
sv.push_back("hello\"foobar\"");
sv.push_back("\"foobar\"hello");
EXPECT_EQ("0.01", Element::fromJSON("1.0e-2")->str());
EXPECT_EQ("0.012", Element::fromJSON("1.2e-2")->str());
EXPECT_EQ("0.012", Element::fromJSON("1.2E-2")->str());
- EXPECT_EQ("null", Element::fromJSON("Null")->str());
- EXPECT_EQ("null", Element::fromJSON("NULL")->str());
- EXPECT_EQ("false", Element::fromJSON("False")->str());
- EXPECT_EQ("false", Element::fromJSON("FALSE")->str());
- EXPECT_EQ("true", Element::fromJSON("True")->str());
- EXPECT_EQ("true", Element::fromJSON("TRUE")->str());
EXPECT_EQ("\"\"", Element::fromJSON(" \n \t \r \f \b \"\" \n \f \t \r \b")->str());
EXPECT_EQ("{ }", Element::fromJSON("{ \n \r \t \b \f }")->str());
EXPECT_EQ("[ ]", Element::fromJSON("[ \n \r \f \t \b ]")->str());
EXPECT_NE(*efs("1"), *efs("2"));
EXPECT_NE(*efs("1"), *efs("\"1\""));
EXPECT_NE(*efs("1"), *efs("[]"));
- EXPECT_NE(*efs("1"), *efs("True"));
+ EXPECT_NE(*efs("1"), *efs("true"));
EXPECT_NE(*efs("1"), *efs("{}"));
EXPECT_EQ(*efs("1.1"), *efs("1.1"));
EXPECT_NE(*efs("1.0"), *efs("1"));
EXPECT_NE(*efs("1.1"), *efs("\"1\""));
EXPECT_NE(*efs("1.1"), *efs("[]"));
- EXPECT_NE(*efs("1.1"), *efs("True"));
+ EXPECT_NE(*efs("1.1"), *efs("true"));
EXPECT_NE(*efs("1.1"), *efs("{}"));
- EXPECT_EQ(*efs("True"), *efs("True"));
- EXPECT_NE(*efs("True"), *efs("False"));
- EXPECT_NE(*efs("True"), *efs("1"));
- EXPECT_NE(*efs("True"), *efs("\"1\""));
- EXPECT_NE(*efs("True"), *efs("[]"));
- EXPECT_NE(*efs("True"), *efs("{}"));
+ EXPECT_EQ(*efs("true"), *efs("true"));
+ EXPECT_NE(*efs("true"), *efs("false"));
+ EXPECT_NE(*efs("true"), *efs("1"));
+ EXPECT_NE(*efs("true"), *efs("\"1\""));
+ EXPECT_NE(*efs("true"), *efs("[]"));
+ EXPECT_NE(*efs("true"), *efs("{}"));
EXPECT_EQ(*efs("\"foo\""), *efs("\"foo\""));
EXPECT_NE(*efs("\"foo\""), *efs("\"bar\""));
EXPECT_NE(*efs("\"foo\""), *efs("1"));
EXPECT_NE(*efs("\"foo\""), *efs("\"1\""));
- EXPECT_NE(*efs("\"foo\""), *efs("True"));
+ EXPECT_NE(*efs("\"foo\""), *efs("true"));
EXPECT_NE(*efs("\"foo\""), *efs("[]"));
EXPECT_NE(*efs("\"foo\""), *efs("{}"));
EXPECT_EQ(*efs("[]"), *efs("[]"));
EXPECT_EQ(*efs("[ 1, 2, 3 ]"), *efs("[ 1, 2, 3 ]"));
- EXPECT_EQ(*efs("[ \"a\", [ True, 1], 2.2 ]"), *efs("[ \"a\", [ True, 1], 2.2 ]"));
- EXPECT_NE(*efs("[ \"a\", [ True, 1], 2.2 ]"), *efs("[ \"a\", [ True, 2], 2.2 ]"));
+ EXPECT_EQ(*efs("[ \"a\", [ true, 1], 2.2 ]"), *efs("[ \"a\", [ true, 1], 2.2 ]"));
+ EXPECT_NE(*efs("[ \"a\", [ true, 1], 2.2 ]"), *efs("[ \"a\", [ true, 2], 2.2 ]"));
EXPECT_NE(*efs("[]"), *efs("[1]"));
EXPECT_NE(*efs("[]"), *efs("1"));
EXPECT_NE(*efs("[]"), *efs("\"1\""));
"config_data" contains a list of elements of the form
{ "item_name": "name"
"item_type": "integer|real|boolean|string|list|map"
- "item_optional": True|False
+ "item_optional": true|false
"item_default": <depends on type>
}
// Invoke common code for all specializations of build().
buildCommon(value);
// The Config Manager checks if user specified a
- // valid value for a boolean parameter: True or False.
+ // valid value for a boolean parameter: true or false.
// We should have a boolean Element, use value directly
try {
value_ = value->boolValue();
mode_str = string_values_->getOptionalParam("replace-client-name",
D2ClientConfig::
DFT_REPLACE_CLIENT_NAME_MODE);
- if (boost::iequals(mode_str, "FALSE")) {
+ if (boost::iequals(mode_str, "false")) {
// @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_NEVER;
}
- else if (boost::iequals(mode_str, "TRUE")) {
+ else if (boost::iequals(mode_str, "true")) {
// @todo add a debug log
replace_client_name_mode = D2ClientConfig::RCM_WHEN_PRESENT;
} else {
" \"name\": \"foo\","
" \"code\": 100,"
" \"type\": \"ipv4-address\","
- " \"array\": False,"
+ " \"array\": false,"
" \"record-types\": \"\","
" \"space\": \"isc\","
" \"encapsulate\": \"\""
" \"space\": \"isc\","
" \"code\": 100,"
" \"data\": \"192.0.2.0\","
- " \"csv-format\": True"
+ " \"csv-format\": true"
" } ]"
"}";
" \"name\": \"swap-server\","
" \"space\": \"dhcp4\","
" \"code\": 16,"
- " \"csv-format\": True,"
+ " \"csv-format\": true,"
" \"data\": \"192.0.2.0\""
" } ]"
"}";
" \"name\": \"swap-server\","
" \"space\": \"dhcp4\","
" \"code\": 16,"
- " \"csv-format\": False,"
+ " \"csv-format\": false,"
" \"data\": \"C0000200\""
" } ]"
"}";
" \"name\": \"foo-name\","
" \"space\": \"dhcp6\","
" \"code\": 25000,"
- " \"csv-format\": True,"
+ " \"csv-format\": true,"
" \"data\": \"0\""
" } ]"
"}";
" \"name\": \"foo-name\","
" \"space\": \"dhcp6\","
" \"code\": 25000,"
- " \"csv-format\": False,"
+ " \"csv-format\": false,"
" \"data\": \"0\""
" } ]"
"}";
" \"name\": \"foo-name\","
" \"code\": 2345,"
" \"type\": \"ipv6-address\","
- " \"array\": True,"
+ " \"array\": true,"
" \"space\": \"dhcp6\""
" } ],"
" \"option-data\": [ {"
" \"name\": \"foo-name\","
" \"code\": 2345,"
" \"type\": \"ipv6-address\","
- " \"array\": True,"
+ " \"array\": true,"
" \"space\": \"dhcp6\""
" } ],"
" \"option-data\": [ {"