// Note that ctx_ is NO_KEYWORD here
// Values rule
-value: INTEGER { $$ = ElementPtr(new IntElement($1)); }
- | FLOAT { $$ = ElementPtr(new DoubleElement($1)); }
- | BOOLEAN { $$ = ElementPtr(new BoolElement($1)); }
- | STRING { $$ = ElementPtr(new StringElement($1)); }
- | NULL_TYPE { $$ = ElementPtr(new NullElement()); }
+value: INTEGER { $$ = ElementPtr(new IntElement($1, ctx.loc2pos(@1))); }
+ | FLOAT { $$ = ElementPtr(new DoubleElement($1, ctx.loc2pos(@1))); }
+ | BOOLEAN { $$ = ElementPtr(new BoolElement($1, ctx.loc2pos(@1))); }
+ | STRING { $$ = ElementPtr(new StringElement($1, ctx.loc2pos(@1))); }
+ | NULL_TYPE { $$ = ElementPtr(new NullElement(ctx.loc2pos(@1))); }
| map2 { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
| list_generic { $$ = ctx.stack_.back(); ctx.stack_.pop_back(); }
;
map2: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
// the content of the map
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
} map_content RCURLY_BRACKET {
// map parsing completed. If we ever want to do any wrap up
;
list_generic: LSQUARE_BRACKET {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(l);
} list_content RSQUARE_BRACKET {
// list parsing complete. Put any sanity checking here
syntax_map: LCURLY_BRACKET {
// This code is executed when we're about to start parsing
// the content of the map
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.push_back(m);
} global_objects RCURLY_BRACKET {
// map parsing completed. If we ever want to do any wrap up
dhcp6_object: DHCP6 {
// This code is executed when we're about to start parsing
// the content of the map
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("Dhcp6", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.DHCP6);
;
preferred_lifetime: PREFERRED_LIFETIME COLON INTEGER {
- ElementPtr prf(new IntElement($3));
+ ElementPtr prf(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("preferred-lifetime", prf);
};
valid_lifetime: VALID_LIFETIME COLON INTEGER {
- ElementPtr prf(new IntElement($3));
+ ElementPtr prf(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("valid-lifetime", prf);
};
renew_timer: RENEW_TIMER COLON INTEGER {
- ElementPtr prf(new IntElement($3));
+ ElementPtr prf(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("renew-timer", prf);
};
rebind_timer: REBIND_TIMER COLON INTEGER {
- ElementPtr prf(new IntElement($3));
+ ElementPtr prf(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("rebind-timer", prf);
};
interfaces_config: INTERFACES_CONFIG {
- ElementPtr i(new MapElement());
+ ElementPtr i(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("interfaces-config", i);
ctx.stack_.push_back(i);
ctx.enter(ctx.INTERFACES_CONFIG);
};
interface_config_map: INTERFACES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("interfaces", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.NO_KEYWORD);
};
lease_database: LEASE_DATABASE {
- ElementPtr i(new MapElement());
+ ElementPtr i(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("lease-database", i);
ctx.stack_.push_back(i);
ctx.enter(ctx.LEASE_DATABASE);
};
hosts_database: HOSTS_DATABASE {
- ElementPtr i(new MapElement());
+ ElementPtr i(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("hosts-database", i);
ctx.stack_.push_back(i);
ctx.enter(ctx.HOSTS_DATABASE);
type: TYPE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr prf(new StringElement($4));
+ ElementPtr prf(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("type", prf);
ctx.leave();
};
user: USER {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr user(new StringElement($4));
+ ElementPtr user(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("user", user);
ctx.leave();
};
password: PASSWORD {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr pwd(new StringElement($4));
+ ElementPtr pwd(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("password", pwd);
ctx.leave();
};
host: HOST {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr h(new StringElement($4));
+ ElementPtr h(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("host", h);
ctx.leave();
};
name: NAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr name(new StringElement($4));
+ ElementPtr name(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("name", name);
ctx.leave();
};
persist: PERSIST COLON BOOLEAN {
- ElementPtr n(new BoolElement($3));
+ ElementPtr n(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("persist", n);
};
lfc_interval: LFC_INTERVAL COLON INTEGER {
- ElementPtr n(new IntElement($3));
+ ElementPtr n(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("lfc-interval", n);
};
mac_sources: MAC_SOURCES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("mac-sources", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.MAC_SOURCES);
;
duid_id : DUID {
- ElementPtr duid(new StringElement("duid"));
+ ElementPtr duid(new StringElement("duid", ctx.loc2pos(@1)));
ctx.stack_.back()->add(duid);
};
string_id : STRING {
- ElementPtr duid(new StringElement($1));
+ ElementPtr duid(new StringElement($1, ctx.loc2pos(@1)));
ctx.stack_.back()->add(duid);
};
host_reservation_identifiers: HOST_RESERVATION_IDENTIFIERS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("host-reservation-identifiers", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.HOST_RESERVATION_IDENTIFIERS);
;
hw_address_id : HW_ADDRESS {
- ElementPtr hwaddr(new StringElement("hw-address"));
+ ElementPtr hwaddr(new StringElement("hw-address", ctx.loc2pos(@1)));
ctx.stack_.back()->add(hwaddr);
};
relay_supplied_options: RELAY_SUPPLIED_OPTIONS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("relay-supplied-options", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.NO_KEYWORD);
};
hooks_libraries: HOOKS_LIBRARIES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("hooks-libraries", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.HOOKS_LIBRARIES);
;
hooks_library: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} hooks_params RCURLY_BRACKET {
hooks_param: LIBRARY {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr lib(new StringElement($4));
+ ElementPtr lib(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("library", lib);
ctx.leave();
};
// --- expired-leases-processing ------------------------
expired_leases_processing: EXPIRED_LEASES_PROCESSING {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("expired-leases-processing", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.NO_KEYWORD);
// Instead of explicitly listing all allowed expired leases parameters, we
// simply say that all of them as integers.
expired_leases_param: STRING COLON INTEGER {
- ElementPtr value(new IntElement($3));
+ ElementPtr value(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set($1, value);
}
// This defines subnet6 as a list of maps.
// "subnet6": [ ... ]
subnet6_list: SUBNET6 {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("subnet6", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.SUBNET6);
// This defines a single subnet, i.e. a single map with
// subnet6 array.
subnet6: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} subnet6_params RCURLY_BRACKET {
subnet: SUBNET {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr subnet(new StringElement($4));
+ ElementPtr subnet(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("subnet", subnet);
ctx.leave();
};
interface: INTERFACE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr iface(new StringElement($4));
+ ElementPtr iface(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("interface", iface);
ctx.leave();
};
client_class: CLIENT_CLASS {
ctx.enter(ctx.CLIENT_CLASS);
} COLON STRING {
- ElementPtr cls(new StringElement($4));
+ ElementPtr cls(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("client-class", cls);
ctx.leave();
};
id: ID COLON INTEGER {
- ElementPtr id(new IntElement($3));
+ ElementPtr id(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("id", id);
};
// This defines the "option-data": [ ... ] entry that may appear
// in several places, but most notably in subnet6 entries.
option_data_list: OPTION_DATA {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("option-data", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.OPTION_DATA);
// This defines th content of a single entry { ... } within
// option-data list.
option_data_entry: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} option_data_params RCURLY_BRACKET {
option_data_data: DATA {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr data(new StringElement($4));
+ ElementPtr data(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("data", data);
ctx.leave();
};
option_data_code: CODE COLON INTEGER {
- ElementPtr code(new IntElement($3));
+ ElementPtr code(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("code", code);
};
option_data_space: SPACE {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr space(new StringElement($4));
+ ElementPtr space(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("space", space);
ctx.leave();
};
option_data_csv_format: CSV_FORMAT COLON BOOLEAN {
- ElementPtr space(new BoolElement($3));
+ ElementPtr space(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("csv-format", space);
};
// This defines the "pools": [ ... ] entry that may appear in subnet6.
pools_list: POOLS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("pools", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.POOLS);
;
pool_list_entry: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} pool_params RCURLY_BRACKET {
pool_entry: POOL {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr pool(new StringElement($4));
+ ElementPtr pool(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("pool", pool);
ctx.leave();
};
// --- pd-pools ----------------------------------------------
pd_pools_list: PD_POOLS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("pd-pools", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.PD_POOLS);
;
pd_pool_entry: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} pd_pool_params RCURLY_BRACKET {
pd_prefix: PREFIX {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr prf(new StringElement($4));
+ ElementPtr prf(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("prefix", prf);
ctx.leave();
}
pd_prefix_len: PREFIX_LEN COLON INTEGER {
- ElementPtr prf(new IntElement($3));
+ ElementPtr prf(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("prefix-len", prf);
}
pd_delegated_len: DELEGATED_LEN COLON INTEGER {
- ElementPtr deleg(new IntElement($3));
+ ElementPtr deleg(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("delegated-len", deleg);
}
// --- reservations ------------------------------------------
reservations: RESERVATIONS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("reservations", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.RESERVATIONS);
;
reservation: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} reservation_params RCURLY_BRACKET {
;
ip_addresses: IP_ADDRESSES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("ip-addresses", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.NO_KEYWORD);
};
prefixes: PREFIXES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("prefixes", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.NO_KEYWORD);
duid: DUID {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr d(new StringElement($4));
+ ElementPtr d(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("duid", d);
ctx.leave();
};
hw_address: HW_ADDRESS {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr hw(new StringElement($4));
+ ElementPtr hw(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("hw-address", hw);
ctx.leave();
};
hostname: HOSTNAME {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr host(new StringElement($4));
+ ElementPtr host(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("hostname", host);
ctx.leave();
}
reservation_client_classes: CLIENT_CLASSES {
- ElementPtr c(new ListElement());
+ ElementPtr c(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("client-classes", c);
ctx.stack_.push_back(c);
ctx.enter(ctx.NO_KEYWORD);
// --- client classes ----------------------------------------
client_classes: CLIENT_CLASSES {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("client-classes", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.CLIENT_CLASSES);
;
client_class: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} client_class_params RCURLY_BRACKET {
client_class_test: TEST {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr test(new StringElement($4));
+ ElementPtr test(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("test", test);
ctx.leave();
}
// --- server-id ---------------------------------------------
server_id: SERVER_ID {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("server-id", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.SERVER_ID);
;
htype: HTYPE COLON INTEGER {
- ElementPtr htype(new IntElement($3));
+ ElementPtr htype(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("htype", htype);
};
identifier: IDENTIFIER {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr id(new StringElement($4));
+ ElementPtr id(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("identifier", id);
ctx.leave();
};
time: TIME COLON INTEGER {
- ElementPtr time(new IntElement($3));
+ ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("time", time);
};
enterprise_id: ENTERPRISE_ID COLON INTEGER {
- ElementPtr time(new IntElement($3));
+ ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("enterprise-id", time);
};
// --- end of server-id --------------------------------------
dhcp4o6_port: DHCP4O6_PORT COLON INTEGER {
- ElementPtr time(new IntElement($3));
+ ElementPtr time(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("dhcp4o6-port", time);
};
// the following "Logging": { ... }. The ... is defined
// by logging_params
logging_object: LOGGING {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("Logging", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.LOGGING);
// "loggers", the only parameter currently defined in "Logging" object,
// is "Loggers": [ ... ].
loggers: LOGGERS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("loggers", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.LOGGERS);
// This defines a single entry defined in loggers in Logging.
logger_entry: LCURLY_BRACKET {
- ElementPtr l(new MapElement());
+ ElementPtr l(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(l);
ctx.stack_.push_back(l);
} logger_params RCURLY_BRACKET {
;
debuglevel: DEBUGLEVEL COLON INTEGER {
- ElementPtr dl(new IntElement($3));
+ ElementPtr dl(new IntElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("debuglevel", dl);
};
severity: SEVERITY {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr sev(new StringElement($4));
+ ElementPtr sev(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("severity", sev);
ctx.leave();
};
output_options_list: OUTPUT_OPTIONS {
- ElementPtr l(new ListElement());
+ ElementPtr l(new ListElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("output_options", l);
ctx.stack_.push_back(l);
ctx.enter(ctx.OUTPUT_OPTIONS);
;
output_entry: LCURLY_BRACKET {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->add(m);
ctx.stack_.push_back(m);
} output_params RCURLY_BRACKET {
output_param: OUTPUT {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr sev(new StringElement($4));
+ ElementPtr sev(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("output", sev);
ctx.leave();
};
dhcp_ddns: DHCP_DDNS {
- ElementPtr m(new MapElement());
+ ElementPtr m(new MapElement(ctx.loc2pos(@1)));
ctx.stack_.back()->set("dhcp-ddns", m);
ctx.stack_.push_back(m);
ctx.enter(ctx.DHCP_DDNS);
;
enable_updates: ENABLE_UPDATES COLON BOOLEAN {
- ElementPtr b(new BoolElement($3));
+ ElementPtr b(new BoolElement($3, ctx.loc2pos(@3)));
ctx.stack_.back()->set("enable-updates", b);
};
qualifying_suffix: QUALIFYING_SUFFIX {
ctx.enter(ctx.NO_KEYWORD);
} COLON STRING {
- ElementPtr qs(new StringElement($4));
+ ElementPtr qs(new StringElement($4, ctx.loc2pos(@4)));
ctx.stack_.back()->set("qualifying-suffix", qs);
ctx.leave();
};