[Netconf-devel] guessnet has an /e/n/i parser in C++
Thomas Hood
jdthood@aglu.demon.nl
Tue, 19 Apr 2005 19:23:08 +0200
While we are on the topic of /e/n/i parsers, note that guessnet includes
a parser written in C++. It parses the stuff relevant to guessnet, of
course. Here are its regexps (from src/IfaceParser.cc):
#define ATLINESTART "^[[:blank:]]*(guessnet[0-9]*[[:blank:]]+)?test[0-9]*(-|[[:blank:]]+)"
#define MACPATTERN "[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}:[0-9A-Fa-f]{2}" ExtendedRegexp null_line("^[[:blank:]]*(#.*)?$");
ExtendedRegexp iface_line(
"^[[:blank:]]*iface[[:blank:]]+"
"([^[:blank:]]+)[[:blank:]]+"
"([^[:blank:]]+)[[:blank:]]+"
"([^[:blank:]]+)[[:blank:]]*$", 4);
ExtendedRegexp peer_line(
ATLINESTART "peer[[:blank:]]+(.+)$", 4);
ExtendedRegexp cable_line(
ATLINESTART "missing-cable[[:blank:]]*([[:blank:]]+.+)?$");
ExtendedRegexp script_line(
ATLINESTART "(script|command)[[:blank:]]+(.+)$", 5);
ExtendedRegexp dhcp_line(
ATLINESTART "dhcp[[:blank:]]*([[:blank:]]+.+)?$");
ExtendedRegexp pppoe_line(
ATLINESTART "pppoe[[:blank:]]*([[:blank:]]+.+)?$");
ExtendedRegexp wireless_mac_essid_line(
ATLINESTART "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]+essid[[:blank:]](.+)$", 5); ExtendedRegexp wireless_mac_line(
ATLINESTART "wireless[[:blank:]]+mac[[:blank:]]+([^[:blank:]]+)[[:blank:]]*$", 4);
ExtendedRegexp wireless_essid_line(
ATLINESTART "wireless[[:blank:]]+essid[[:blank:]](.+)$", 4);
ExtendedRegexp old_default_line(
"^[[:blank:]]*guessnet[[:blank:]]+"
"default[[:blank:]]*$");
ExtendedRegexp generic_guessnet_line(ATLINESTART);
ExtendedRegexp parm_line(
"^[[:blank:]]*([^[:blank:]]+)[[:blank:]]+(.+)$", 2);
--
Thomas Hood <jdthood@aglu.demon.nl>