7#ifndef PARSER_CONTEXT_H
8#define PARSER_CONTEXT_H
17#define YY_DECL isc::agent::AgentParser::symbol_type agent_lex (ParserContext& driver)
66 std::vector<isc::data::ElementPtr>
stack_;
125 void error(
const isc::agent::location& loc,
126 const std::string& what,
136 void error(
const std::string& what);
145 static void fatal(
const std::string& what);
165 void require(
const std::string& name,
177 void unique(
const std::string& name,
186 void warning(
const isc::agent::location& loc,
const std::string& what);
250 std::vector<isc::agent::location>
locs_;
303 bool trace_scanning_;
309 std::vector<LexerContext> cstack_;
Forward declaration of the ParserContext class.
Define the isc::agent::parser class.
Parser context is a wrapper around flex/bison instances dedicated to Control-agent config file parser...
void warning(const isc::agent::location &loc, const std::string &what)
Warning handler.
std::vector< isc::agent::location > locs_
Location stack.
void warnAboutExtraCommas(const isc::agent::location &loc)
Warning for extra commas.
std::vector< std::string > files_
File name stack.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
ParserContext()
Default constructor.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
void unique(const std::string &name, isc::data::Element::Position loc)
Check if a parameter is already present.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
static void fatal(const std::string &what)
Fatal error handler.
virtual ~ParserContext()
destructor
std::vector< struct yy_buffer_state * > states_
Lexer state stack.
isc::agent::location loc_
Location of the current token.
const std::string contextName()
Get the syntactic context name.
std::string file_
File name.
void includeFile(const std::string &filename)
Divert input to an include file.
isc::data::Element::Position loc2pos(isc::agent::location &loc)
Converts bison's position to one understandable by isc::data::Element.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
LexerContext ctx_
Current syntactic context.
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
void leave()
Leave a syntactic context.
LexerContext
Defines syntactic contexts for lexical tie-ins.
@ CONFIG
Used while parsing content of Agent.
@ SERVER
Used while parsing Control-agent/control-socket/*-server/socket-type.
@ NO_KEYWORDS
This one is used in pure JSON mode.
@ HOOKS_LIBRARIES
Used while parsing Control-agent/loggers structures.
@ CONTROL_SOCKETS
Used while parsing Control-agent/control-socket/*-server.
@ HTTP_HEADERS
Used while parsing Control-agent/Authentication.
@ SOCKET_TYPE
Used while parsing Control-agent/hooks-libraries.
@ AGENT
Used while parsing HTTP headers.
@ CLIENTS
Used while parsing Control-agent/control-sockets.
@ AUTHENTICATION
Used while parsing Control-agent/Authentication/type.
@ AUTH_TYPE
Used while parsing Control-agent/Authentication/clients.
@ LOGGERS
Used while parsing Control-agent/loggers/output-options structures.
std::vector< FILE * > sfiles_
sFile (aka FILE) stack
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 error(const isc::agent::location &loc, const std::string &what, size_t pos=0)
Error handler.
ParserType
Defines currently supported scopes.
@ PARSER_AGENT
This parser will expect the content as Control-agent config wrapped in a map (that's the regular conf...
@ PARSER_JSON
This parser will parse the content as generic JSON.
@ PARSER_SUB_AGENT
This parser will expect only the content of Control-agent.
void enter(const LexerContext &ctx)
Enter a new syntactic context.
FILE * sfile_
sFile (aka FILE)
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.
Represents the position of the data element within a configuration string.