21 : sfile_(0), ctx_(NO_KEYWORDS), trace_scanning_(false), trace_parsing_(false)
33 return (parseCommon());
38 FILE* f = fopen(filename.c_str(),
"r");
43 return (parseCommon());
47 ParserContext::parseCommon() {
51 parser.set_debug_level(trace_parsing_);
53 int res = parser.parse();
66 isc_throw(ParseError,
"Expected exactly one terminal Element expected, found " 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_);
124 if (cstack_.empty()) {
125 fatal(
"unbalanced syntactic context");
127 ctx_ = cstack_.back();
136 return (
"__no keywords__");
144 return (
"managed-servers");
146 return (
"managed-servers/*");
148 return (
"control-socket");
150 return (
"socket-type");
152 return (
"hooks-libraries");
156 return (
"output-options");
158 return (
"__unknown__");
ParserContext()
Default constructor.
static void fatal(const std::string &what)
Fatal error handler.
Used while parsing Logging/loggers/output_options structures.
Used while parsing Netconf/managed-servers/*/control-socket/socket-type.
LexerContext
Defines syntactic contexts for lexical tie-ins.
void scanEnd()
Method called after the last tokens are scanned.
void error(const isc::netconf::location &loc, const std::string &what)
Error handler.
void leave()
Leave a syntactic context.
boost::shared_ptr< Element > ElementPtr
LexerContext ctx_
Current syntactic context.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
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.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
Evaluation error exception raised when trying to parse.
boost::shared_ptr< const Element > ConstElementPtr
Used while parsing Netconf/hooks-libraries.
isc::data::Element::Position loc2pos(isc::netconf::location &loc)
Converts bison's position to one understandable by isc::data::Element.
Used while parsing Logging/loggers structures.
Used while parsing Netconf/manages-servers/*/control-socket.
Represents the position of the data element within a configuration string.
Defines the logger used by the top-level component of kea-dhcp-ddns.
Used while parsing content of Netconf.
This one is used in pure JSON mode.
Define the isc::netconf::parser class.
Used while parsing content of Logging.
virtual ~ParserContext()
destructor
void enter(const LexerContext &ctx)
Enter a new syntactic context.
ParserType
Defines currently supported scopes.
Used while parsing Netconf/managed-servers.
const std::string contextName()
Get the syntactic context name.