7#ifndef PARSER_CONTEXT_H
8#define PARSER_CONTEXT_H
17#define YY_DECL isc::dhcp::Dhcp4Parser::symbol_type parser4_lex (Parser4Context& driver)
101 std::vector<isc::data::ElementPtr>
stack_;
159 void error(
const isc::dhcp::location& loc,
160 const std::string& what,
170 void error(
const std::string& what);
179 static void fatal(
const std::string& what);
199 void require(
const std::string& name,
211 void unique(
const std::string& name,
220 void warning(
const isc::dhcp::location& loc,
const std::string& what);
369 std::vector<isc::dhcp::location>
locs_;
413 bool trace_scanning_;
419 std::vector<ParserContext> cstack_;
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Evaluation error exception raised when trying to parse.
Dhcp4ParseError(const char *file, size_t line, const char *what)
Evaluation context, an interface to the expression evaluation.
void scanFileBegin(FILE *f, const std::string &filename, ParserType type)
Method called before scanning starts on a file.
isc::data::ElementPtr parseFile(const std::string &filename, ParserType parser_type)
Run the parser on the file specified.
std::vector< std::string > files_
File name 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.
isc::data::Element::Position loc2pos(isc::dhcp::location &loc)
Converts bison's position to one understandable by isc::data::Element.
void leave()
Leave a syntactic context.
isc::data::ElementPtr parseString(const std::string &str, ParserType parser_type)
Run the parser on the string specified.
void unique(const std::string &name, isc::data::Element::Position loc)
Check if a parameter is already present.
void scanEnd()
Method called after the last tokens are scanned.
std::vector< FILE * > sfiles_
sFile (aka FILE) stack
void enter(const ParserContext &ctx)
Enter a new syntactic context.
Parser4Context()
Default constructor.
std::string file_
File name.
void warning(const isc::dhcp::location &loc, const std::string &what)
Warning handler.
void warnAboutExtraCommas(const isc::dhcp::location &loc)
Warning for extra commas.
const std::string contextName()
Get the syntactic context name.
ParserContext
Defines syntactic contexts for lexical tie-ins.
@ SUBNET4
Used while parsing Dhcp4/Subnet4 structures.
@ POOLS
Used while parsing Dhcp4/subnet4/pools structures.
@ CLIENT_CLASSES
Used while parsing Dhcp4/client-classes structures.
@ RESERVATIONS
Used while parsing Dhcp4/reservations structures.
@ HOSTS_DATABASE
Used while parsing Dhcp4/hosts-database[s] structures.
@ NCR_PROTOCOL
Used while parsing Dhcp4/dhcp-ddns/ncr-protocol.
@ LOGGERS
Used while parsing Dhcp4/loggers structures.
@ DATABASE_ON_FAIL
Used while parsing Dhcp4/*-database/on-fail.
@ NCR_FORMAT
Used while parsing Dhcp4/dhcp-ddns/ncr-format.
@ SERVER_ID
Used while parsing Dhcp4/server-id structures.
@ DDNS_CONFLICT_RESOLUTION_MODE
Used while parsing Dhcp4/ib-ddns-conflict-resolution-mode.
@ COMPATIBILITY
Used while parsing compatibility parameters.
@ OUTBOUND_INTERFACE
Used while parsing Dhcp4/interfaces/outbound-interface structures.
@ CONFIG
Used while parsing content of Dhcp4.
@ OUTPUT_OPTIONS
Used while parsing Dhcp4/loggers/output-options structures.
@ CONTROL_SOCKET
Used while parsing Dhcp4/control-socket structures.
@ DHCP_DDNS
Used while parsing Dhcp4/dhcp-ddns.
@ OPTION_DATA
Used while parsing Dhcp4/option-data, Dhcp4/subnet4/option-data or anywhere option-data is present (c...
@ AUTH_TYPE
Used while parsing Dhcp4/control-socket/authentication/type structures.
@ DHCP_MULTI_THREADING
Used while parsing Dhcp4/multi-threading structures.
@ LEASE_DATABASE
Used while parsing Dhcp4/lease-database structures.
@ SHARED_NETWORK
Used while parsing shared-networks structures.
@ EXPIRED_LEASES_PROCESSING
Used while parsing Dhcp4/expired-leases-processing.
@ CLIENTS
Used while parsing Dhcp4/control-socket/authentication/clients structures.
@ SANITY_CHECKS
Sanity checks.
@ CONFIG_CONTROL
Used while parsing Dhcp4/config-control.
@ INTERFACES_CONFIG
Used while parsing Dhcp4/interfaces structures.
@ HOST_RESERVATION_IDENTIFIERS
Used while parsing Dhcp4/host-reservation-identifiers.
@ CONTROL_SOCKET_TYPE
Used while parsing Dhcp4/control-socket/socket-type structures.
@ OPTION_DEF
Used while parsing Dhcp4/option-def structures.
@ CONFIG_DATABASE
Used while parsing config-control/config-databases.
@ NO_KEYWORD
This one is used in pure JSON mode.
@ HOOKS_LIBRARIES
Used while parsing Dhcp4/hooks-libraries.
@ DHCP_QUEUE_CONTROL
Used while parsing Dhcp4/dhcp-queue-control structures.
@ AUTHENTICATION
Used while parsing Dhcp4/control-socket/authentication structures.
@ REPLACE_CLIENT_NAME
Used while parsing Dhcp4/dhcp-ddns/replace-client-name.
@ RELAY
Used while parsing Dhcp4/subnet4relay structures.
@ DHCP_SOCKET_TYPE
Used while parsing Dhcp4/interfaces/dhcp-socket-type structures.
ParserType
Defines currently supported scopes.
@ PARSER_INTERFACES
This will parse the input as interfaces content.
@ PARSER_CONFIG_CONTROL
This will parse the input as config-control.
@ PARSER_DHCP_DDNS
This will parse the input as dhcp-ddns.
@ PARSER_DHCP4
This parser will parse the content as Dhcp4 config wrapped in a map (that's the regular config file)
@ PARSER_OPTION_DEFS
This will parse the input option definitions (for tests).
@ PARSER_HOST_RESERVATION
This will parse the input as host-reservation.
@ PARSER_OPTION_DATA
This will parse the input as option data.
@ PARSER_OPTION_DEF
This will parse the input as option definition.
@ PARSER_JSON
This parser will parse the content as generic JSON.
@ PARSER_POOL4
This will parse the input as pool4 content.
@ SUBPARSER_DHCP4
This parser will parse the content of Dhcp4 (without outer { } and without "Dhcp4").
@ PARSER_HOOKS_LIBRARY
This will parse the input as hooks-library.
@ PARSER_SUBNET4
This will parse the input as Subnet4 content.
FILE * sfile_
sFile (aka FILE)
std::vector< struct yy_buffer_state * > states_
Lexer state stack.
isc::dhcp::location loc_
Location of the current token.
std::vector< isc::data::ElementPtr > stack_
JSON elements being parsed.
void includeFile(const std::string &filename)
Divert input to an include file.
void scanStringBegin(const std::string &str, ParserType type)
Method called before scanning starts on a string.
ParserContext ctx_
Current syntactic context.
std::vector< isc::dhcp::location > locs_
Location stack.
virtual ~Parser4Context()
destructor
Forward declaration of the ParserContext class.
Define the isc::dhcp::parser class.
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.