mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[#916] Checkpoint before regen 2
This commit is contained in:
parent
92849b6886
commit
9312d57c73
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -312,19 +312,9 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"Logging\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::CONFIG:
|
||||
return AgentParser::make_LOGGING(driver.loc_);
|
||||
default:
|
||||
return AgentParser::make_STRING("Logging", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"loggers\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::AGENT:
|
||||
case ParserContext::LOGGING:
|
||||
return AgentParser::make_LOGGERS(driver.loc_);
|
||||
default:
|
||||
return AgentParser::make_STRING("loggers", driver.loc_);
|
||||
@ -412,33 +402,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"Dhcp4\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::CONFIG:
|
||||
return AgentParser::make_DHCP4(driver.loc_);
|
||||
default:
|
||||
return AgentParser::make_STRING("Dhcp4", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"Dhcp6\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::CONFIG:
|
||||
return AgentParser::make_DHCP6(driver.loc_);
|
||||
default:
|
||||
return AgentParser::make_STRING("Dhcp6", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"DhcpDdns\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::CONFIG:
|
||||
return AgentParser::make_DHCPDDNS(driver.loc_);
|
||||
default:
|
||||
return AgentParser::make_STRING("DhcpDdns", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
{JSONString} {
|
||||
/* A string has been matched. It contains the actual string and single quotes.
|
||||
We need to get those quotes out of the way and just use its content, e.g.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -67,7 +67,6 @@ using namespace std;
|
||||
LIBRARY "library"
|
||||
PARAMETERS "parameters"
|
||||
|
||||
LOGGING "Logging"
|
||||
LOGGERS "loggers"
|
||||
NAME "name"
|
||||
OUTPUT_OPTIONS "output_options"
|
||||
@ -79,10 +78,6 @@ using namespace std;
|
||||
MAXVER "maxver"
|
||||
PATTERN "pattern"
|
||||
|
||||
DHCP4 "Dhcp4"
|
||||
DHCP6 "Dhcp6"
|
||||
DHCPDDNS "DhcpDdns"
|
||||
|
||||
// Not real tokens, just a way to signal what the parser is expected to
|
||||
// parse. This define the starting point. It either can be full grammar
|
||||
// (START_AGENT), part of the grammar related to control-agent (START_SUB_AGENT)
|
||||
@ -106,7 +101,7 @@ using namespace std;
|
||||
%%
|
||||
|
||||
// The whole grammar starts with a map, because the config file
|
||||
// consists of Control-Agent, DhcpX, Logger and DhcpDdns entries in one big { }.
|
||||
// consists of only Control-Agent entry in one big { }.
|
||||
%start start;
|
||||
|
||||
// The starting token can be one of those listed below. Note these are
|
||||
@ -219,8 +214,7 @@ unknown_map_entry: STRING COLON {
|
||||
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
||||
};
|
||||
|
||||
// This defines the top-level { } that holds Control-agent, Dhcp6, Dhcp4,
|
||||
// DhcpDdns or Logging objects.
|
||||
// This defines the top-level { } that holds only Control-agent object.
|
||||
agent_syntax_map: LCURLY_BRACKET {
|
||||
// This code is executed when we're about to start parsing
|
||||
// the content of the map
|
||||
@ -232,18 +226,12 @@ agent_syntax_map: LCURLY_BRACKET {
|
||||
// for it.
|
||||
};
|
||||
|
||||
// This represents top-level entries: Control-agent, Logging, possibly others
|
||||
// This represents top-level entries: Control-agent.
|
||||
global_objects: global_object
|
||||
| global_objects COMMA global_object
|
||||
;
|
||||
|
||||
// This represents a single top level entry, e.g. Control-agent, Dhcp6 or DhcpDdns.
|
||||
// This represents a single top level entry, e.g. Control-agent.
|
||||
global_object: agent_object
|
||||
| logging_object
|
||||
| dhcp4_json_object
|
||||
| dhcp6_json_object
|
||||
| dhcpddns_json_object
|
||||
| unknown_map_entry
|
||||
;
|
||||
|
||||
// This define the Control-agent object.
|
||||
@ -493,55 +481,8 @@ socket_type_value : UNIX { $$ = ElementPtr(new StringElement("unix", ctx.loc2pos
|
||||
|
||||
// --- control-sockets end here ------------------------------------------------
|
||||
|
||||
// JSON entries for other global objects (Dhcp4,Dhcp6 and DhcpDdns)
|
||||
dhcp4_json_object: DHCP4 {
|
||||
ctx.enter(ctx.NO_KEYWORDS);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("Dhcp4", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
// --- Loggers starts here -----------------------------------------------------
|
||||
|
||||
dhcp6_json_object: DHCP6 {
|
||||
ctx.enter(ctx.NO_KEYWORDS);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("Dhcp6", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
dhcpddns_json_object: DHCPDDNS {
|
||||
ctx.enter(ctx.NO_KEYWORDS);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("DhcpDdns", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// --- Logging starts here -----------------------------------------------------
|
||||
|
||||
// This defines the top level "Logging" object. It parses
|
||||
// the following "Logging": { ... }. The ... is defined
|
||||
// by logging_params
|
||||
logging_object: LOGGING {
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("Logging", m);
|
||||
ctx.stack_.push_back(m);
|
||||
ctx.enter(ctx.LOGGING);
|
||||
} COLON LCURLY_BRACKET logging_params RCURLY_BRACKET {
|
||||
ctx.stack_.pop_back();
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// This defines the list of allowed parameters that may appear
|
||||
// in the top-level Logging object. It can either be a single
|
||||
// parameter or several parameters separated by commas.
|
||||
logging_params: logging_param
|
||||
| logging_params COMMA logging_param
|
||||
;
|
||||
|
||||
// There's currently only one parameter defined, which is "loggers".
|
||||
logging_param: loggers;
|
||||
|
||||
// "loggers", the only parameter currently defined in "Logging" object,
|
||||
// is "Loggers": [ ... ].
|
||||
loggers: LOGGERS {
|
||||
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("loggers", l);
|
||||
@ -558,7 +499,7 @@ loggers_entries: logger_entry
|
||||
| loggers_entries COMMA logger_entry
|
||||
;
|
||||
|
||||
// This defines a single entry defined in loggers in Logging.
|
||||
// This defines a single entry defined in loggers.
|
||||
logger_entry: LCURLY_BRACKET {
|
||||
ElementPtr l(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->add(l);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -123,8 +123,6 @@ ParserContext::contextName()
|
||||
return ("toplevel");
|
||||
case AGENT:
|
||||
return ("Control-agent");
|
||||
case LOGGING:
|
||||
return ("Logging");
|
||||
case CONTROL_SOCKETS:
|
||||
return ("control-sockets");
|
||||
case SERVER:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -152,15 +152,12 @@ public:
|
||||
///< This one is used in pure JSON mode.
|
||||
NO_KEYWORDS,
|
||||
|
||||
///< Used while parsing top level (that contains Control-agent, Logging and others)
|
||||
///< Used while parsing top level (that contains Control-agent)
|
||||
CONFIG,
|
||||
|
||||
///< Used while parsing content of Agent.
|
||||
AGENT,
|
||||
|
||||
///< Used while parsing content of Logging.
|
||||
LOGGING,
|
||||
|
||||
///< Used while parsing Control-agent/control-sockets.
|
||||
CONTROL_SOCKETS,
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -419,20 +419,9 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
\"Logging\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::d2::D2ParserContext::CONFIG:
|
||||
return isc::d2::D2Parser::make_LOGGING(driver.loc_);
|
||||
default:
|
||||
return isc::d2::D2Parser::make_STRING("Logging", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"loggers\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::d2::D2ParserContext::DHCPDDNS:
|
||||
case isc::d2::D2ParserContext::LOGGING:
|
||||
return isc::d2::D2Parser::make_LOGGERS(driver.loc_);
|
||||
default:
|
||||
return isc::d2::D2Parser::make_STRING("loggers", driver.loc_);
|
||||
@ -524,34 +513,6 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"Dhcp4\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::d2::D2ParserContext::CONFIG:
|
||||
return isc::d2::D2Parser::make_DHCP4(driver.loc_);
|
||||
default:
|
||||
return isc::d2::D2Parser::make_STRING("Dhcp4", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"Dhcp6\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::d2::D2ParserContext::CONFIG:
|
||||
return isc::d2::D2Parser::make_DHCP6(driver.loc_);
|
||||
default:
|
||||
return isc::d2::D2Parser::make_STRING("Dhcp6", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"Control-agent\" {
|
||||
switch(driver.ctx_) {
|
||||
case isc::d2::D2ParserContext::CONFIG:
|
||||
return isc::d2::D2Parser::make_CONTROL_AGENT(driver.loc_);
|
||||
default:
|
||||
return isc::d2::D2Parser::make_STRING("Control-agent", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{JSONString} {
|
||||
/* A string has been matched. It contains the actual string and single quotes.
|
||||
We need to get those quotes out of the way and just use its content, e.g.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -49,10 +49,6 @@ using namespace std;
|
||||
RCURLY_BRACKET "}"
|
||||
NULL_TYPE "null"
|
||||
|
||||
DHCP6 "Dhcp6"
|
||||
DHCP4 "Dhcp4"
|
||||
CONTROL_AGENT "Control-agent"
|
||||
|
||||
DHCPDDNS "DhcpDdns"
|
||||
IP_ADDRESS "ip-address"
|
||||
PORT "port"
|
||||
@ -79,7 +75,6 @@ using namespace std;
|
||||
SOCKET_TYPE "socket-type"
|
||||
SOCKET_NAME "socket-name"
|
||||
|
||||
LOGGING "Logging"
|
||||
LOGGERS "loggers"
|
||||
NAME "name"
|
||||
OUTPUT_OPTIONS "output_options"
|
||||
@ -215,8 +210,7 @@ unknown_map_entry: STRING COLON {
|
||||
};
|
||||
|
||||
|
||||
// This defines the top-level { } that holds Control-agent, Dhcp6, Dhcp4,
|
||||
// DhcpDdns or Logging objects.
|
||||
// This defines the top-level { } that holds only DhcpDdns object.
|
||||
syntax_map: LCURLY_BRACKET {
|
||||
// This code is executed when we're about to start parsing
|
||||
// the content of the map
|
||||
@ -228,18 +222,12 @@ syntax_map: LCURLY_BRACKET {
|
||||
// for it.
|
||||
};
|
||||
|
||||
// This represents top-level entries: Dhcp6, Dhcp4, DhcpDdns, Logging
|
||||
// This represents top-level entries: DhcpDdns.
|
||||
global_objects: global_object
|
||||
| global_objects COMMA global_object
|
||||
;
|
||||
|
||||
// This represents a single top level entry, e.g. Dhcp6 or DhcpDdns.
|
||||
global_object: dhcp6_json_object
|
||||
| logging_object
|
||||
| dhcp4_json_object
|
||||
| dhcpddns_object
|
||||
| control_agent_json_object
|
||||
| unknown_map_entry
|
||||
// This represents a single top level entry, e.g. DhcpDdns.
|
||||
global_object: dhcpddns_object
|
||||
;
|
||||
|
||||
// --- dhcp ddns ---------------------------------------------
|
||||
@ -711,55 +699,8 @@ control_socket_name: SOCKET_NAME {
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// --- loggers entry -----------------------------------------
|
||||
|
||||
dhcp6_json_object: DHCP6 {
|
||||
ctx.enter(ctx.NO_KEYWORD);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("Dhcp6", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
dhcp4_json_object: DHCP4 {
|
||||
ctx.enter(ctx.NO_KEYWORD);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("Dhcp4", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
control_agent_json_object: CONTROL_AGENT {
|
||||
ctx.enter(ctx.NO_KEYWORD);
|
||||
} COLON value {
|
||||
ctx.stack_.back()->set("Control-agent", $4);
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// --- logging entry -----------------------------------------
|
||||
|
||||
// This defines the top level "Logging" object. It parses
|
||||
// the following "Logging": { ... }. The ... is defined
|
||||
// by logging_params
|
||||
logging_object: LOGGING {
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("Logging", m);
|
||||
ctx.stack_.push_back(m);
|
||||
ctx.enter(ctx.LOGGING);
|
||||
} COLON LCURLY_BRACKET logging_params RCURLY_BRACKET {
|
||||
ctx.stack_.pop_back();
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// This defines the list of allowed parameters that may appear
|
||||
// in the top-level Logging object. It can either be a single
|
||||
// parameter or several parameters separated by commas.
|
||||
logging_params: logging_param
|
||||
| logging_params COMMA logging_param
|
||||
;
|
||||
|
||||
// There's currently only one parameter defined, which is "loggers".
|
||||
logging_param: loggers;
|
||||
|
||||
// "loggers", the only parameter currently defined in "Logging" object,
|
||||
// is "Loggers": [ ... ].
|
||||
loggers: LOGGERS {
|
||||
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
|
||||
@ -777,7 +718,7 @@ loggers_entries: logger_entry
|
||||
| loggers_entries COMMA logger_entry
|
||||
;
|
||||
|
||||
// This defines a single entry defined in loggers in Logging.
|
||||
// This defines a single entry defined in loggers.
|
||||
logger_entry: LCURLY_BRACKET {
|
||||
ElementPtr l(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->add(l);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -144,8 +144,6 @@ D2ParserContext::contextName()
|
||||
return("dns-servers");
|
||||
case CONTROL_SOCKET:
|
||||
return("control-socket");
|
||||
case LOGGING:
|
||||
return ("Logging");
|
||||
case LOGGERS:
|
||||
return ("loggers");
|
||||
case OUTPUT_OPTIONS:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2017-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2017-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -48,7 +48,7 @@ public:
|
||||
/// This parser will parse the content as generic JSON.
|
||||
PARSER_JSON,
|
||||
|
||||
///< Used for parsing top level (contains DhcpDdns, Logging, others)
|
||||
///< Used for parsing top level (contains DhcpDdns)
|
||||
PARSER_DHCPDDNS,
|
||||
|
||||
///< Used for parsing content of DhcpDdns.
|
||||
@ -165,7 +165,7 @@ public:
|
||||
///< This one is used in pure JSON mode.
|
||||
NO_KEYWORD,
|
||||
|
||||
///< Used while parsing top level (contains DhcpDdns, Logging, ...)
|
||||
///< Used while parsing top level (contains DhcpDdns).
|
||||
CONFIG,
|
||||
|
||||
///< Used while parsing content of DhcpDdns.
|
||||
@ -207,9 +207,6 @@ public:
|
||||
///< Used while parsing content of a control-socket
|
||||
CONTROL_SOCKET,
|
||||
|
||||
///< Used while parsing content of Logging
|
||||
LOGGING,
|
||||
|
||||
/// Used while parsing DhcpDdns/loggers structures.
|
||||
LOGGERS,
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -380,19 +380,9 @@ ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
|
||||
}
|
||||
}
|
||||
|
||||
\"Logging\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::CONFIG:
|
||||
return NetconfParser::make_LOGGING(driver.loc_);
|
||||
default:
|
||||
return NetconfParser::make_STRING("Logging", driver.loc_);
|
||||
}
|
||||
}
|
||||
|
||||
\"loggers\" {
|
||||
switch(driver.ctx_) {
|
||||
case ParserContext::NETCONF:
|
||||
case ParserContext::LOGGING:
|
||||
return NetconfParser::make_LOGGERS(driver.loc_);
|
||||
default:
|
||||
return NetconfParser::make_STRING("loggers", driver.loc_);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
/* Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -75,7 +75,6 @@ using namespace std;
|
||||
LIBRARY "library"
|
||||
PARAMETERS "parameters"
|
||||
|
||||
LOGGING "Logging"
|
||||
LOGGERS "loggers"
|
||||
NAME "name"
|
||||
OUTPUT_OPTIONS "output_options"
|
||||
@ -223,7 +222,7 @@ unknown_map_entry: STRING COLON {
|
||||
"got unexpected keyword \"" + keyword + "\" in " + where + " map.");
|
||||
};
|
||||
|
||||
// This defines the top-level { } that holds Netconf or Logging objects.
|
||||
// This defines the top-level { } that holds Netconf object.
|
||||
netconf_syntax_map: LCURLY_BRACKET {
|
||||
// This code is executed when we're about to start parsing
|
||||
// the content of the map
|
||||
@ -235,14 +234,13 @@ netconf_syntax_map: LCURLY_BRACKET {
|
||||
// for it.
|
||||
};
|
||||
|
||||
// This represents top-level entries: Netconf, Logging, possibly others
|
||||
// This represents top-level entries: Netconf.
|
||||
global_objects: global_object
|
||||
| global_objects COMMA global_object
|
||||
;
|
||||
|
||||
// This represents a single top level entry, e.g. Netconf or Logging.
|
||||
// This represents a single top level entry, e.g. Netconf.
|
||||
global_object: netconf_object
|
||||
| logging_object
|
||||
;
|
||||
|
||||
// This define the Netconf object.
|
||||
@ -252,6 +250,9 @@ netconf_object: NETCONF {
|
||||
// top level map (that's already on the stack) and put the new map
|
||||
// on the stack as well, so child elements will be able to add
|
||||
// themselves to it.
|
||||
|
||||
// Prevent against duplicate.
|
||||
ctx.unique("Netconf, ctx.loc2pos(@1));
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("Netconf", m);
|
||||
ctx.stack_.push_back(m);
|
||||
@ -558,33 +559,8 @@ socket_url: SOCKET_URL {
|
||||
|
||||
// --- managed-servers end here ------------------------------------------------
|
||||
|
||||
// --- Logging starts here -----------------------------------------------------
|
||||
// --- Loggers starts here -----------------------------------------------------
|
||||
|
||||
// This defines the top level "Logging" object. It parses
|
||||
// the following "Logging": { ... }. The ... is defined
|
||||
// by logging_params
|
||||
logging_object: LOGGING {
|
||||
ElementPtr m(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("Logging", m);
|
||||
ctx.stack_.push_back(m);
|
||||
ctx.enter(ctx.LOGGING);
|
||||
} COLON LCURLY_BRACKET logging_params RCURLY_BRACKET {
|
||||
ctx.stack_.pop_back();
|
||||
ctx.leave();
|
||||
};
|
||||
|
||||
// This defines the list of allowed parameters that may appear
|
||||
// in the top-level Logging object. It can either be a single
|
||||
// parameter or several parameters separated by commas.
|
||||
logging_params: logging_param
|
||||
| logging_params COMMA logging_param
|
||||
;
|
||||
|
||||
// There's currently only one parameter defined, which is "loggers".
|
||||
logging_param: loggers;
|
||||
|
||||
// "loggers", the only parameter currently defined in "Logging" object,
|
||||
// is "Loggers": [ ... ].
|
||||
loggers: LOGGERS {
|
||||
ElementPtr l(new ListElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->set("loggers", l);
|
||||
@ -601,7 +577,7 @@ loggers_entries: logger_entry
|
||||
| loggers_entries COMMA logger_entry
|
||||
;
|
||||
|
||||
// This defines a single entry defined in loggers in Logging.
|
||||
// This defines a single entry defined in loggers.
|
||||
logger_entry: LCURLY_BRACKET {
|
||||
ElementPtr l(new MapElement(ctx.loc2pos(@1)));
|
||||
ctx.stack_.back()->add(l);
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -111,6 +111,18 @@ ParserContext::require(const std::string& name,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ParserContext::unique(const std::string& name,
|
||||
isc::data::Element::Position loc)
|
||||
{
|
||||
ConstElementPtr value = stack_.back()->get(name);
|
||||
if (value) {
|
||||
isc_throw(ParseError, loc << ": duplicate " << name
|
||||
<< " entries in " << contextName()
|
||||
<< " map (previous at " << value->getPosition() << ")");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ParserContext::enter(const LexerContext& ctx)
|
||||
{
|
||||
@ -138,8 +150,6 @@ ParserContext::contextName()
|
||||
return ("toplevel");
|
||||
case NETCONF:
|
||||
return ("Netconf");
|
||||
case LOGGING:
|
||||
return ("Logging");
|
||||
case MANAGED_SERVERS:
|
||||
return ("managed-servers");
|
||||
case SERVER:
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (C) 2018-2019 Internet Systems Consortium, Inc. ("ISC")
|
||||
// Copyright (C) 2018-2020 Internet Systems Consortium, Inc. ("ISC")
|
||||
//
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
@ -161,20 +161,28 @@ public:
|
||||
isc::data::Element::Position open_loc,
|
||||
isc::data::Element::Position close_loc);
|
||||
|
||||
/// @brief Check if a parameter is already present
|
||||
///
|
||||
/// Check if a parameter is already present in the map at the top
|
||||
/// of the stack and raise an error when it is.
|
||||
///
|
||||
/// @param name name of the parameter to check
|
||||
/// @param loc location of the current parameter
|
||||
/// @throw ParseError
|
||||
void unique(const std::string& name,
|
||||
isc::data::Element::Position loc);
|
||||
|
||||
/// @brief Defines syntactic contexts for lexical tie-ins
|
||||
typedef enum {
|
||||
///< This one is used in pure JSON mode.
|
||||
NO_KEYWORDS,
|
||||
|
||||
///< Used while parsing top level (that contains Netconf, Logging and others)
|
||||
///< Used while parsing top level (that contains Netconf)
|
||||
CONFIG,
|
||||
|
||||
///< Used while parsing content of Netconf.
|
||||
NETCONF,
|
||||
|
||||
///< Used while parsing content of Logging.
|
||||
LOGGING,
|
||||
|
||||
/// Used while parsing Netconf/managed-servers.
|
||||
MANAGED_SERVERS,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user