7#ifndef NETCONF_PARSER_CONTEXT_H
8#define NETCONF_PARSER_CONTEXT_H
18#define YY_DECL isc::netconf::NetconfParser::symbol_type netconf_lex (ParserContext& driver)
67 std::vector<isc::data::ElementPtr>
stack_;
126 void error(
const isc::netconf::location& loc,
127 const std::string& what,
137 void error(
const std::string& what);
146 static void fatal(
const std::string& what);
166 void require(
const std::string& name,
178 void unique(
const std::string& name,
187 void warning(
const isc::netconf::location& loc,
const std::string& what);
243 std::vector<isc::netconf::location>
locs_;
296 bool trace_scanning_;
302 std::vector<LexerContext> cstack_;
Parser context is a wrapper around flex/bison instances dedicated to Netconf-agent config file parser...
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
ParserContext()
Default constructor.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
virtual ~ParserContext()
destructor
const std::string contextName()
Get the syntactic context name.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
LexerContext ctx_
Current syntactic context.
std::vector< std::string > files_
File name stack.
void unique(const std::string &name, isc::data::Element::Position loc)
Check if a parameter is already present.
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.
void warning(const isc::netconf::location &loc, const std::string &what)
Warning handler.
isc::data::Element::Position loc2pos(isc::netconf::location &loc)
Converts bison's position to one understandable by isc::data::Element.
void enter(const LexerContext &ctx)
Enter a new syntactic context.
LexerContext
Defines syntactic contexts for lexical tie-ins.
@ NO_KEYWORDS
This one is used in pure JSON mode.
@ HOOKS_LIBRARIES
Used while parsing Netconf/loggers structures.
@ CONFIG
Used while parsing content of Netconf.
@ MANAGED_SERVERS
Used while parsing Netconf/managed-servers.
@ SERVER
Used while parsing Netconf/manages-servers/*/control-socket.
@ LOGGERS
Used while parsing Netconf/loggers/output-options structures.
@ SOCKET_TYPE
Used while parsing Netconf/hooks-libraries.
@ CONTROL_SOCKET
Used while parsing Netconf/managed-servers/*/control-socket/socket-type.
void includeFile(const std::string &filename)
Divert input to an include file.
std::vector< isc::netconf::location > locs_
Location stack.
FILE * sfile_
sFile (aka FILE)
static void fatal(const std::string &what)
Fatal error handler.
isc::netconf::location loc_
Location of the current token.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
ParserType
Defines currently supported scopes.
@ PARSER_NETCONF
This parser will expect the content as Netconf config wrapped in a map (that's the regular config fil...
@ PARSER_JSON
This parser will parse the content as generic JSON.
@ PARSER_SUB_NETCONF
This parser will expect only the content of Netconf.
void warnAboutExtraCommas(const isc::netconf::location &loc)
Warning for extra commas.
void error(const isc::netconf::location &loc, const std::string &what, size_t pos=0)
Error handler.
std::vector< FILE * > sfiles_
sFile (aka FILE) stack
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
void leave()
Leave a syntactic context.
std::string file_
File name.
std::vector< struct yy_buffer_state * > states_
Lexer state stack.
void scanEnd()
Method called after the last tokens are scanned.
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-lfc.
Forward declaration of the ParserContext class.
Define the isc::netconf::parser class.
Represents the position of the data element within a configuration string.