13 #include <boost/lexical_cast.hpp> 21 : ctx_(NO_KEYWORD), trace_scanning_(false), trace_parsing_(false)
33 return (parseCommon());
38 FILE* f = fopen(filename.c_str(),
"r");
43 return (parseCommon());
47 Parser4Context::parseCommon() {
51 parser.set_debug_level(trace_parsing_);
53 int res = parser.parse();
93 const std::string& file = *loc.begin.filename;
94 const uint32_t line = loc.begin.line;
95 const uint32_t pos = loc.begin.column;
107 "missing parameter '" << name <<
"' (" 108 <<
stack_.back()->getPosition() <<
") [" 110 << open_loc <<
" and " << close_loc <<
"]");
117 cstack_.push_back(
ctx_);
125 if (cstack_.empty()) {
126 fatal(
"unbalanced syntactic context");
129 ctx_ = cstack_.back();
138 return (
"__no keyword__");
146 return (
"interfaces-config");
148 return (
"dhcp-socket-type");
150 return (
"outbound-interface");
152 return (
"lease-database");
154 return (
"hosts-database");
156 return (
"database-type");
158 return (
"host-reservation-identifiers");
160 return (
"hooks-libraries");
164 return (
"reservation-mode");
166 return (
"option-def");
168 return (
"option-data");
170 return (
"client-classes");
172 return (
"expired-leases-processing");
174 return (
"server-id");
176 return (
"control-socket");
178 return (
"dhcp-queue-control");
182 return (
"reservations");
188 return (
"output-options");
190 return (
"dhcp-ddns");
192 return (
"ncr-protocol");
194 return (
"ncr-format");
196 return (
"replace-client-name");
198 return (
"shared-networks");
200 return (
"sanity-checks");
202 return (
"config-control");
204 return (
"config-database");
206 return (
"__unknown__");
Used while parsing Dhcp4/hosts-database[s] structures.
Used while parsing Dhcp4/dhcp-ddns/ncr-protocol.
Used while parsing Dhcp4/hooks-libraries.
ParserContext
Defines syntactic contexts for lexical tie-ins.
void leave()
Leave a syntactic context.
Used while parsing Dhcp4/dhcp-ddns/ncr-format.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
Used while parsing Dhcp4/interfaces/outbound-interface structures.
Used while parsing Dhcp4/client-classes structures.
const std::string contextName()
Get the syntactic context name.
isc::data::Element::Position loc2pos(isc::dhcp::location &loc)
Converts bison's position to one understandable by isc::data::Element.
Used while parsing Dhcp4/*-database/type.
Used while parsing Dhcp4/host-reservation-identifiers.
boost::shared_ptr< Element > ElementPtr
Used while parsing content of Logging.
void enter(const ParserContext &ctx)
Enter a new syntactic context.
Used while parsing Dhcp4/reservations structures.
Used while parsing Dhcp4/lease-database structures.
void scanEnd()
Method called after the last tokens are scanned.
Used while parsing Dhcp4/dhcp-ddns.
Used while parsing Dhcp4/interfaces/dhcp-socket-type structures.
Used while parsing Dhcp4/server-id structures.
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
Define the isc::dhcp::parser class.
Used while parsing Dhcp4/control-socket structures.
Used while parsing Dhcp4/subnet4/pools structures.
Parser4Context()
Default constructor.
Used while parsing Dhcp4/dhcp-queue-control structures.
Used while parsing shared-networks structures.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
ParserContext ctx_
Current syntactic context.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
Used while parsing Dhcp4/dhcp-ddns/replace-client-name.
Used while parsing Logging/loggers/output_options structures.
ParserType
Defines currently supported scopes.
boost::shared_ptr< const Element > ConstElementPtr
Used while parsing Dhcp4/Subnet4 structures.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
Evaluation error exception raised when trying to parse.
Used while parsing Dhcp4/option-def structures.
Used while parsing Dhcp4/option-data, Dhcp4/subnet4/option-data or anywhere option-data is present (c...
Used while parsing Dhcp4/interfaces structures.
Used while parsing content of Dhcp4.
Represents the position of the data element within a configuration string.
Used while parsing Dhcp4/subnet4relay structures.
void require(const std::string &name, isc::data::Element::Position open_loc, isc::data::Element::Position close_loc)
Check if a required parameter is present.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Used while parsing Logging/loggers structures.
This one is used in pure JSON mode.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
void error(const isc::dhcp::location &loc, const std::string &what)
Error handler.
Used while parsing Dhcp4/expired-leases-processing.
Used while parsing config-control/config-databases.
static void fatal(const std::string &what)
Fatal error handler.
virtual ~Parser4Context()
destructor
Used while parsing Dhcp4/config-control.
Used while parsing Dhcp4/reservation-mode.