Commit 8fa1747f authored by Francis Dupont's avatar Francis Dupont Committed by Tomek Mrugalski

[5014] Cleaned up (indent, factor, etc)

parent 340bc94d
......@@ -305,7 +305,7 @@ SubnetConfigParser::getParam(const std::string& name) {
isc_throw(DhcpConfigError, "Mandatory parameter " << name
<< " missing (no global default and no subnet-"
<< "specific value)");
}
}
}
return (Triplet<uint32_t>(value));
......
......@@ -162,6 +162,7 @@ JSONString \"{JSONStringCharacter}*\"
loc.step();
}
\"Dhcp6\" {
switch(driver.ctx_) {
case isc::dhcp::Parser6Context::CONFIG:
......@@ -740,12 +741,12 @@ JSONString \"{JSONStringCharacter}*\"
return isc::dhcp::Dhcp6Parser::make_STRING(tmp, loc);
}
"[" { return isc::dhcp::Dhcp6Parser::make_LSQUARE_BRACKET(loc); }
"]" { return isc::dhcp::Dhcp6Parser::make_RSQUARE_BRACKET(loc); }
"{" { return isc::dhcp::Dhcp6Parser::make_LCURLY_BRACKET(loc); }
"}" { return isc::dhcp::Dhcp6Parser::make_RCURLY_BRACKET(loc); }
"," { return isc::dhcp::Dhcp6Parser::make_COMMA(loc); }
":" { return isc::dhcp::Dhcp6Parser::make_COLON(loc); }
"[" { return isc::dhcp::Dhcp6Parser::make_LSQUARE_BRACKET(loc); }
"]" { return isc::dhcp::Dhcp6Parser::make_RSQUARE_BRACKET(loc); }
"{" { return isc::dhcp::Dhcp6Parser::make_LCURLY_BRACKET(loc); }
"}" { return isc::dhcp::Dhcp6Parser::make_RCURLY_BRACKET(loc); }
"," { return isc::dhcp::Dhcp6Parser::make_COMMA(loc); }
":" { return isc::dhcp::Dhcp6Parser::make_COLON(loc); }
{int} {
// An integer was found.
......@@ -764,6 +765,7 @@ JSONString \"{JSONStringCharacter}*\"
// The parser needs the string form as double conversion is no lossless
return isc::dhcp::Dhcp6Parser::make_INTEGER(integer, loc);
}
[-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)? {
// A floating point was found.
std::string tmp(yytext);
......@@ -790,9 +792,9 @@ null {
return isc::dhcp::Dhcp6Parser::make_NULL_TYPE(loc);
}
. driver.error (loc, "Invalid character: " + std::string(yytext));
. driver.error (loc, "Invalid character: " + std::string(yytext));
<<EOF>> {
<<EOF>> {
if (states.empty()) {
return isc::dhcp::Dhcp6Parser::make_END(loc);
}
......
......@@ -156,14 +156,14 @@ start: TOPLEVEL_GENERIC_JSON { ctx.ctx_ = ctx.NO_KEYWORD; } map2
// Note that ctx_ is NO_KEYWORD here
// Values rule
value : INTEGER { $$ = ElementPtr(new IntElement($1)); }
| FLOAT { $$ = ElementPtr(new DoubleElement($1)); }
| BOOLEAN { $$ = ElementPtr(new BoolElement($1)); }
| STRING { $$ = ElementPtr(new StringElement($1)); }
| NULL_TYPE { $$ = ElementPtr(new NullElement()); }
| map2 { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
| list_generic { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
;
value: INTEGER { $$ = ElementPtr(new IntElement($1)); }
| FLOAT { $$ = ElementPtr(new DoubleElement($1)); }
| BOOLEAN { $$ = ElementPtr(new BoolElement($1)); }
| STRING { $$ = ElementPtr(new StringElement($1)); }
| NULL_TYPE { $$ = ElementPtr(new NullElement()); }
| map2 { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
| list_generic { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
;
map2: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
......@@ -392,8 +392,8 @@ host: HOST {
name: NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr n(new StringElement($4));
ctx.stack_.back()->set("name", n);
ElementPtr name(new StringElement($4));
ctx.stack_.back()->set("name", name);
ctx.leave();
};
......@@ -421,16 +421,20 @@ mac_sources_list: mac_sources_value
| mac_sources_list COMMA mac_sources_value
;
mac_sources_value: DUID {
ElementPtr duid(new StringElement("duid"));
ctx.stack_.back()->add(duid);
}
| STRING {
ElementPtr duid(new StringElement($1));
ctx.stack_.back()->add(duid);
}
mac_sources_value: duid_id
| string_id
;
duid_id : DUID {
ElementPtr duid(new StringElement("duid"));
ctx.stack_.back()->add(duid);
};
string_id : STRING {
ElementPtr duid(new StringElement($1));
ctx.stack_.back()->add(duid);
};
host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("host-reservation-identifiers", l);
......@@ -445,16 +449,15 @@ host_reservation_identifiers_list: host_reservation_identifier
| host_reservation_identifiers_list COMMA host_reservation_identifier
;
host_reservation_identifier: DUID {
ElementPtr duid(new StringElement("duid"));
ctx.stack_.back()->add(duid);
}
| HW_ADDRESS {
ElementPtr hwaddr(new StringElement("hw-address"));
ctx.stack_.back()->add(hwaddr);
}
host_reservation_identifier: duid_id
| hw_address_id
;
hw_address_id : HW_ADDRESS {
ElementPtr hwaddr(new StringElement("hw-address"));
ctx.stack_.back()->add(hwaddr);
};
relay_supplied_options: RELAY_SUPPLIED_OPTIONS {
ElementPtr l(new ListElement());
ctx.stack_.back()->set("relay-supplied-options", l);
......@@ -662,13 +665,7 @@ option_data_param: %empty
;
option_data_name: NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr name(new StringElement($4));
ctx.stack_.back()->set("name", name);
ctx.leave();
};
option_data_name: name;
option_data_data: DATA {
ctx.enter(ctx.NO_KEYWORD);
......@@ -926,13 +923,7 @@ client_class_param: %empty
| option_data_list
;
client_class_name: NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr name(new StringElement($4));
ctx.stack_.back()->set("name", name);
ctx.leave();
};
client_class_name: name;
client_class_test: TEST {
ctx.enter(ctx.NO_KEYWORD);
......@@ -1054,20 +1045,12 @@ logger_params: logger_param
| logger_params COMMA logger_param
;
logger_param: logger_name
logger_param: name
| output_options_list
| debuglevel
| severity
;
logger_name: NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
ElementPtr name(new StringElement($4));
ctx.stack_.back()->set("name", name);
ctx.leave();
};
debuglevel: DEBUGLEVEL COLON INTEGER {
ElementPtr dl(new IntElement($3));
ctx.stack_.back()->set("debuglevel", dl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment