diff --git a/src/libgui/DiscoveryDruid.cpp b/src/libgui/DiscoveryDruid.cpp index 6a99b0839..ae878e065 100644 --- a/src/libgui/DiscoveryDruid.cpp +++ b/src/libgui/DiscoveryDruid.cpp @@ -88,6 +88,8 @@ #include "IOSImporter.h" #include "IPTImporter.h" +#include "PIXImporter.h" + using namespace std; using namespace libfwbuilder; @@ -779,6 +781,7 @@ void DiscoveryDruid::startConfigImport() { case 0: platform = "iosacl"; break; case 1: platform = "iptables"; break; + case 2: platform = "pix"; break; } // @@ -2673,6 +2676,7 @@ void ConfigImport::run() *Log << "Discovery method: Import firewall configuration.\n"; std::istringstream instream(*buffer); + imp = NULL; if (platform == "iosacl") imp = new IOSImporter(mw->getCurrentLib(), instream, @@ -2680,6 +2684,9 @@ void ConfigImport::run() if (platform == "iptables") imp = new IPTImporter(mw->getCurrentLib(), instream, Log, fwname); + if (platform == "pix") imp = new PIXImporter(mw->getCurrentLib(), + instream, + Log, fwname); // add other platforms here when available diff --git a/src/libgui/IOSImporter.cpp b/src/libgui/IOSImporter.cpp index d7d020356..276f66628 100644 --- a/src/libgui/IOSImporter.cpp +++ b/src/libgui/IOSImporter.cpp @@ -56,118 +56,118 @@ IOSImporter::IOSImporter(FWObject *lib, Logger *log, const std::string &fwname) : Importer(lib, "iosacl", input, log, fwname) { - ios_icmp_specs["echo-reply"] = std::pair(0, 0); - ios_icmp_specs["unreachable"] = std::pair(3, -1); // all "unreachables" - ios_icmp_specs["net-unreachable"] = std::pair(3, 0); - ios_icmp_specs["host-unreachable"] = std::pair(3, 1); - ios_icmp_specs["protocol-unreachable"] = std::pair(3, 2); - ios_icmp_specs["port-unreachable"] = std::pair(3, 3); - ios_icmp_specs["packet-too-big"] = std::pair(3, 4); - ios_icmp_specs["source-route-failed"] = std::pair(3, 5); - ios_icmp_specs["network-unknown"] = std::pair(3, 6); - ios_icmp_specs["host-unknown"] = std::pair(3, 7); - ios_icmp_specs["host-isolated"] = std::pair(3, 8); - ios_icmp_specs["dod-net-prohibited"] = std::pair(3, 9); - ios_icmp_specs["dod-host-prohibited"] = std::pair(3, 10); - ios_icmp_specs["net-tos-unreachable"] = std::pair(3, 11); - ios_icmp_specs["host-tos-unreachable"] = std::pair(3, 12); - ios_icmp_specs["administratively-prohibited"] = std::pair(3, 13); - ios_icmp_specs["host-precedence-unreachable"] = std::pair(3, 14); - ios_icmp_specs["precedence-unreachable"] = std::pair(3, 15); - ios_icmp_specs["source-quench"] = std::pair(4, 0); - ios_icmp_specs["net-redirect"] = std::pair(5, 0); - ios_icmp_specs["host-redirect"] = std::pair(5, 1); - ios_icmp_specs["net-tos-redirect"] = std::pair(5, 2); - ios_icmp_specs["host-tos-redirect"] = std::pair(5, 3); - ios_icmp_specs["echo"] = std::pair(8, 0); - ios_icmp_specs["router-advertisement"] = std::pair(9, 0); - ios_icmp_specs["router-solicitation"] = std::pair(10, 0); - ios_icmp_specs["ttl-exceeded"] = std::pair(11, 0); - ios_icmp_specs["reassembly-timeout"] = std::pair(11, 1); - ios_icmp_specs["general-parameter-problem"] = std::pair(12, 0); - ios_icmp_specs["option-missing"] = std::pair(12, 1); - ios_icmp_specs["timestamp-request"] = std::pair(13, 0); - ios_icmp_specs["timestamp-reply"] = std::pair(14, 0); - ios_icmp_specs["information-request"] = std::pair(15, 0); - ios_icmp_specs["information-reply"] = std::pair(16, 0); - ios_icmp_specs["mask-request"] = std::pair(17, 0); - ios_icmp_specs["mask-reply"] = std::pair(18, 0); + cisco_icmp_specs["echo-reply"] = std::pair(0, 0); + cisco_icmp_specs["unreachable"] = std::pair(3, -1); // all "unreachables" + cisco_icmp_specs["net-unreachable"] = std::pair(3, 0); + cisco_icmp_specs["host-unreachable"] = std::pair(3, 1); + cisco_icmp_specs["protocol-unreachable"] = std::pair(3, 2); + cisco_icmp_specs["port-unreachable"] = std::pair(3, 3); + cisco_icmp_specs["packet-too-big"] = std::pair(3, 4); + cisco_icmp_specs["source-route-failed"] = std::pair(3, 5); + cisco_icmp_specs["network-unknown"] = std::pair(3, 6); + cisco_icmp_specs["host-unknown"] = std::pair(3, 7); + cisco_icmp_specs["host-isolated"] = std::pair(3, 8); + cisco_icmp_specs["dod-net-prohibited"] = std::pair(3, 9); + cisco_icmp_specs["dod-host-prohibited"] = std::pair(3, 10); + cisco_icmp_specs["net-tos-unreachable"] = std::pair(3, 11); + cisco_icmp_specs["host-tos-unreachable"] = std::pair(3, 12); + cisco_icmp_specs["administratively-prohibited"] = std::pair(3, 13); + cisco_icmp_specs["host-precedence-unreachable"] = std::pair(3, 14); + cisco_icmp_specs["precedence-unreachable"] = std::pair(3, 15); + cisco_icmp_specs["source-quench"] = std::pair(4, 0); + cisco_icmp_specs["net-redirect"] = std::pair(5, 0); + cisco_icmp_specs["host-redirect"] = std::pair(5, 1); + cisco_icmp_specs["net-tos-redirect"] = std::pair(5, 2); + cisco_icmp_specs["host-tos-redirect"] = std::pair(5, 3); + cisco_icmp_specs["echo"] = std::pair(8, 0); + cisco_icmp_specs["router-advertisement"] = std::pair(9, 0); + cisco_icmp_specs["router-solicitation"] = std::pair(10, 0); + cisco_icmp_specs["ttl-exceeded"] = std::pair(11, 0); + cisco_icmp_specs["reassembly-timeout"] = std::pair(11, 1); + cisco_icmp_specs["general-parameter-problem"] = std::pair(12, 0); + cisco_icmp_specs["option-missing"] = std::pair(12, 1); + cisco_icmp_specs["timestamp-request"] = std::pair(13, 0); + cisco_icmp_specs["timestamp-reply"] = std::pair(14, 0); + cisco_icmp_specs["information-request"] = std::pair(15, 0); + cisco_icmp_specs["information-reply"] = std::pair(16, 0); + cisco_icmp_specs["mask-request"] = std::pair(17, 0); + cisco_icmp_specs["mask-reply"] = std::pair(18, 0); - ios_proto_specs["ah"] = 51; - ios_proto_specs["ahp"] = 51; - ios_proto_specs["eigrp"] = 88; - ios_proto_specs["esp"] = 50; - ios_proto_specs["gre"] = 47; - ios_proto_specs["igmp"] = 2; - ios_proto_specs["igrp"] = 9; - ios_proto_specs["ip"] = 0; - ios_proto_specs["ipinip"] = 4; - ios_proto_specs["nos"] = 94; - ios_proto_specs["ospf"] = 89; - ios_proto_specs["pim"] = 103; - ios_proto_specs["pcp"] = 108; - ios_proto_specs["snp"] = 109; + cisco_proto_specs["ah"] = 51; + cisco_proto_specs["ahp"] = 51; + cisco_proto_specs["eigrp"] = 88; + cisco_proto_specs["esp"] = 50; + cisco_proto_specs["gre"] = 47; + cisco_proto_specs["igmp"] = 2; + cisco_proto_specs["igrp"] = 9; + cisco_proto_specs["ip"] = 0; + cisco_proto_specs["ipinip"] = 4; + cisco_proto_specs["nos"] = 94; + cisco_proto_specs["ospf"] = 89; + cisco_proto_specs["pim"] = 103; + cisco_proto_specs["pcp"] = 108; + cisco_proto_specs["snp"] = 109; - ios_tcp_specs["bgp"] = 179; - ios_tcp_specs["chargen"] = 19; - ios_tcp_specs["cmd"] = 514; - ios_tcp_specs["daytime"] = 13; - ios_tcp_specs["discard"] = 9; - ios_tcp_specs["domain"] = 53; - ios_tcp_specs["echo"] = 7; - ios_tcp_specs["exec"] = 512; - ios_tcp_specs["finger"] = 79; - ios_tcp_specs["ftp"] = 21; - ios_tcp_specs["ftp-data"] = 20; - ios_tcp_specs["gopher"] = 70; - ios_tcp_specs["hostname"] = 101; - ios_tcp_specs["ident"] = 113; - ios_tcp_specs["irc"] = 194; - ios_tcp_specs["klogin"] = 543; - ios_tcp_specs["kshell"] = 544; - ios_tcp_specs["login"] = 513; - ios_tcp_specs["lpd"] = 515; - ios_tcp_specs["nntp"] = 119; - ios_tcp_specs["pop2"] = 109; - ios_tcp_specs["pop3"] = 110; - ios_tcp_specs["smtp"] = 25; - ios_tcp_specs["sunrpc"] = 111; - ios_tcp_specs["syslog"] = 514; - ios_tcp_specs["tacacs"] = 49; - ios_tcp_specs["tacacs-ds"] = 63; - ios_tcp_specs["talk"] = 517; - ios_tcp_specs["telnet"] = 23; - ios_tcp_specs["time"] = 37; - ios_tcp_specs["uucp"] = 540; - ios_tcp_specs["whois"] = 43; - ios_tcp_specs["www"] = 80; + cisco_tcp_specs["bgp"] = 179; + cisco_tcp_specs["chargen"] = 19; + cisco_tcp_specs["cmd"] = 514; + cisco_tcp_specs["daytime"] = 13; + cisco_tcp_specs["discard"] = 9; + cisco_tcp_specs["domain"] = 53; + cisco_tcp_specs["echo"] = 7; + cisco_tcp_specs["exec"] = 512; + cisco_tcp_specs["finger"] = 79; + cisco_tcp_specs["ftp"] = 21; + cisco_tcp_specs["ftp-data"] = 20; + cisco_tcp_specs["gopher"] = 70; + cisco_tcp_specs["hostname"] = 101; + cisco_tcp_specs["ident"] = 113; + cisco_tcp_specs["irc"] = 194; + cisco_tcp_specs["klogin"] = 543; + cisco_tcp_specs["kshell"] = 544; + cisco_tcp_specs["login"] = 513; + cisco_tcp_specs["lpd"] = 515; + cisco_tcp_specs["nntp"] = 119; + cisco_tcp_specs["pop2"] = 109; + cisco_tcp_specs["pop3"] = 110; + cisco_tcp_specs["smtp"] = 25; + cisco_tcp_specs["sunrpc"] = 111; + cisco_tcp_specs["syslog"] = 514; + cisco_tcp_specs["tacacs"] = 49; + cisco_tcp_specs["tacacs-ds"] = 63; + cisco_tcp_specs["talk"] = 517; + cisco_tcp_specs["telnet"] = 23; + cisco_tcp_specs["time"] = 37; + cisco_tcp_specs["uucp"] = 540; + cisco_tcp_specs["whois"] = 43; + cisco_tcp_specs["www"] = 80; - ios_udp_specs["biff"] = 512; - ios_udp_specs["bootpc"] = 68; - ios_udp_specs["bootps"] = 67; - ios_udp_specs["discard"] = 9; - ios_udp_specs["dnsix"] = 195; - ios_udp_specs["domain"] = 53; - ios_udp_specs["echo"] = 7; - ios_udp_specs["isakmp"] = 500; - ios_udp_specs["mobile-ip"] = 434; - ios_udp_specs["nameserver"] = 42; - ios_udp_specs["netbios-dgm"] = 138; - ios_udp_specs["netbios-ns"] = 137; - ios_udp_specs["netbios-ss"] = 139; - ios_udp_specs["ntp"] = 123; - ios_udp_specs["pim-auto-rp"] = 496; - ios_udp_specs["rip"] = 520; - ios_udp_specs["snmp"] = 161; - ios_udp_specs["snmptrap"] = 162; - ios_udp_specs["sunrpc"] = 111; - ios_udp_specs["syslog"] = 514; - ios_udp_specs["tacacs"] = 49; - ios_udp_specs["talk"] = 517; - ios_udp_specs["tftp"] = 69; - ios_udp_specs["time"] = 37; - ios_udp_specs["who"] = 513; - ios_udp_specs["xdmcp"] = 177; + cisco_udp_specs["biff"] = 512; + cisco_udp_specs["bootpc"] = 68; + cisco_udp_specs["bootps"] = 67; + cisco_udp_specs["discard"] = 9; + cisco_udp_specs["dnsix"] = 195; + cisco_udp_specs["domain"] = 53; + cisco_udp_specs["echo"] = 7; + cisco_udp_specs["isakmp"] = 500; + cisco_udp_specs["mobile-ip"] = 434; + cisco_udp_specs["nameserver"] = 42; + cisco_udp_specs["netbios-dgm"] = 138; + cisco_udp_specs["netbios-ns"] = 137; + cisco_udp_specs["netbios-ss"] = 139; + cisco_udp_specs["ntp"] = 123; + cisco_udp_specs["pim-auto-rp"] = 496; + cisco_udp_specs["rip"] = 520; + cisco_udp_specs["snmp"] = 161; + cisco_udp_specs["snmptrap"] = 162; + cisco_udp_specs["sunrpc"] = 111; + cisco_udp_specs["syslog"] = 514; + cisco_udp_specs["tacacs"] = 49; + cisco_udp_specs["talk"] = 517; + cisco_udp_specs["tftp"] = 69; + cisco_udp_specs["time"] = 37; + cisco_udp_specs["who"] = 513; + cisco_udp_specs["xdmcp"] = 177; } @@ -216,9 +216,9 @@ FWObject* IOSImporter::createICMPService() { // Cisco is trying to be too helpful, they translate many // icmp type/code combinations into stings - if (ios_icmp_specs.count(icmpspec)!=0) + if (cisco_icmp_specs.count(icmpspec)!=0) { - std::pair pp = ios_icmp_specs[icmpspec]; + std::pair pp = cisco_icmp_specs[icmpspec]; std::ostringstream s1, s2; s1 << pp.first; icmp_type = s1.str(); @@ -239,10 +239,10 @@ FWObject* IOSImporter::createICMPService() FWObject* IOSImporter::createIPService() { - if (ios_proto_specs.count(protocol)!=0) + if (cisco_proto_specs.count(protocol)!=0) { std::ostringstream s; - s << ios_proto_specs[protocol]; + s << cisco_proto_specs[protocol]; protocol = s.str(); } return Importer::createIPService(); @@ -326,11 +326,11 @@ FWObject* IOSImporter::createTCPService() std::string name = "tcp " + src_port_spec + " " + dst_port_spec; std::pair pr = - convertPortSpec(src_port_op, src_port_spec, ios_tcp_specs); + convertPortSpec(src_port_op, src_port_spec, cisco_tcp_specs); int srs = pr.first; int sre = pr.second; - pr = convertPortSpec(dst_port_op, dst_port_spec, ios_tcp_specs); + pr = convertPortSpec(dst_port_op, dst_port_spec, cisco_tcp_specs); int drs = pr.first; int dre = pr.second; @@ -350,11 +350,11 @@ FWObject* IOSImporter::createUDPService() std::string name = "udp " + src_port_spec + " " + dst_port_spec; std::pair pr = - convertPortSpec(src_port_op, src_port_spec, ios_udp_specs); + convertPortSpec(src_port_op, src_port_spec, cisco_udp_specs); int srs = pr.first; int sre = pr.second; - pr = convertPortSpec(dst_port_op, dst_port_spec, ios_udp_specs); + pr = convertPortSpec(dst_port_op, dst_port_spec, cisco_udp_specs); int drs = pr.first; int dre = pr.second; @@ -397,7 +397,6 @@ Firewall* IOSImporter::finalize() fw->setStr("host_OS", "ios"); Resources::setDefaultTargetOptions("ios" , fw); fw->setStr("version", ""); // default version "any" - Management *mgmt = fw->getManagementObject(); // creates management obj FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME); assert( policy!=NULL ); diff --git a/src/libgui/IOSImporter.h b/src/libgui/IOSImporter.h index 0b6b8b06d..faf71f59b 100644 --- a/src/libgui/IOSImporter.h +++ b/src/libgui/IOSImporter.h @@ -41,10 +41,10 @@ class IOSImporter : public Importer { - std::map > ios_icmp_specs; - std::map ios_proto_specs; - std::map ios_tcp_specs; - std::map ios_udp_specs; + std::map > cisco_icmp_specs; + std::map cisco_proto_specs; + std::map cisco_tcp_specs; + std::map cisco_udp_specs; virtual libfwbuilder::FWObject* createAddress(const std::string &a, const std::string &nm); diff --git a/src/libgui/IPTImporter.cpp b/src/libgui/IPTImporter.cpp index 0783cdea3..d6415b6f4 100644 --- a/src/libgui/IPTImporter.cpp +++ b/src/libgui/IPTImporter.cpp @@ -1283,7 +1283,6 @@ Firewall* IPTImporter::finalize() fw->setStr("host_OS", "linux24"); Resources::setDefaultTargetOptions("linux24" , fw); fw->setStr("version", ""); // default version "any" - Management *mgmt = fw->getManagementObject(); // creates management obj FWOptions *fwopt = fw->getOptionsObject(); assert(fwopt!=NULL); diff --git a/src/libgui/Importer.cpp b/src/libgui/Importer.cpp index 30211079c..6e9fadc4e 100644 --- a/src/libgui/Importer.cpp +++ b/src/libgui/Importer.cpp @@ -247,7 +247,13 @@ Firewall* Importer::getFirewallObject() void Importer::setHostName(const std::string &hn) { getFirewallObject()->setName(hn); - *logger << "Host name: " << hn << "\n"; + *logger << "Host name: " + hn + "\n"; +} + +void Importer::setDiscoveredVersion(const std::string &v) +{ + discovered_version = v; + *logger << "Version: " + v + "\n"; } void Importer::newInterface(const std::string &name) @@ -257,8 +263,7 @@ void Importer::newInterface(const std::string &name) current_interface = Interface::cast(nobj); current_interface->setUnnumbered(true); all_interfaces[name] = current_interface; - - *logger << "Interface: " << name << "\n"; + *logger << "Interface: " + name + "\n"; } void Importer::addInterfaceAddress(const std::string &a, @@ -275,7 +280,7 @@ void Importer::addInterfaceAddress(const std::string &a, IPv4::cast(nobj)->setAddress( InetAddr(a) ); IPv4::cast(nobj)->setNetmask( InetAddr(nm) ); - *logger << "Interface address: " << a << "/" << nm << "\n"; + *logger << "Interface address: " + a + "/" + nm + "\n"; } } @@ -289,14 +294,23 @@ void Importer::addInterfaceComment(const std::string &descr) if (current_interface!=NULL) { current_interface->setComment(descr); - *logger << "Interface comment: " << descr << "\n"; + *logger << "Interface comment: " + descr + "\n"; + } +} + +void Importer::addInterfaceLabel(const std::string &descr) +{ + if (current_interface!=NULL) + { + current_interface->setLabel(descr); + *logger << "Interface label: " + descr + "\n"; } } void Importer::addRuleComment(const std::string &comm) { rule_comment += comm; - *logger << "Rule comment: " << comm << "\n"; + *logger << "Rule comment: " + comm + "\n"; } UnidirectionalRuleSet* Importer::checkUnidirRuleSet( @@ -359,17 +373,19 @@ void Importer::setInterfaceAndDirectionForRuleSet(const std::string &ruleset_nam if (rs->intf_dir[intf] != "both" && rs->intf_dir[intf] != _dir) rs->intf_dir[intf] = "both"; } - *logger << "Interface " << _intf_name - << " ruleset " << ruleset_name - << " direction '" << _dir << "' " - << "(set to '" << rs->intf_dir[intf] << "')" - << "\n"; + ostringstream str; + str << "Interface " << _intf_name + << " ruleset " << ruleset_name + << " direction '" << _dir << "' " + << "(set to '" << rs->intf_dir[intf] << "')" + << "\n"; + *logger << str.str(); } void Importer::newUnidirRuleSet(const std::string &ruleset_name) { current_ruleset = getUnidirRuleSet(ruleset_name); // creates if new - *logger << "Ruleset: " << ruleset_name << "\n"; + *logger << "Ruleset: " + ruleset_name + "\n"; } /* @@ -386,7 +402,7 @@ void Importer::setDefaultAction(const std::string &iptables_action_name) default_action_str = "Accept"; } else current_ruleset->default_action = PolicyRule::Deny; - *logger << "Default action: " << default_action_str << "\n"; + *logger << "Default action: " + default_action_str + "\n"; } @@ -564,13 +580,14 @@ FWObject* Importer::getCustomService(const std::string &platform, s->setCodeForPlatform(platform, code); s->setComment(cstr.str()); all_objects[sstr.str()] = s; - - *logger << "Custom Service object: " << nstr.str() - << ": " - << platform - << ": " - << code - << "\n"; + ostringstream str; + str << "Custom Service object: " << nstr.str() + << ": " + << platform + << ": " + << code + << "\n"; + *logger << str.str(); return s; } @@ -599,7 +616,7 @@ FWObject* Importer::getIPService(int proto) s->setComment(cstr.str()); all_objects[sstr.str()] = s; - *logger << "IP Service object: " << nstr.str() << "\n"; + *logger << "IP Service object: " + nstr.str() + "\n"; return s; } @@ -622,7 +639,7 @@ FWObject* Importer::getICMPService(int type, int code) s->setInt("code", code); s->setComment(cstr.str()); all_objects[sstr.str()] = s; - *logger << "ICMP Service object: " << nstr.str() << "\n"; + *logger << "ICMP Service object: " + nstr.str() + "\n"; return s; } @@ -719,7 +736,7 @@ FWObject* Importer::getTCPService(int srs, int sre, s->setEstablished(established); s->setComment(cstr.str()); all_objects[sstr.str()] = s; - *logger << "TCP Service object: " << nstr.str() << "\n"; + *logger << "TCP Service object: " + nstr.str() + "\n"; return s; } @@ -747,7 +764,7 @@ FWObject* Importer::getUDPService(int srs, int sre, int drs, int dre) s->setComment(cstr.str()); all_objects[sstr.str()] = s; - *logger << "UDP Service object: " << nstr.str() << "\n"; + *logger << "UDP Service object: " + nstr.str() + "\n"; return s; } @@ -769,7 +786,7 @@ FWObject* Importer::getTagService(const std::string &tagcode) s->setCode(tagcode); s->setComment(cstr.str()); all_objects[sstr.str()] = s; - *logger << "Tag Service object: " << nstr.str() << "\n"; + *logger << "Tag Service object: " + nstr.str() + "\n"; return s; } @@ -924,7 +941,7 @@ FWObject* Importer::createAddress(const std::string &addr, " " + addr + "/" + netmask; a->setComment(comment); all_objects[sig] = a; - *logger << "Address object: " << name << "\n"; + *logger << "Address object: " + name + "\n"; return a; } catch(FWException &ex) { @@ -939,7 +956,7 @@ FWObject* Importer::createAddress(const std::string &addr, " " + addr; da->setComment(comment); all_objects[sig] = da; - *logger << "DNSName object: " << name << "\n"; + *logger << "DNSName object: " + name + "\n"; return da; } @@ -993,7 +1010,7 @@ FWObject* Importer::createAddress(const std::string &addr, net->setComment(comment); all_objects[sig] = net; - *logger << "Network object: " << name << "\n"; + *logger << "Network object: " + name + "\n"; return net; } return NULL; @@ -1031,7 +1048,7 @@ FWObject* Importer::createAddressRange(const std::string &addr1, ar->setComment(comment); all_objects[sig] = ar; - *logger << "AddressRange object: " << name << "\n"; + *logger << "AddressRange object: " + name + "\n"; return ar; } @@ -1051,7 +1068,7 @@ void Importer::markCurrentRuleBad(const std::string &comment) //current_rule->setComment(comment); *logger << QObject::tr("Parser error:\n").toUtf8().constData() - << comment << "\n"; + + comment + "\n"; error_counter++; } diff --git a/src/libgui/Importer.h b/src/libgui/Importer.h index 4f0bf3947..9a09fa4ff 100644 --- a/src/libgui/Importer.h +++ b/src/libgui/Importer.h @@ -52,7 +52,8 @@ class Importer; */ -class UnidirectionalRuleSet { +class UnidirectionalRuleSet +{ public: libfwbuilder::RuleSet* ruleset; @@ -73,7 +74,8 @@ public: std::string toString() { return err; } }; -class Importer { +class Importer +{ // firewall object // one instance of Importer creates only one firewall object. @@ -96,6 +98,8 @@ protected: std::string platform; + std::string discovered_version; + libfwbuilder::Interface* current_interface; // map : ruleset name : ruleset @@ -261,14 +265,18 @@ public: virtual void run(); + void setPlatform(const std::string &pl) { platform = pl; } + int errorCounter() { return error_counter; } + virtual void setDiscoveredVersion(const std::string &v); virtual void setHostName(const std::string &hn); virtual void newInterface(const std::string &interface_name); virtual void clearCurrentInterface() { current_interface = NULL; } virtual void addInterfaceAddress(const std::string &a, const std::string &nm); virtual void addInterfaceComment(const std::string &descr); + virtual void addInterfaceLabel(const std::string &descr); virtual void addRuleComment(const std::string &comm); /** diff --git a/src/libgui/PIXImporter.cpp b/src/libgui/PIXImporter.cpp new file mode 100644 index 000000000..f7d998c35 --- /dev/null +++ b/src/libgui/PIXImporter.cpp @@ -0,0 +1,228 @@ +/* + + Firewall Builder + + Copyright (C) 2007 NetCitadel, LLC + + Author: Vadim Kurland vadim@fwbuilder.org + + $Id$ + + This program is free software which we release under the GNU General Public + License. You may redistribute and/or modify this program under the terms + of that license as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + To get a copy of the GNU General Public License, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "../../config.h" +#include "global.h" +#include "utils_no_qt.h" +#include "platforms.h" + + +#include "PIXImporter.h" + +#include +#include +#include + +#include "fwbuilder/Resources.h" +#include "fwbuilder/Network.h" +#include "fwbuilder/Address.h" +#include "fwbuilder/InetAddr.h" +#include "fwbuilder/IPService.h" +#include "fwbuilder/ICMPService.h" +#include "fwbuilder/TCPService.h" +#include "fwbuilder/UDPService.h" +#include "fwbuilder/Policy.h" +#include "fwbuilder/RuleElement.h" + +#include + +using namespace std; +using namespace libfwbuilder; + + +PIXImporter::PIXImporter(FWObject *lib, + std::istringstream &input, + Logger *log, + const std::string &fwname) : + IOSImporter(lib, input, log, fwname) +{ + setPlatform("pix"); +} + + + +PIXImporter::~PIXImporter() +{ +} + +Firewall* PIXImporter::finalize() +{ + // scan all UnidirectionalRuleSet objects, set interface and + // direction in all rules of corresponding RuleSet and merge all + // UnidirectionalRuleSet into one RuleSet object. Attach this + // object to the firewall. + + if (fwbdebug) qDebug("PIXImporter::finalize()"); + + if (haveFirewallObject()) + { + Firewall *fw = Firewall::cast(getFirewallObject()); + fw->setStr("host_OS", "pix"); + Resources::setDefaultTargetOptions("pix" , fw); + fw->setStr("version", discovered_version); + + FWObject *policy = getFirewallObject()->getFirstByType(Policy::TYPENAME); + assert( policy!=NULL ); + + if (all_rulesets.size()!=0) + { + if (fwbdebug) + { + qDebug() << "Setting interface and direction for all rules"; + qDebug() << "all_rulesets.size()=" << all_rulesets.size(); + } + + std::map::iterator i; + for (i=all_rulesets.begin(); i!=all_rulesets.end(); ++i) + { + UnidirectionalRuleSet *irs = (*i).second; + + if (fwbdebug) + { + qDebug() << " irs->name=" << irs->name.c_str(); + qDebug() << " irs->intf_dir.size()=" << irs->intf_dir.size(); + qDebug() << " irs->ruleset->size()=" << irs->ruleset->size(); + } + + // optimization: If we have several interfaces for + // the ruleset, create a group + // But first group interfaces by direction so + // that later we can merge rules into the policy + // with proper combination of interface group and + // direction. Remember that the same access list + // can be used with multiple interfaces with different + // directions each time. The same list can be applied + // to the same interface both in and out (although in + // this case we have already switched direction to "both") + // + if (irs->intf_dir.size()>1) + { + std::list all_in; + std::list all_out; + std::list all_both; + + std::map::iterator i; + for (i = irs->intf_dir.begin(); + i != irs->intf_dir.end(); ++i) + { + if ( (*i).second=="in") + all_in.push_back( (*i).first ); + if ( (*i).second=="out") + all_out.push_back( (*i).first ); + if ( (*i).second=="both") + all_both.push_back( (*i).first ); + } + + FWObject *og; + if (all_in.size()>0) + { + og = createGroupOfInterfaces(irs->name, all_in); + std::for_each(irs->ruleset->begin(), + irs->ruleset->end(), + merge_rule(irs->name, + og, + PolicyRule::Inbound, + policy) + ); + } + + if (all_out.size()>0) + { + og = createGroupOfInterfaces(irs->name, all_out); + std::for_each(irs->ruleset->begin(), + irs->ruleset->end(), + merge_rule(irs->name, + og, + PolicyRule::Outbound, + policy) + ); + } + + if (all_both.size()>0) + { + og = createGroupOfInterfaces(irs->name, all_both); + std::for_each(irs->ruleset->begin(), + irs->ruleset->end(), + merge_rule(irs->name, + og, + PolicyRule::Both, + policy) + ); + } + + } + else + { + std::map::iterator j; + for (j=irs->intf_dir.begin(); j!=irs->intf_dir.end(); ++j) + { + Interface *intf = all_interfaces[ (*j).first ]; + std::string _dir = (*j).second; + PolicyRule::Direction direction = PolicyRule::Both; + if (_dir=="in") direction = PolicyRule::Inbound; + if (_dir=="out") direction = PolicyRule::Outbound; + + // not all access lists are associated with interfaces + if (intf!=NULL) + { + if (fwbdebug) + qDebug() << " interface=" + << intf->getName().c_str(); + + std::for_each( + irs->ruleset->begin(), + irs->ruleset->end(), + merge_rule(irs->name, + intf, + direction, + policy) + ); + } + } + } + qDebug("ruleset done"); + + // call clearChidren() not recursive because children objects + // of all rules should not be deleted + irs->ruleset->clearChildren(false); + getFirewallObject()->remove(irs->ruleset, false); + delete irs->ruleset; + } + } + + list l2 = fw->getByType(Policy::TYPENAME); + for (list::iterator i=l2.begin(); i!=l2.end(); ++i) + { + RuleSet *rs = RuleSet::cast(*i); + rs->renumberRules(); + } + + return getFirewallObject(); + } + else + { + return NULL; + } +} diff --git a/src/libgui/PIXImporter.h b/src/libgui/PIXImporter.h new file mode 100644 index 000000000..fdd108aed --- /dev/null +++ b/src/libgui/PIXImporter.h @@ -0,0 +1,57 @@ +/* + + Firewall Builder + + Copyright (C) 2011 NetCitadel, LLC + + Author: Vadim Kurland vadim@fwbuilder.org + + This program is free software which we release under the GNU General Public + License. You may redistribute and/or modify this program under the terms + of that license as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + To get a copy of the GNU General Public License, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + + +#ifndef _FWB_POLICY_IMPORTER_PIX_H_ +#define _FWB_POLICY_IMPORTER_PIX_H_ + +#include +#include +#include +#include +#include + +#include "IOSImporter.h" + +#include "fwbuilder/libfwbuilder-config.h" +#include "fwbuilder/Logger.h" + +class PIXImporter : public IOSImporter +{ + + public: + + PIXImporter(libfwbuilder::FWObject *lib, + std::istringstream &input, + libfwbuilder::Logger *log, + const std::string &fwname); + ~PIXImporter(); + + virtual void run(); + + // this method actually adds interfaces to the firewall object + // and does final clean up. + virtual libfwbuilder::Firewall* finalize(); +}; + +#endif diff --git a/src/libgui/PIXImporterRun.cpp b/src/libgui/PIXImporterRun.cpp new file mode 100644 index 000000000..7437b29b4 --- /dev/null +++ b/src/libgui/PIXImporterRun.cpp @@ -0,0 +1,95 @@ +/* + + Firewall Builder + + Copyright (C) 2007 NetCitadel, LLC + + Author: Vadim Kurland vadim@fwbuilder.org + + $Id$ + + This program is free software which we release under the GNU General Public + License. You may redistribute and/or modify this program under the terms + of that license as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + To get a copy of the GNU General Public License, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +#include "../../config.h" +#include "global.h" + +#include "PIXImporter.h" + +#include +#include + +#include +#include +#include + +#include + +#include "../parsers/PIXCfgLexer.hpp" +#include "../parsers/PIXCfgParser.hpp" + +/* + * Only this module depends on PIXCfgLexer and PIXCfgParser, + * so only this file is recompiled when we change grammar + */ + +void PIXImporter::run() +{ +// it is probably safer to create an empty firewall if we do not have +// ANTLR on the system rather than try to #ifdef out chunks of code +// here and there in this module +// +// Obviously we should disable GUI elements that activate this importer +// if ANTLR runtime is not available. +// + + QStringList err; + QString parser_err = QObject::tr("Parser error:\n"); + std::ostringstream parser_debug; + + PIXCfgLexer lexer(input); + PIXCfgParser parser(lexer); + parser.importer = this; + if (fwbdebug) parser.dbg = &std::cerr; + else parser.dbg = &parser_debug; + + try + { + parser.cfgfile(); + } catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e) + { + err << parser_err; + err << e.toString().c_str(); + } catch(std::exception& e) + { + err << parser_err; + err << e.what(); + } + + if (haveFirewallObject()) + { + if (countInterfaces()==0) err << noInterfacesErrorMessage(); + if (countRules()==0) err << noRulesErrorMessage(); + } else + { + err << parser_err; + err << noFirewallErrorMessage(); + err << commonFailureErrorMessage(); + } + + if (!err.isEmpty()) + throw ImporterException(err.join("\n").toUtf8().constData()); +} + diff --git a/src/libgui/discoverydruid_q.ui b/src/libgui/discoverydruid_q.ui index e19700996..12eea349b 100644 --- a/src/libgui/discoverydruid_q.ui +++ b/src/libgui/discoverydruid_q.ui @@ -48,7 +48,7 @@ - 6 + 2 @@ -415,6 +415,11 @@ iptables + + + pix + + diff --git a/src/libgui/libgui.pro b/src/libgui/libgui.pro index 7ee3a43ce..99de29141 100644 --- a/src/libgui/libgui.pro +++ b/src/libgui/libgui.pro @@ -33,6 +33,7 @@ HEADERS += ../../config.h \ Importer.h \ IOSImporter.h \ IPTImporter.h \ + PIXImporter.h \ SSHSession.h \ SSHUnx.h \ SSHCisco.h \ @@ -213,6 +214,8 @@ SOURCES += ProjectPanel.cpp \ IOSImporterRun.cpp \ IPTImporter.cpp \ IPTImporterRun.cpp \ + PIXImporter.cpp \ + PIXImporterRun.cpp \ SSHSession.cpp \ SSHUnx.cpp \ SSHCisco.cpp \ diff --git a/src/parsers/PIXCfgLexer.cpp b/src/parsers/PIXCfgLexer.cpp new file mode 100644 index 000000000..ca08739ce --- /dev/null +++ b/src/parsers/PIXCfgLexer.cpp @@ -0,0 +1,1603 @@ +/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgLexer.cpp"$ */ +#line 40 "pix.g" + + // gets inserted before the antlr generated includes in the cpp + // file + +#line 8 "PIXCfgLexer.cpp" +#include "PIXCfgLexer.hpp" +#include +#include +#include +#include +#include +#include +#include + +#line 46 "pix.g" + + // gets inserted after the antlr generated includes in the cpp + // file +#include +#include + +#include "../libgui/PIXImporter.h" + +#line 27 "PIXCfgLexer.cpp" +#line 1 "pix.g" +#line 29 "PIXCfgLexer.cpp" +PIXCfgLexer::PIXCfgLexer(ANTLR_USE_NAMESPACE(std)istream& in) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),true) +{ + initLiterals(); +} + +PIXCfgLexer::PIXCfgLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(ib,true) +{ + initLiterals(); +} + +PIXCfgLexer::PIXCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state) + : ANTLR_USE_NAMESPACE(antlr)CharScanner(state,true) +{ + initLiterals(); +} + +void PIXCfgLexer::initLiterals() +{ + literals["host"] = 28; + literals["log"] = 31; + literals["access-list"] = 16; + literals["interface"] = 37; + literals["remark"] = 40; + literals["certificate"] = 9; + literals["exit"] = 48; + literals["udp"] = 22; + literals["tcp"] = 21; + literals["controller"] = 36; + literals["eq"] = 23; + literals["ip"] = 5; + literals["access-group"] = 47; + literals["time-range"] = 35; + literals["community-list"] = 7; + literals["icmp"] = 20; + literals["description"] = 39; + literals["Version"] = 12; + literals["nameif"] = 38; + literals["secondary"] = 43; + literals["access"] = 45; + literals["lt"] = 25; + literals["range"] = 27; + literals["switchport"] = 44; + literals["log-input"] = 32; + literals["standard"] = 52; + literals["gt"] = 24; + literals["permit"] = 18; + literals["extended"] = 51; + literals["address"] = 42; + literals["established"] = 33; + literals["neq"] = 26; + literals["quit"] = 6; + literals["vlan"] = 46; + literals["any"] = 30; + literals["deny"] = 19; + literals["shutdown"] = 41; + literals["hostname"] = 14; + literals["PIX"] = 10; + literals["ASA"] = 11; + literals["fragments"] = 34; +} + +ANTLR_USE_NAMESPACE(antlr)RefToken PIXCfgLexer::nextToken() +{ + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + for (;;) { + ANTLR_USE_NAMESPACE(antlr)RefToken theRetToken; + int _ttype = ANTLR_USE_NAMESPACE(antlr)Token::INVALID_TYPE; + resetText(); + try { // for lexical and char stream error handling + switch ( LA(1)) { + case 0x21 /* '!' */ : + { + mLINE_COMMENT(true); + theRetToken=_returnToken; + break; + } + case 0xa /* '\n' */ : + case 0xd /* '\r' */ : + { + mNEWLINE(true); + theRetToken=_returnToken; + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + mNUMBER(true); + theRetToken=_returnToken; + break; + } + case 0x2e /* '.' */ : + { + mDOT(true); + theRetToken=_returnToken; + break; + } + case 0x24 /* '$' */ : + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + mWORD(true); + theRetToken=_returnToken; + break; + } + case 0x22 /* '\"' */ : + { + mSTRING(true); + theRetToken=_returnToken; + break; + } + case 0x7c /* '|' */ : + { + mPIPE_CHAR(true); + theRetToken=_returnToken; + break; + } + case 0x23 /* '#' */ : + { + mNUMBER_SIGN(true); + theRetToken=_returnToken; + break; + } + case 0x25 /* '%' */ : + { + mPERCENT(true); + theRetToken=_returnToken; + break; + } + case 0x26 /* '&' */ : + { + mAMPERSAND(true); + theRetToken=_returnToken; + break; + } + case 0x27 /* '\'' */ : + { + mAPOSTROPHE(true); + theRetToken=_returnToken; + break; + } + case 0x28 /* '(' */ : + { + mOPENING_PAREN(true); + theRetToken=_returnToken; + break; + } + case 0x29 /* ')' */ : + { + mCLOSING_PAREN(true); + theRetToken=_returnToken; + break; + } + case 0x2a /* '*' */ : + { + mSTAR(true); + theRetToken=_returnToken; + break; + } + case 0x2b /* '+' */ : + { + mPLUS(true); + theRetToken=_returnToken; + break; + } + case 0x2c /* ',' */ : + { + mCOMMA(true); + theRetToken=_returnToken; + break; + } + case 0x2d /* '-' */ : + { + mMINUS(true); + theRetToken=_returnToken; + break; + } + case 0x2f /* '/' */ : + { + mSLASH(true); + theRetToken=_returnToken; + break; + } + case 0x3b /* ';' */ : + { + mSEMICOLON(true); + theRetToken=_returnToken; + break; + } + case 0x3c /* '<' */ : + { + mLESS_THAN(true); + theRetToken=_returnToken; + break; + } + case 0x3d /* '=' */ : + { + mEQUALS(true); + theRetToken=_returnToken; + break; + } + case 0x3e /* '>' */ : + { + mGREATER_THAN(true); + theRetToken=_returnToken; + break; + } + case 0x3f /* '?' */ : + { + mQUESTION(true); + theRetToken=_returnToken; + break; + } + case 0x40 /* '@' */ : + { + mCOMMERCIAL_AT(true); + theRetToken=_returnToken; + break; + } + case 0x5b /* '[' */ : + { + mOPENING_SQUARE(true); + theRetToken=_returnToken; + break; + } + case 0x5d /* ']' */ : + { + mCLOSING_SQUARE(true); + theRetToken=_returnToken; + break; + } + case 0x5e /* '^' */ : + { + mCARET(true); + theRetToken=_returnToken; + break; + } + case 0x5f /* '_' */ : + { + mUNDERLINE(true); + theRetToken=_returnToken; + break; + } + case 0x7b /* '{' */ : + { + mOPENING_BRACE(true); + theRetToken=_returnToken; + break; + } + case 0x7d /* '}' */ : + { + mCLOSING_BRACE(true); + theRetToken=_returnToken; + break; + } + case 0x7e /* '~' */ : + { + mTILDE(true); + theRetToken=_returnToken; + break; + } + default: + if ((LA(1) == 0x3a /* ':' */ ) && ((LA(2) >= 0x3 /* '\3' */ && LA(2) <= 0xff))) { + mCOLON_COMMENT(true); + theRetToken=_returnToken; + } + else if ((LA(1) == 0x3a /* ':' */ ) && (true)) { + mCOLON(true); + theRetToken=_returnToken; + } + else if ((_tokenSet_0.member(LA(1)))) { + mWhitespace(true); + theRetToken=_returnToken; + } + else { + if (LA(1)==EOF_CHAR) + { + uponEOF(); + _returnToken = makeToken(ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE); + } + else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + } + if ( !_returnToken ) + goto tryAgain; // found SKIP token + + _ttype = _returnToken->getType(); + _ttype = testLiteralsTable(_ttype); + _returnToken->setType(_ttype); + return _returnToken; + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& e) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamRecognitionException(e); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamIOException& csie) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamIOException(csie.io); + } + catch (ANTLR_USE_NAMESPACE(antlr)CharStreamException& cse) { + throw ANTLR_USE_NAMESPACE(antlr)TokenStreamException(cse.getMessage()); + } +tryAgain:; + } +} + +void PIXCfgLexer::mLINE_COMMENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LINE_COMMENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match("!"); + { // ( ... )* + for (;;) { + if ((_tokenSet_1.member(LA(1)))) { + { + match(_tokenSet_1); + } + } + else { + goto _loop78; + } + + } + _loop78:; + } // ( ... )* + mNEWLINE(false); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mNEWLINE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NEWLINE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + if ((LA(1) == 0xd /* '\r' */ ) && (LA(2) == 0xa /* '\n' */ )) { + match("\r\n"); + } + else if ((LA(1) == 0xd /* '\r' */ ) && (true)) { + match('\r' /* charlit */ ); + } + else if ((LA(1) == 0xa /* '\n' */ )) { + match('\n' /* charlit */ ); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + + } + if ( inputState->guessing==0 ) { +#line 655 "pix.g" + newline(); +#line 445 "PIXCfgLexer.cpp" + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCOLON_COMMENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COLON_COMMENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + mCOLON(false); + { // ( ... )* + for (;;) { + if ((_tokenSet_1.member(LA(1)))) { + { + match(_tokenSet_1); + } + } + else { + goto _loop82; + } + + } + _loop82:; + } // ( ... )* + mNEWLINE(false); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCOLON(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COLON; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(':' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mWhitespace(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = Whitespace; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x3 /* '\3' */ : + case 0x4 /* '\4' */ : + case 0x5 /* '\5' */ : + case 0x6 /* '\6' */ : + case 0x7 /* '\7' */ : + case 0x8 /* '\10' */ : + { + matchRange('\3','\10'); + break; + } + case 0x9 /* '\t' */ : + { + match('\t' /* charlit */ ); + break; + } + case 0xb /* '\13' */ : + { + match('\13' /* charlit */ ); + break; + } + case 0xc /* '\14' */ : + { + match('\14' /* charlit */ ); + break; + } + case 0xe /* '\16' */ : + case 0xf /* '\17' */ : + case 0x10 /* '\20' */ : + case 0x11 /* '\21' */ : + case 0x12 /* '\22' */ : + case 0x13 /* '\23' */ : + case 0x14 /* '\24' */ : + case 0x15 /* '\25' */ : + case 0x16 /* '\26' */ : + case 0x17 /* '\27' */ : + case 0x18 /* '\30' */ : + case 0x19 /* '\31' */ : + case 0x1a /* '\32' */ : + case 0x1b /* '\33' */ : + case 0x1c /* '\34' */ : + case 0x1d /* '\35' */ : + case 0x1e /* '\36' */ : + case 0x1f /* '\37' */ : + { + matchRange('\16','\37'); + break; + } + case 0x20 /* ' ' */ : + { + match(' ' /* charlit */ ); + break; + } + default: + if (((LA(1) >= 0x7f && LA(1) <= 0xff))) { + matchRange('\177',static_cast('\377')); + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if ( inputState->guessing==0 ) { +#line 650 "pix.g" + _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; +#line 569 "PIXCfgLexer.cpp" + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mINT_CONST(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = INT_CONST; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mHEX_CONST(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = HEX_CONST; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mNEG_INT_CONST(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NEG_INT_CONST; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mDIGIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DIGIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + matchRange('0','9'); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mHEXDIGIT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = HEXDIGIT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + switch ( LA(1)) { + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + { + matchRange('A','F'); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mNUMBER(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NUMBER; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + bool synPredMatched101 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (_tokenSet_2.member(LA(4))) && (_tokenSet_2.member(LA(5))) && (_tokenSet_2.member(LA(6))) && (_tokenSet_2.member(LA(7))) && (true) && (true) && (true))) { + int _m101 = mark(); + synPredMatched101 = true; + inputState->guessing++; + try { + { + { // ( ... )+ + int _cnt96=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt96>=1 ) { goto _loop96; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt96++; + } + _loop96:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt98=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt98>=1 ) { goto _loop98; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt98++; + } + _loop98:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt100=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt100>=1 ) { goto _loop100; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt100++; + } + _loop100:; + } // ( ... )+ + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched101 = false; + } + rewind(_m101); + inputState->guessing--; + } + if ( synPredMatched101 ) { + { + { // ( ... )+ + int _cnt104=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt104>=1 ) { goto _loop104; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt104++; + } + _loop104:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt106=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt106>=1 ) { goto _loop106; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt106++; + } + _loop106:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt108=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt108>=1 ) { goto _loop108; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt108++; + } + _loop108:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt110=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt110>=1 ) { goto _loop110; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt110++; + } + _loop110:; + } // ( ... )+ + } + if ( inputState->guessing==0 ) { +#line 675 "pix.g" + _ttype = IPV4; +#line 805 "PIXCfgLexer.cpp" + } + } + else { + bool synPredMatched116 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (true) && (true) && (true) && (true) && (true) && (true) && (true))) { + int _m116 = mark(); + synPredMatched116 = true; + inputState->guessing++; + try { + { + { // ( ... )+ + int _cnt113=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt113>=1 ) { goto _loop113; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt113++; + } + _loop113:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt115=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt115>=1 ) { goto _loop115; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt115++; + } + _loop115:; + } // ( ... )+ + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched116 = false; + } + rewind(_m116); + inputState->guessing--; + } + if ( synPredMatched116 ) { + { + { // ( ... )+ + int _cnt119=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt119>=1 ) { goto _loop119; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt119++; + } + _loop119:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt121=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt121>=1 ) { goto _loop121; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt121++; + } + _loop121:; + } // ( ... )+ + } + } + else if ((LA(1) == 0x30 /* '0' */ ) && (LA(2) == 0x78 /* 'x' */ )) { + { + match('0' /* charlit */ ); + match('x' /* charlit */ ); + { // ( ... )+ + int _cnt126=0; + for (;;) { + if ((_tokenSet_3.member(LA(1)))) { + mHEXDIGIT(false); + } + else { + if ( _cnt126>=1 ) { goto _loop126; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt126++; + } + _loop126:; + } // ( ... )+ + } + if ( inputState->guessing==0 ) { +#line 681 "pix.g" + _ttype = HEX_CONST; +#line 908 "PIXCfgLexer.cpp" + } + } + else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) { + { // ( ... )+ + int _cnt123=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt123>=1 ) { goto _loop123; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt123++; + } + _loop123:; + } // ( ... )+ + if ( inputState->guessing==0 ) { +#line 679 "pix.g" + _ttype = INT_CONST; +#line 929 "PIXCfgLexer.cpp" + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mDOT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = DOT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('.' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mWORD(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = WORD; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x24 /* '$' */ : + { + match('$' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case 0x21 /* '!' */ : + case 0x22 /* '\"' */ : + case 0x23 /* '#' */ : + case 0x24 /* '$' */ : + case 0x25 /* '%' */ : + case 0x26 /* '&' */ : + case 0x27 /* '\'' */ : + case 0x28 /* '(' */ : + case 0x29 /* ')' */ : + case 0x2a /* '*' */ : + case 0x2b /* '+' */ : + case 0x2c /* ',' */ : + case 0x2d /* '-' */ : + case 0x2e /* '.' */ : + case 0x2f /* '/' */ : + { + matchRange('!','/'); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x3a /* ':' */ : + { + match(':' /* charlit */ ); + break; + } + case 0x3b /* ';' */ : + { + match(';' /* charlit */ ); + break; + } + case 0x3c /* '<' */ : + { + match('<' /* charlit */ ); + break; + } + case 0x3d /* '=' */ : + { + match('=' /* charlit */ ); + break; + } + case 0x3e /* '>' */ : + { + match('>' /* charlit */ ); + break; + } + case 0x3f /* '?' */ : + { + match('?' /* charlit */ ); + break; + } + case 0x40 /* '@' */ : + { + match('@' /* charlit */ ); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x5c /* '\\' */ : + { + match('\\' /* charlit */ ); + break; + } + case 0x5e /* '^' */ : + { + match('^' /* charlit */ ); + break; + } + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x60 /* '`' */ : + { + match('`' /* charlit */ ); + break; + } + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + default: + { + goto _loop130; + } + } + } + _loop130:; + } // ( ... )* + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mSTRING(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STRING; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('\"' /* charlit */ ); + { // ( ... )* + for (;;) { + if ((_tokenSet_4.member(LA(1)))) { + matchNot('\"' /* charlit */ ); + } + else { + goto _loop133; + } + + } + _loop133:; + } // ( ... )* + match('\"' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mPIPE_CHAR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PIPE_CHAR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('|' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mNUMBER_SIGN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = NUMBER_SIGN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('#' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mPERCENT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PERCENT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('%' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mAMPERSAND(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = AMPERSAND; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('&' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mAPOSTROPHE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = APOSTROPHE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('\'' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mOPENING_PAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = OPENING_PAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('(' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCLOSING_PAREN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CLOSING_PAREN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(')' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mSTAR(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = STAR; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('*' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mPLUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = PLUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('+' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCOMMA(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMA; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(',' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mMINUS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = MINUS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('-' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mSLASH(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SLASH; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('/' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mSEMICOLON(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = SEMICOLON; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(';' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mLESS_THAN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = LESS_THAN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('<' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mEQUALS(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = EQUALS; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('=' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mGREATER_THAN(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = GREATER_THAN; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('>' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mQUESTION(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = QUESTION; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('?' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCOMMERCIAL_AT(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = COMMERCIAL_AT; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('@' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mOPENING_SQUARE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = OPENING_SQUARE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('[' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCLOSING_SQUARE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CLOSING_SQUARE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match(']' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCARET(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CARET; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('^' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mUNDERLINE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = UNDERLINE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('_' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mOPENING_BRACE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = OPENING_BRACE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('{' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mCLOSING_BRACE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = CLOSING_BRACE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('}' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + +void PIXCfgLexer::mTILDE(bool _createToken) { + int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); + _ttype = TILDE; + ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; + + match('~' /* charlit */ ); + if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { + _token = makeToken(_ttype); + _token->setText(text.substr(_begin, text.length()-_begin)); + } + _returnToken = _token; + _saveIndex=0; +} + + +const unsigned long PIXCfgLexer::_tokenSet_0_data_[] = { 4294958072UL, 1UL, 0UL, 2147483648UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 +// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_0(_tokenSet_0_data_,16); +const unsigned long PIXCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14 +// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ % +// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G +// H I J K L M N O P Q R S T +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_1(_tokenSet_1_data_,16); +const unsigned long PIXCfgLexer::_tokenSet_2_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// . 0 1 2 3 4 5 6 7 8 9 +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_2(_tokenSet_2_data_,10); +const unsigned long PIXCfgLexer::_tokenSet_3_data_[] = { 0UL, 67043328UL, 126UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0 1 2 3 4 5 6 7 8 9 A B C D E F +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_3(_tokenSet_3_data_,10); +const unsigned long PIXCfgLexer::_tokenSet_4_data_[] = { 4294967288UL, 4294967291UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 4294967295UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; +// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13 +// 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $ +// % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F +// G H I J K L M N O P Q R S T +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_4(_tokenSet_4_data_,16); + diff --git a/src/parsers/PIXCfgLexer.hpp b/src/parsers/PIXCfgLexer.hpp new file mode 100644 index 000000000..6e6eb98af --- /dev/null +++ b/src/parsers/PIXCfgLexer.hpp @@ -0,0 +1,102 @@ +#ifndef INC_PIXCfgLexer_hpp_ +#define INC_PIXCfgLexer_hpp_ + +#line 25 "pix.g" + + // gets inserted before antlr generated includes in the header + // file + +#line 10 "PIXCfgLexer.hpp" +#include +/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgLexer.hpp"$ */ +#include +#include +#include +#include "PIXCfgParserTokenTypes.hpp" +#include +#line 30 "pix.g" + + // gets inserted after antlr generated includes in the header file + // outside any generated namespace specifications + +#include + +class PIXImporter; + +#line 27 "PIXCfgLexer.hpp" +#line 56 "pix.g" + + // gets inserted after generated namespace specifications in the + // header file. But outside the generated class. + +#line 33 "PIXCfgLexer.hpp" +class CUSTOM_API PIXCfgLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PIXCfgParserTokenTypes +{ +#line 1 "pix.g" +#line 37 "PIXCfgLexer.hpp" +private: + void initLiterals(); +public: + bool getCaseSensitiveLiterals() const + { + return true; + } +public: + PIXCfgLexer(ANTLR_USE_NAMESPACE(std)istream& in); + PIXCfgLexer(ANTLR_USE_NAMESPACE(antlr)InputBuffer& ib); + PIXCfgLexer(const ANTLR_USE_NAMESPACE(antlr)LexerSharedInputState& state); + ANTLR_USE_NAMESPACE(antlr)RefToken nextToken(); + public: void mLINE_COMMENT(bool _createToken); + public: void mNEWLINE(bool _createToken); + public: void mCOLON_COMMENT(bool _createToken); + public: void mCOLON(bool _createToken); + public: void mWhitespace(bool _createToken); + protected: void mINT_CONST(bool _createToken); + protected: void mHEX_CONST(bool _createToken); + protected: void mNEG_INT_CONST(bool _createToken); + protected: void mDIGIT(bool _createToken); + protected: void mHEXDIGIT(bool _createToken); + public: void mNUMBER(bool _createToken); + public: void mDOT(bool _createToken); + public: void mWORD(bool _createToken); + public: void mSTRING(bool _createToken); + public: void mPIPE_CHAR(bool _createToken); + public: void mNUMBER_SIGN(bool _createToken); + public: void mPERCENT(bool _createToken); + public: void mAMPERSAND(bool _createToken); + public: void mAPOSTROPHE(bool _createToken); + public: void mOPENING_PAREN(bool _createToken); + public: void mCLOSING_PAREN(bool _createToken); + public: void mSTAR(bool _createToken); + public: void mPLUS(bool _createToken); + public: void mCOMMA(bool _createToken); + public: void mMINUS(bool _createToken); + public: void mSLASH(bool _createToken); + public: void mSEMICOLON(bool _createToken); + public: void mLESS_THAN(bool _createToken); + public: void mEQUALS(bool _createToken); + public: void mGREATER_THAN(bool _createToken); + public: void mQUESTION(bool _createToken); + public: void mCOMMERCIAL_AT(bool _createToken); + public: void mOPENING_SQUARE(bool _createToken); + public: void mCLOSING_SQUARE(bool _createToken); + public: void mCARET(bool _createToken); + public: void mUNDERLINE(bool _createToken); + public: void mOPENING_BRACE(bool _createToken); + public: void mCLOSING_BRACE(bool _createToken); + public: void mTILDE(bool _createToken); +private: + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; +}; + +#endif /*INC_PIXCfgLexer_hpp_*/ diff --git a/src/parsers/PIXCfgLexer.txt b/src/parsers/PIXCfgLexer.txt new file mode 100644 index 000000000..57118a053 --- /dev/null +++ b/src/parsers/PIXCfgLexer.txt @@ -0,0 +1,2353 @@ +ANTLR-generated file resulting from grammar pix.g +Diagnostic output + +Terence Parr, MageLang Institute +with John Lilley, Empathy Software +ANTLR Version 2.7.7 (20090306); 1989-2005 + +*** Header Action. +This action will appear at the top of all generated files. + + // gets inserted after generated namespace specifications in the + // header file. But outside the generated class. + +*** End of Header Action + + +*** Lexer Preamble Action. +This action will appear before the declaration of your lexer class: + +*** End of Lexer Preamble Action + +*** Your lexer class is called 'PIXCfgLexer' and is a subclass of 'CharScanner'. + +*** User-defined lexer class members: +These are the member declarations that you defined for your class: + +*** End of user-defined lexer class members + +*** String literals used in the parser +The following string literals were used in the parser. +An actual code generator would arrange to place these literals +into a table in the generated lexer, so that actions in the +generated lexer could match token text against the literals. +String literals used in the lexer are not listed here, as they +are incorporated into the mainstream lexer processing. +*** End of string literals used by the parser + +*** Lexer nextToken rule: +The lexer nextToken rule is synthesized from all of the user-defined +lexer rules. It logically consists of one big alternative block with +each user-defined rule being an alternative. + +Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\n', '\u000b', '\u000c', '\r', + '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013', + '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', + '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f', + ' ', '!', '"', '#', '$', '%', + '&', '\'', '(', ')', '*', '+', + ',', '-', '.', '/', '0', '1', + '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', + 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z', '[', + ']', '^', '_', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', 'h', 'i', + 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z', '{', + '|', '}', '~', '\u007f', '\u0080', '\u0081', + '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', '\u0087', + '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', '\u008d', + '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', '\u0093', + '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', '\u0099', + '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', '\u009f', + '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5', + '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab', + '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', '\u00b1', + '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', '\u00b7', + '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd', + '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', '\u00c3', + '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', '\u00c9', + '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', '\u00cf', + '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5', + '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', '\u00db', + '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', '\u00e1', + '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', '\u00e7', + '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', '\u00ed', + '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', '\u00f3', + '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', '\u00f9', + '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', '\u00ff' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { '!' } + is matched. + Rule Reference: mLINE_COMMENT + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { '\n', '\r' } + is matched. + Rule Reference: mNEWLINE + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '\u007f', + '\u0080', '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', + '\u0086', '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', + '\u008c', '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', + '\u0092', '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', + '\u0098', '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', + '\u009e', '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', + '\u00a4', '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', + '\u00aa', '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', + '\u00b0', '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', + '\u00b6', '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', + '\u00bc', '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', + '\u00c2', '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', + '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', + '\u00ce', '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', + '\u00d4', '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', + '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', + '\u00e0', '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', + '\u00e6', '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', + '\u00ec', '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', + '\u00f2', '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', + '\u00f8', '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', + '\u00fe', '\u00ff' + } + is matched. + Rule Reference: mWhitespace + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mNUMBER + + Otherwise, Alternate(5) will be taken IF: + The lookahead set: + { '.' } + is matched. + Rule Reference: mDOT + + Otherwise, Alternate(6) will be taken IF: + The lookahead set: + { + '$', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z' + } + is matched. + Rule Reference: mWORD + + Otherwise, Alternate(7) will be taken IF: + The lookahead set: + { '"' } + is matched. + Rule Reference: mSTRING + + Otherwise, Alternate(8) will be taken IF: + The lookahead set: + { '|' } + is matched. + Rule Reference: mPIPE_CHAR + + Otherwise, Alternate(9) will be taken IF: + The lookahead set: + { '#' } + is matched. + Rule Reference: mNUMBER_SIGN + + Otherwise, Alternate(10) will be taken IF: + The lookahead set: + { '%' } + is matched. + Rule Reference: mPERCENT + + Otherwise, Alternate(11) will be taken IF: + The lookahead set: + { '&' } + is matched. + Rule Reference: mAMPERSAND + + Otherwise, Alternate(12) will be taken IF: + The lookahead set: + { '\'' } + is matched. + Rule Reference: mAPOSTROPHE + + Otherwise, Alternate(13) will be taken IF: + The lookahead set: + { '(' } + is matched. + Rule Reference: mOPENING_PAREN + + Otherwise, Alternate(14) will be taken IF: + The lookahead set: + { ')' } + is matched. + Rule Reference: mCLOSING_PAREN + + Otherwise, Alternate(15) will be taken IF: + The lookahead set: + { '*' } + is matched. + Rule Reference: mSTAR + + Otherwise, Alternate(16) will be taken IF: + The lookahead set: + { '+' } + is matched. + Rule Reference: mPLUS + + Otherwise, Alternate(17) will be taken IF: + The lookahead set: + { ',' } + is matched. + Rule Reference: mCOMMA + + Otherwise, Alternate(18) will be taken IF: + The lookahead set: + { '-' } + is matched. + Rule Reference: mMINUS + + Otherwise, Alternate(19) will be taken IF: + The lookahead set: + { '/' } + is matched. + Rule Reference: mSLASH + + Otherwise, Alternate(20) will be taken IF: + The lookahead set: + { ':' } + is matched. + Rule Reference: mCOLON + + Otherwise, Alternate(21) will be taken IF: + The lookahead set: + { ';' } + is matched. + Rule Reference: mSEMICOLON + + Otherwise, Alternate(22) will be taken IF: + The lookahead set: + { '<' } + is matched. + Rule Reference: mLESS_THAN + + Otherwise, Alternate(23) will be taken IF: + The lookahead set: + { '=' } + is matched. + Rule Reference: mEQUALS + + Otherwise, Alternate(24) will be taken IF: + The lookahead set: + { '>' } + is matched. + Rule Reference: mGREATER_THAN + + Otherwise, Alternate(25) will be taken IF: + The lookahead set: + { '?' } + is matched. + Rule Reference: mQUESTION + + Otherwise, Alternate(26) will be taken IF: + The lookahead set: + { '@' } + is matched. + Rule Reference: mCOMMERCIAL_AT + + Otherwise, Alternate(27) will be taken IF: + The lookahead set: + { '[' } + is matched. + Rule Reference: mOPENING_SQUARE + + Otherwise, Alternate(28) will be taken IF: + The lookahead set: + { ']' } + is matched. + Rule Reference: mCLOSING_SQUARE + + Otherwise, Alternate(29) will be taken IF: + The lookahead set: + { '^' } + is matched. + Rule Reference: mCARET + + Otherwise, Alternate(30) will be taken IF: + The lookahead set: + { '_' } + is matched. + Rule Reference: mUNDERLINE + + Otherwise, Alternate(31) will be taken IF: + The lookahead set: + { '{' } + is matched. + Rule Reference: mOPENING_BRACE + + Otherwise, Alternate(32) will be taken IF: + The lookahead set: + { '}' } + is matched. + Rule Reference: mCLOSING_BRACE + + Otherwise, Alternate(33) will be taken IF: + The lookahead set: + { '~' } + is matched. + Rule Reference: mTILDE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives +End of alternative block. +*** End of nextToken lexer rule. + +*** User-defined Lexer rules: + + *** Lexer Rule: mLINE_COMMENT + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '!' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '!' } + is matched. + Match string literal "!" + Start ZERO-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '!', + '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', + '.', '/', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', + 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', + '^', '_', '`', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', 'h', 'i', + 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z', '{', + '|', '}', '~', '\u007f', '\u0080', '\u0081', + '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', '\u0087', + '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', '\u008d', + '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', '\u0093', + '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', '\u0099', + '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', '\u009f', + '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5', + '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab', + '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', '\u00b1', + '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', '\u00b7', + '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd', + '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', '\u00c3', + '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', '\u00c9', + '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', '\u00cf', + '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5', + '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', '\u00db', + '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', '\u00e1', + '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', '\u00e7', + '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', '\u00ed', + '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', '\u00f3', + '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', '\u00f9', + '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', '\u00ff' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '!', + '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', + '.', '/', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', + 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', + '^', '_', '`', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', 'h', 'i', + 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z', '{', + '|', '}', '~', '\u007f', '\u0080', '\u0081', + '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', '\u0087', + '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', '\u008d', + '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', '\u0093', + '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', '\u0099', + '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', '\u009f', + '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5', + '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab', + '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', '\u00b1', + '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', '\u00b7', + '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd', + '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', '\u00c3', + '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', '\u00c9', + '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', '\u00cf', + '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5', + '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', '\u00db', + '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', '\u00e1', + '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', '\u00e7', + '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', '\u00ed', + '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', '\u00f3', + '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', '\u00f9', + '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', '\u00ff' + } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '!', + '"', '#', '$', '%', '&', '\'', + '(', ')', '*', '+', ',', '-', + '.', '/', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + ':', ';', '<', '=', '>', '?', + '@', 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', + 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z', '[', '\\', ']', + '^', '_', '`', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', 'h', 'i', + 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z', '{', + '|', '}', '~', '\u007f', '\u0080', '\u0081', + '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', '\u0087', + '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', '\u008d', + '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', '\u0093', + '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', '\u0099', + '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', '\u009f', + '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', '\u00a5', + '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', '\u00ab', + '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', '\u00b1', + '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', '\u00b7', + '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', '\u00bd', + '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', '\u00c3', + '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', '\u00c9', + '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', '\u00cf', + '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', '\u00d5', + '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', '\u00db', + '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', '\u00e1', + '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', '\u00e7', + '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', '\u00ed', + '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', '\u00f3', + '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', '\u00f9', + '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', '\u00ff' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { '\r' } + is matched. + Match character '\r' + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { '\n' } + is matched. + Match character '\n' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ZERO-OR-MORE block. + Rule Reference: mNEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mLINE_COMMENT + + *** Lexer Rule: mNEWLINE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '\n', '\r' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '\n', '\r' } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + k==1: {'\n', '\r' } + k==2: {'\n' } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + k==1: {'\r' } + k==2: {'\n' } + is matched. + Match string literal "\r\n" + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + k==1: {'\r' } + k==2: { } + is matched. + Match character '\r' + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { '\n' } + is matched. + Match character '\n' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: newline(); + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mNEWLINE + + *** Lexer Rule: mWhitespace + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '\u007f', + '\u0080', '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', + '\u0086', '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', + '\u008c', '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', + '\u0092', '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', + '\u0098', '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', + '\u009e', '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', + '\u00a4', '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', + '\u00aa', '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', + '\u00b0', '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', + '\u00b6', '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', + '\u00bc', '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', + '\u00c2', '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', + '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', + '\u00ce', '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', + '\u00d4', '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', + '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', + '\u00e0', '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', + '\u00e6', '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', + '\u00ec', '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', + '\u00f2', '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', + '\u00f8', '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', + '\u00fe', '\u00ff' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '\u007f', + '\u0080', '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', + '\u0086', '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', + '\u008c', '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', + '\u0092', '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', + '\u0098', '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', + '\u009e', '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', + '\u00a4', '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', + '\u00aa', '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', + '\u00b0', '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', + '\u00b6', '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', + '\u00bc', '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', + '\u00c2', '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', + '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', + '\u00ce', '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', + '\u00d4', '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', + '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', + '\u00e0', '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', + '\u00e6', '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', + '\u00ec', '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', + '\u00f2', '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', + '\u00f8', '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', + '\u00fe', '\u00ff' + } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\u000b', '\u000c', '\u000e', '\u000f', + '\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', + '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', + '\u001c', '\u001d', '\u001e', '\u001f', ' ', '\u007f', + '\u0080', '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', + '\u0086', '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', + '\u008c', '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', + '\u0092', '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', + '\u0098', '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', + '\u009e', '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', + '\u00a4', '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', + '\u00aa', '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', + '\u00b0', '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', + '\u00b6', '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', + '\u00bc', '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', + '\u00c2', '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', + '\u00c8', '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', + '\u00ce', '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', + '\u00d4', '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', + '\u00da', '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', + '\u00e0', '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', + '\u00e6', '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', + '\u00ec', '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', + '\u00f2', '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', + '\u00f8', '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', + '\u00fe', '\u00ff' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008' + } + is matched. + Match character range: '\003'..'\010' + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { '\t' } + is matched. + Match character '\t' + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { '\u000b' } + is matched. + Match character '\013' + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { '\u000c' } + is matched. + Match character '\f' + + Otherwise, Alternate(5) will be taken IF: + The lookahead set: + { + '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', + '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', + '\u0019', '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', + '\u001f' + } + is matched. + Match character range: '\016'..'\037' + + Otherwise, Alternate(6) will be taken IF: + The lookahead set: + { + '\u007f', '\u0080', '\u0081', '\u0082', '\u0083', + '\u0084', '\u0085', '\u0086', '\u0087', '\u0088', '\u0089', + '\u008a', '\u008b', '\u008c', '\u008d', '\u008e', '\u008f', + '\u0090', '\u0091', '\u0092', '\u0093', '\u0094', '\u0095', + '\u0096', '\u0097', '\u0098', '\u0099', '\u009a', '\u009b', + '\u009c', '\u009d', '\u009e', '\u009f', '\u00a0', '\u00a1', + '\u00a2', '\u00a3', '\u00a4', '\u00a5', '\u00a6', '\u00a7', + '\u00a8', '\u00a9', '\u00aa', '\u00ab', '\u00ac', '\u00ad', + '\u00ae', '\u00af', '\u00b0', '\u00b1', '\u00b2', '\u00b3', + '\u00b4', '\u00b5', '\u00b6', '\u00b7', '\u00b8', '\u00b9', + '\u00ba', '\u00bb', '\u00bc', '\u00bd', '\u00be', '\u00bf', + '\u00c0', '\u00c1', '\u00c2', '\u00c3', '\u00c4', '\u00c5', + '\u00c6', '\u00c7', '\u00c8', '\u00c9', '\u00ca', '\u00cb', + '\u00cc', '\u00cd', '\u00ce', '\u00cf', '\u00d0', '\u00d1', + '\u00d2', '\u00d3', '\u00d4', '\u00d5', '\u00d6', '\u00d7', + '\u00d8', '\u00d9', '\u00da', '\u00db', '\u00dc', '\u00dd', + '\u00de', '\u00df', '\u00e0', '\u00e1', '\u00e2', '\u00e3', + '\u00e4', '\u00e5', '\u00e6', '\u00e7', '\u00e8', '\u00e9', + '\u00ea', '\u00eb', '\u00ec', '\u00ed', '\u00ee', '\u00ef', + '\u00f0', '\u00f1', '\u00f2', '\u00f3', '\u00f4', '\u00f5', + '\u00f6', '\u00f7', '\u00f8', '\u00f9', '\u00fa', '\u00fb', + '\u00fc', '\u00fd', '\u00fe', '\u00ff' + } + is matched. + Match character range: '\177'..'\377' + + Otherwise, Alternate(7) will be taken IF: + The lookahead set: + { ' ' } + is matched. + Match character ' ' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mWhitespace + + *** Lexer Rule: mINT_CONST + Access: protected + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + MATCHES ALL + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mINT_CONST + + *** Lexer Rule: mHEX_CONST + Access: protected + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + MATCHES ALL + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mHEX_CONST + + *** Lexer Rule: mNEG_INT_CONST + Access: protected + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + MATCHES ALL + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mNEG_INT_CONST + + *** Lexer Rule: mDIGIT + Access: protected + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Match character range: '0'..'9' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mDIGIT + + *** Lexer Rule: mHEXDIGIT + Access: protected + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', 'A', + 'B', 'C', 'D', 'E', 'F' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Match character range: '0'..'9' + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { + 'A', 'B', 'C', 'D', 'E', + 'F' + } + is matched. + Match character range: 'A'..'F' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + *** End Lexer Rule: mHEXDIGIT + + *** Lexer Rule: mNUMBER + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start of alternative block. + Warning: This alternative block is non-deterministic + Start of an alternative block. + The lookahead set for this block is: + k==1: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==2: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'x' + } + k==3: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==4: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==5: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==6: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==7: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==8: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==9: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + k==10: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9', + 'A', 'B', 'C', 'D', 'E', 'F' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + k==1: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==2: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==3: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==4: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==5: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==6: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==7: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==8: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==9: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==10: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + is matched, AND the syntactic predicate: + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: _ttype = IPV4; + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + k==1: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==2: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==3: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==4: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==5: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==6: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==7: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==8: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==9: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + k==10: { + '.', '0', '1', '2', '3', + '4', '5', '6', '7', '8', '9' + } + is matched, AND the syntactic predicate: + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + Rule Reference: mDOT + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + k==1: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==2: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==3: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==4: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==5: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==6: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==7: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==8: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==9: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + k==10: { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Rule Reference: mDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + ACTION: _ttype = INT_CONST; + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + k==1: {'0' } + k==2: {'x' } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { '0' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '0' } + is matched. + Match character '0' + Match character 'x' + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', 'A', + 'B', 'C', 'D', 'E', 'F' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9', 'A', + 'B', 'C', 'D', 'E', 'F' + } + is matched. + Rule Reference: mHEXDIGIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: _ttype = HEX_CONST; + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mNUMBER + + *** Lexer Rule: mDOT + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '.' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '.' } + is matched. + Match character '.' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mDOT + + *** Lexer Rule: mWORD + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { + '$', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '$', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z' + } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + '$', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { + 'a', 'b', 'c', 'd', 'e', + 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', + 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z' + } + is matched. + Match character range: 'a'..'z' + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { + 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', + 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z' + } + is matched. + Match character range: 'A'..'Z' + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { '$' } + is matched. + Match character '$' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start ZERO-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '!', '"', '#', '$', '%', + '&', '\'', '(', ')', '*', '+', + ',', '-', '.', '/', '0', '1', + '2', '3', '4', '5', '6', '7', + '8', '9', ':', ';', '<', '=', + '>', '?', '@', 'A', 'B', 'C', + 'D', 'E', 'F', 'G', 'H', 'I', + 'J', 'K', 'L', 'M', 'N', 'O', + 'P', 'Q', 'R', 'S', 'T', 'U', + 'V', 'W', 'X', 'Y', 'Z', '\\', + '^', '_', '`', 'a', 'b', 'c', + 'd', 'e', 'f', 'g', 'h', 'i', + 'j', 'k', 'l', 'm', 'n', 'o', + 'p', 'q', 'r', 's', 't', 'u', + 'v', 'w', 'x', 'y', 'z' + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { + '!', '"', '#', '$', '%', + '&', '\'', '(', ')', '*', '+', + ',', '-', '.', '/' + } + is matched. + Match character range: '!'..'/' + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { + '0', '1', '2', '3', '4', + '5', '6', '7', '8', '9' + } + is matched. + Match character range: '0'..'9' + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { ':' } + is matched. + Match character ':' + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { ';' } + is matched. + Match character ';' + + Otherwise, Alternate(5) will be taken IF: + The lookahead set: + { '<' } + is matched. + Match character '<' + + Otherwise, Alternate(6) will be taken IF: + The lookahead set: + { '=' } + is matched. + Match character '=' + + Otherwise, Alternate(7) will be taken IF: + The lookahead set: + { '>' } + is matched. + Match character '>' + + Otherwise, Alternate(8) will be taken IF: + The lookahead set: + { '?' } + is matched. + Match character '?' + + Otherwise, Alternate(9) will be taken IF: + The lookahead set: + { '@' } + is matched. + Match character '@' + + Otherwise, Alternate(10) will be taken IF: + The lookahead set: + { + 'A', 'B', 'C', 'D', 'E', + 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', + 'R', 'S', 'T', 'U', 'V', 'W', + 'X', 'Y', 'Z' + } + is matched. + Match character range: 'A'..'Z' + + Otherwise, Alternate(11) will be taken IF: + The lookahead set: + { '\\' } + is matched. + Match character '\\' + + Otherwise, Alternate(12) will be taken IF: + The lookahead set: + { '^' } + is matched. + Match character '^' + + Otherwise, Alternate(13) will be taken IF: + The lookahead set: + { '_' } + is matched. + Match character '_' + + Otherwise, Alternate(14) will be taken IF: + The lookahead set: + { '`' } + is matched. + Match character '`' + + Otherwise, Alternate(15) will be taken IF: + The lookahead set: + { + 'a', 'b', 'c', 'd', 'e', + 'f', 'g', 'h', 'i', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', + 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z' + } + is matched. + Match character range: 'a'..'z' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + End ZERO-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mWORD + + *** Lexer Rule: mSTRING + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '"' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '"' } + is matched. + Match character '"' + Start ZERO-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\n', '\u000b', '\u000c', '\r', + '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013', + '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', + '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f', + ' ', '!', '#', '$', '%', '&', + '\'', '(', ')', '*', '+', ',', + '-', '.', '/', '0', '1', '2', + '3', '4', '5', '6', '7', '8', + '9', ':', ';', '<', '=', '>', + '?', '@', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', '[', '\\', + ']', '^', '_', '`', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', + '{', '|', '}', '~', '\u007f', '\u0080', + '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', + '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', + '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', + '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', + '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', + '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', + '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', + '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', + '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', + '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', + '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', + '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', + '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', + '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', + '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', + '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', + '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', + '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', + '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', + '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', + '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', + '\u00ff' + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + '\u0003', '\u0004', '\u0005', '\u0006', '\u0007', + '\u0008', '\t', '\n', '\u000b', '\u000c', '\r', + '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013', + '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', + '\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f', + ' ', '!', '#', '$', '%', '&', + '\'', '(', ')', '*', '+', ',', + '-', '.', '/', '0', '1', '2', + '3', '4', '5', '6', '7', '8', + '9', ':', ';', '<', '=', '>', + '?', '@', 'A', 'B', 'C', 'D', + 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', + 'Q', 'R', 'S', 'T', 'U', 'V', + 'W', 'X', 'Y', 'Z', '[', '\\', + ']', '^', '_', '`', 'a', 'b', + 'c', 'd', 'e', 'f', 'g', 'h', + 'i', 'j', 'k', 'l', 'm', 'n', + 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z', + '{', '|', '}', '~', '\u007f', '\u0080', + '\u0081', '\u0082', '\u0083', '\u0084', '\u0085', '\u0086', + '\u0087', '\u0088', '\u0089', '\u008a', '\u008b', '\u008c', + '\u008d', '\u008e', '\u008f', '\u0090', '\u0091', '\u0092', + '\u0093', '\u0094', '\u0095', '\u0096', '\u0097', '\u0098', + '\u0099', '\u009a', '\u009b', '\u009c', '\u009d', '\u009e', + '\u009f', '\u00a0', '\u00a1', '\u00a2', '\u00a3', '\u00a4', + '\u00a5', '\u00a6', '\u00a7', '\u00a8', '\u00a9', '\u00aa', + '\u00ab', '\u00ac', '\u00ad', '\u00ae', '\u00af', '\u00b0', + '\u00b1', '\u00b2', '\u00b3', '\u00b4', '\u00b5', '\u00b6', + '\u00b7', '\u00b8', '\u00b9', '\u00ba', '\u00bb', '\u00bc', + '\u00bd', '\u00be', '\u00bf', '\u00c0', '\u00c1', '\u00c2', + '\u00c3', '\u00c4', '\u00c5', '\u00c6', '\u00c7', '\u00c8', + '\u00c9', '\u00ca', '\u00cb', '\u00cc', '\u00cd', '\u00ce', + '\u00cf', '\u00d0', '\u00d1', '\u00d2', '\u00d3', '\u00d4', + '\u00d5', '\u00d6', '\u00d7', '\u00d8', '\u00d9', '\u00da', + '\u00db', '\u00dc', '\u00dd', '\u00de', '\u00df', '\u00e0', + '\u00e1', '\u00e2', '\u00e3', '\u00e4', '\u00e5', '\u00e6', + '\u00e7', '\u00e8', '\u00e9', '\u00ea', '\u00eb', '\u00ec', + '\u00ed', '\u00ee', '\u00ef', '\u00f0', '\u00f1', '\u00f2', + '\u00f3', '\u00f4', '\u00f5', '\u00f6', '\u00f7', '\u00f8', + '\u00f9', '\u00fa', '\u00fb', '\u00fc', '\u00fd', '\u00fe', + '\u00ff' + } + is matched. + Match character NOT '"' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + End ZERO-OR-MORE block. + Match character '"' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mSTRING + + *** Lexer Rule: mPIPE_CHAR + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '|' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '|' } + is matched. + Match character '|' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mPIPE_CHAR + + *** Lexer Rule: mNUMBER_SIGN + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '#' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '#' } + is matched. + Match character '#' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mNUMBER_SIGN + + *** Lexer Rule: mPERCENT + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '%' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '%' } + is matched. + Match character '%' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mPERCENT + + *** Lexer Rule: mAMPERSAND + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '&' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '&' } + is matched. + Match character '&' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mAMPERSAND + + *** Lexer Rule: mAPOSTROPHE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '\'' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '\'' } + is matched. + Match character '\'' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mAPOSTROPHE + + *** Lexer Rule: mOPENING_PAREN + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '(' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '(' } + is matched. + Match character '(' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mOPENING_PAREN + + *** Lexer Rule: mCLOSING_PAREN + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { ')' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { ')' } + is matched. + Match character ')' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCLOSING_PAREN + + *** Lexer Rule: mSTAR + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '*' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '*' } + is matched. + Match character '*' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mSTAR + + *** Lexer Rule: mPLUS + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '+' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '+' } + is matched. + Match character '+' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mPLUS + + *** Lexer Rule: mCOMMA + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { ',' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { ',' } + is matched. + Match character ',' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCOMMA + + *** Lexer Rule: mMINUS + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '-' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '-' } + is matched. + Match character '-' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mMINUS + + *** Lexer Rule: mSLASH + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '/' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '/' } + is matched. + Match character '/' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mSLASH + + *** Lexer Rule: mCOLON + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { ':' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { ':' } + is matched. + Match character ':' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCOLON + + *** Lexer Rule: mSEMICOLON + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { ';' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { ';' } + is matched. + Match character ';' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mSEMICOLON + + *** Lexer Rule: mLESS_THAN + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '<' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '<' } + is matched. + Match character '<' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mLESS_THAN + + *** Lexer Rule: mEQUALS + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '=' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '=' } + is matched. + Match character '=' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mEQUALS + + *** Lexer Rule: mGREATER_THAN + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '>' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '>' } + is matched. + Match character '>' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mGREATER_THAN + + *** Lexer Rule: mQUESTION + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '?' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '?' } + is matched. + Match character '?' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mQUESTION + + *** Lexer Rule: mCOMMERCIAL_AT + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '@' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '@' } + is matched. + Match character '@' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCOMMERCIAL_AT + + *** Lexer Rule: mOPENING_SQUARE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '[' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '[' } + is matched. + Match character '[' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mOPENING_SQUARE + + *** Lexer Rule: mCLOSING_SQUARE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { ']' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { ']' } + is matched. + Match character ']' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCLOSING_SQUARE + + *** Lexer Rule: mCARET + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '^' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '^' } + is matched. + Match character '^' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCARET + + *** Lexer Rule: mUNDERLINE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '_' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '_' } + is matched. + Match character '_' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mUNDERLINE + + *** Lexer Rule: mOPENING_BRACE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '{' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '{' } + is matched. + Match character '{' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mOPENING_BRACE + + *** Lexer Rule: mCLOSING_BRACE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '}' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '}' } + is matched. + Match character '}' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mCLOSING_BRACE + + *** Lexer Rule: mTILDE + Access: public + Return value: lexical rule returns an implicit token type + Start of an alternative block. + The lookahead set for this block is: + { '~' } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { '~' } + is matched. + Match character '~' + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + *** End Lexer Rule: mTILDE + +*** End User-defined Lexer rules: diff --git a/src/parsers/PIXCfgParser.cpp b/src/parsers/PIXCfgParser.cpp new file mode 100644 index 000000000..4f543beb6 --- /dev/null +++ b/src/parsers/PIXCfgParser.cpp @@ -0,0 +1,1939 @@ +/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgParser.cpp"$ */ +#line 40 "pix.g" + + // gets inserted before the antlr generated includes in the cpp + // file + +#line 8 "PIXCfgParser.cpp" +#include "PIXCfgParser.hpp" +#include +#include +#include +#line 46 "pix.g" + + // gets inserted after the antlr generated includes in the cpp + // file +#include +#include + +#include "../libgui/PIXImporter.h" + +#line 22 "PIXCfgParser.cpp" +#line 1 "pix.g" +#line 24 "PIXCfgParser.cpp" +PIXCfgParser::PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k) +{ +} + +PIXCfgParser::PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,2) +{ +} + +PIXCfgParser::PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,k) +{ +} + +PIXCfgParser::PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(lexer,2) +{ +} + +PIXCfgParser::PIXCfgParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state) +: ANTLR_USE_NAMESPACE(antlr)LLkParser(state,2) +{ +} + +void PIXCfgParser::cfgfile() { + + try { // for error handling + { // ( ... )+ + int _cnt3=0; + for (;;) { + switch ( LA(1)) { + case LINE_COMMENT: + case COLON_COMMENT: + { + comment(); + break; + } + case PIX_WORD: + case ASA_WORD: + { + version(); + break; + } + case HOSTNAME: + { + hostname(); + break; + } + case IP: + { + ip_commands(); + break; + } + case INTRFACE: + { + intrface(); + break; + } + case CONTROLLER: + { + controller(); + break; + } + case ACCESS_LIST: + { + access_list_commands(); + break; + } + case EXIT: + { + exit(); + break; + } + case DESCRIPTION: + { + description(); + break; + } + case SHUTDOWN: + { + shutdown(); + break; + } + case CERTIFICATE: + { + certificate(); + break; + } + case QUIT: + { + quit(); + break; + } + case WORD: + { + unknown_command(); + break; + } + case NEWLINE: + { + match(NEWLINE); + break; + } + default: + { + if ( _cnt3>=1 ) { goto _loop3; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());} + } + } + _cnt3++; + } + _loop3:; + } // ( ... )+ + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } +} + +void PIXCfgParser::comment() { + + try { // for error handling + { + switch ( LA(1)) { + case LINE_COMMENT: + { + match(LINE_COMMENT); + break; + } + case COLON_COMMENT: + { + match(COLON_COMMENT); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::version() { + + try { // for error handling + { + switch ( LA(1)) { + case PIX_WORD: + { + match(PIX_WORD); + break; + } + case ASA_WORD: + { + match(ASA_WORD); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(VERSION_WORD); + match(NUMBER); + if ( inputState->guessing==0 ) { +#line 150 "pix.g" + + importer->setDiscoveredVersion(LT(0)->getText()); + *dbg << "VERSION " << LT(0)->getText() << std::endl; + consumeUntil(NEWLINE); + +#line 211 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::hostname() { + + try { // for error handling + match(HOSTNAME); + { + switch ( LA(1)) { + case STRING: + { + match(STRING); + break; + } + case WORD: + { + match(WORD); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 159 "pix.g" + + importer->setHostName( LT(0)->getText() ); + *dbg << "HOSTNAME " + << "LT0=" << LT(0)->getText() + << std::endl; + +#line 254 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::ip_commands() { + + try { // for error handling + match(IP); + { + switch ( LA(1)) { + case ACCESS_LIST: + { + ip_access_list_ext(); + break; + } + case SHUTDOWN: + case ADDRESS: + case SWITCHPORT: + { + interface_known_commands(); + break; + } + case COMMUNITY_LIST: + { + community_list_command(); + break; + } + case WORD: + { + unknown_command(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::intrface() { + ANTLR_USE_NAMESPACE(antlr)RefToken in = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(INTRFACE); + in = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 420 "pix.g" + + importer->newInterface( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE: " << in->getText() << std::endl; + +#line 326 "PIXCfgParser.cpp" + } + match(NEWLINE); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::controller() { + + try { // for error handling + match(CONTROLLER); + if ( inputState->guessing==0 ) { +#line 411 "pix.g" + + importer->clearCurrentInterface(); + consumeUntil(NEWLINE); + +#line 350 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::access_list_commands() { + ANTLR_USE_NAMESPACE(antlr)RefToken acl_num = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(ACCESS_LIST); + acl_num = LT(1); + match(INT_CONST); + if ( inputState->guessing==0 ) { +#line 174 "pix.g" + + importer->newUnidirRuleSet( std::string("acl_") + acl_num->getText() ); + *dbg << acl_num->getLine() << ":" + << " ACL #" << acl_num->getText() << " "; + +#line 377 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case PERMIT: + { + permit_ext(); + break; + } + case DENY: + { + deny_ext(); + break; + } + case REMARK: + { + remark(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::exit() { + + try { // for error handling + match(EXIT); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::description() { + + try { // for error handling + match(DESCRIPTION); + if ( inputState->guessing==0 ) { +#line 440 "pix.g" + + *dbg << LT(1)->getLine() << ":"; + std::string descr; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + descr += LT(1)->getText() + " "; + consume(); + } + importer->addInterfaceComment( descr ); + *dbg << " DESCRIPTION " << descr << std::endl; + //consumeUntil(NEWLINE); + +#line 446 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::shutdown() { + + try { // for error handling + match(SHUTDOWN); + if ( inputState->guessing==0 ) { +#line 475 "pix.g" + + *dbg<< LT(1)->getLine() << ":" + << " INTERFACE SHUTDOWN " << std::endl; + +#line 469 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::certificate() { + + try { // for error handling + match(CERTIFICATE); + match(WORD); + if ( inputState->guessing==0 ) { +#line 142 "pix.g" + + consumeUntil(NEWLINE); + consumeUntil(QUIT); + +#line 493 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::quit() { + + try { // for error handling + match(QUIT); + if ( inputState->guessing==0 ) { +#line 121 "pix.g" + + consumeUntil(NEWLINE); + +#line 515 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::unknown_command() { + + try { // for error handling + match(WORD); + if ( inputState->guessing==0 ) { +#line 135 "pix.g" + + consumeUntil(NEWLINE); + +#line 537 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::ip_access_list_ext() { + ANTLR_USE_NAMESPACE(antlr)RefToken name = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(ACCESS_LIST); + name = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 191 "pix.g" + + importer->newUnidirRuleSet( name->getText() ); + *dbg << name->getLine() << ":" + << " ACL ext " << name->getText() << std::endl; + +#line 564 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case PERMIT: + { + permit_ext(); + break; + } + case DENY: + { + deny_ext(); + break; + } + case LINE_COMMENT: + case COLON_COMMENT: + { + comment(); + break; + } + case REMARK: + { + remark(); + break; + } + case NEWLINE: + { + match(NEWLINE); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 207 "pix.g" + + *dbg << LT(0)->getLine() << ":" + << " ACL line end" << std::endl << std::endl; + +#line 606 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::interface_known_commands() { + + try { // for error handling + { + switch ( LA(1)) { + case ADDRESS: + { + intf_address(); + break; + } + case SWITCHPORT: + { + switchport(); + break; + } + case SHUTDOWN: + { + shutdown(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + match(NEWLINE); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::community_list_command() { + + try { // for error handling + match(COMMUNITY_LIST); + if ( inputState->guessing==0 ) { +#line 128 "pix.g" + + consumeUntil(NEWLINE); + +#line 666 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::permit_ext() { + + try { // for error handling + match(PERMIT); + if ( inputState->guessing==0 ) { +#line 215 "pix.g" + + importer->newPolicyRule(); + importer->action = "permit"; + *dbg << LT(1)->getLine() << ":" << " permit "; + +#line 690 "PIXCfgParser.cpp" + } + rule_ext(); + match(NEWLINE); + if ( inputState->guessing==0 ) { +#line 221 "pix.g" + + importer->pushRule(); + +#line 699 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::deny_ext() { + + try { // for error handling + match(DENY); + if ( inputState->guessing==0 ) { +#line 227 "pix.g" + + importer->newPolicyRule(); + importer->action = "deny"; + *dbg << LT(1)->getLine() << ":" << " deny "; + +#line 723 "PIXCfgParser.cpp" + } + rule_ext(); + match(NEWLINE); + if ( inputState->guessing==0 ) { +#line 233 "pix.g" + + importer->pushRule(); + +#line 732 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::remark() { + + try { // for error handling + match(REMARK); + if ( inputState->guessing==0 ) { +#line 460 "pix.g" + + *dbg << LT(1)->getLine() << ":"; + std::string rem; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + rem += LT(1)->getText() + " "; + consume(); + } + importer->addRuleComment( rem ); + *dbg << " REMARK " << rem << std::endl; + //consumeUntil(NEWLINE); + +#line 763 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_1); + } else { + throw; + } + } +} + +void PIXCfgParser::rule_ext() { + + try { // for error handling + { + switch ( LA(1)) { + case IP: + case WORD: + { + ip_protocols(); + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 243 "pix.g" + importer->SaveTmpAddrToSrc(); *dbg << "(src) "; +#line 789 "PIXCfgParser.cpp" + } + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 244 "pix.g" + importer->SaveTmpAddrToDst(); *dbg << "(dst) "; +#line 795 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case TIME_RANGE: + { + time_range(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case FRAGMENTS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case FRAGMENTS: + { + fragments(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LOG: + case LOG_INPUT: + { + log(); + break; + } + case NEWLINE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case ICMP: + { + match(ICMP); + if ( inputState->guessing==0 ) { +#line 250 "pix.g" + + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + +#line 865 "PIXCfgParser.cpp" + } + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 254 "pix.g" + importer->SaveTmpAddrToSrc(); *dbg << "(src) "; +#line 871 "PIXCfgParser.cpp" + } + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 255 "pix.g" + importer->SaveTmpAddrToDst(); *dbg << "(dst) "; +#line 877 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case WORD: + case INT_CONST: + { + icmp_spec(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case FRAGMENTS: + case TIME_RANGE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case TIME_RANGE: + { + time_range(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case FRAGMENTS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case FRAGMENTS: + { + fragments(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LOG: + case LOG_INPUT: + { + log(); + break; + } + case NEWLINE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + case TCP: + case UDP: + { + { + switch ( LA(1)) { + case TCP: + { + match(TCP); + break; + } + case UDP: + { + match(UDP); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 262 "pix.g" + + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + +#line 987 "PIXCfgParser.cpp" + } + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 266 "pix.g" + importer->SaveTmpAddrToSrc(); *dbg << "(src) "; +#line 993 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case P_EQ: + case P_GT: + case P_LT: + case P_NEQ: + case P_RANGE: + { + xoperator(); + if ( inputState->guessing==0 ) { +#line 267 "pix.g" + importer->SaveTmpPortToSrc(); +#line 1007 "PIXCfgParser.cpp" + } + break; + } + case HOST: + case IPV4: + case ANY: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + hostaddr_ext(); + if ( inputState->guessing==0 ) { +#line 268 "pix.g" + importer->SaveTmpAddrToDst(); *dbg << "(dst) "; +#line 1027 "PIXCfgParser.cpp" + } + { + switch ( LA(1)) { + case P_EQ: + case P_GT: + case P_LT: + case P_NEQ: + case P_RANGE: + { + xoperator(); + if ( inputState->guessing==0 ) { +#line 269 "pix.g" + importer->SaveTmpPortToDst(); +#line 1041 "PIXCfgParser.cpp" + } + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case ESTABLISHED: + case FRAGMENTS: + case TIME_RANGE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case ESTABLISHED: + { + established(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case FRAGMENTS: + case TIME_RANGE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case TIME_RANGE: + { + time_range(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + case FRAGMENTS: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case FRAGMENTS: + { + fragments(); + break; + } + case NEWLINE: + case LOG: + case LOG_INPUT: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + { + switch ( LA(1)) { + case LOG: + case LOG_INPUT: + { + log(); + break; + } + case NEWLINE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 275 "pix.g" + + *dbg << std::endl; + +#line 1151 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } +} + +void PIXCfgParser::ip_protocols() { + + try { // for error handling + { + switch ( LA(1)) { + case IP: + { + match(IP); + break; + } + case WORD: + { + match(WORD); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 283 "pix.g" + + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + +#line 1191 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_3); + } else { + throw; + } + } +} + +void PIXCfgParser::hostaddr_ext() { + ANTLR_USE_NAMESPACE(antlr)RefToken h = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken m = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + switch ( LA(1)) { + case HOST: + { + { + match(HOST); + h = LT(1); + match(IPV4); + } + if ( inputState->guessing==0 ) { +#line 335 "pix.g" + + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + +#line 1225 "PIXCfgParser.cpp" + } + break; + } + case IPV4: + { + { + a = LT(1); + match(IPV4); + m = LT(1); + match(IPV4); + } + if ( inputState->guessing==0 ) { +#line 342 "pix.g" + + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + +#line 1244 "PIXCfgParser.cpp" + } + break; + } + case ANY: + { + match(ANY); + if ( inputState->guessing==0 ) { +#line 349 "pix.g" + + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + +#line 1258 "PIXCfgParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_4); + } else { + throw; + } + } +} + +void PIXCfgParser::time_range() { + ANTLR_USE_NAMESPACE(antlr)RefToken tr_name = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(TIME_RANGE); + tr_name = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 401 "pix.g" + + importer->time_range_name = tr_name->getText(); + *dbg << "time_range " << tr_name->getText() << " "; + +#line 1291 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_5); + } else { + throw; + } + } +} + +void PIXCfgParser::fragments() { + + try { // for error handling + match(FRAGMENTS); + if ( inputState->guessing==0 ) { +#line 394 "pix.g" + + importer->fragments = true; + *dbg << "fragments "; + +#line 1314 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_6); + } else { + throw; + } + } +} + +void PIXCfgParser::log() { + + try { // for error handling + { + switch ( LA(1)) { + case LOG: + { + match(LOG); + break; + } + case LOG_INPUT: + { + match(LOG_INPUT); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 380 "pix.g" + + importer->logging = true; + *dbg << "logging "; + +#line 1354 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } +} + +void PIXCfgParser::icmp_spec() { + ANTLR_USE_NAMESPACE(antlr)RefToken icmp_type = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken icmp_code = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken icmp_word = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + { + switch ( LA(1)) { + case INT_CONST: + { + { + icmp_type = LT(1); + match(INT_CONST); + icmp_code = LT(1); + match(INT_CONST); + } + if ( inputState->guessing==0 ) { +#line 291 "pix.g" + + importer->icmp_type = icmp_type->getText(); + importer->icmp_code = icmp_code->getText(); + importer->icmp_spec = ""; + *dbg << icmp_type->getText() << " " + << icmp_code->getText() << " "; + +#line 1392 "PIXCfgParser.cpp" + } + break; + } + case WORD: + { + icmp_word = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 300 "pix.g" + + importer->icmp_spec = icmp_word->getText(); + *dbg << icmp_word->getText() << " "; + +#line 1406 "PIXCfgParser.cpp" + } + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_7); + } else { + throw; + } + } +} + +void PIXCfgParser::xoperator() { + + try { // for error handling + switch ( LA(1)) { + case P_EQ: + case P_GT: + case P_LT: + case P_NEQ: + { + single_port_op(); + break; + } + case P_RANGE: + { + port_range(); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_8); + } else { + throw; + } + } +} + +void PIXCfgParser::established() { + + try { // for error handling + match(ESTABLISHED); + if ( inputState->guessing==0 ) { +#line 387 "pix.g" + + importer->established = true; + *dbg << "established "; + +#line 1470 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_7); + } else { + throw; + } + } +} + +void PIXCfgParser::single_port_op() { + + try { // for error handling + { + switch ( LA(1)) { + case P_EQ: + { + match(P_EQ); + break; + } + case P_GT: + { + match(P_GT); + break; + } + case P_LT: + { + match(P_LT); + break; + } + case P_NEQ: + { + match(P_NEQ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 311 "pix.g" + + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + +#line 1520 "PIXCfgParser.cpp" + } + port_spec(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_8); + } else { + throw; + } + } +} + +void PIXCfgParser::port_range() { + + try { // for error handling + match(P_RANGE); + if ( inputState->guessing==0 ) { +#line 319 "pix.g" + + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + +#line 1544 "PIXCfgParser.cpp" + } + port_spec(); + port_spec(); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_8); + } else { + throw; + } + } +} + +void PIXCfgParser::port_spec() { + + try { // for error handling + { + switch ( LA(1)) { + case WORD: + { + match(WORD); + break; + } + case INT_CONST: + { + match(INT_CONST); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 327 "pix.g" + + importer->tmp_port_spec += (std::string(" ") + LT(0)->getText()); + *dbg << LT(0)->getText() << " "; + +#line 1586 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_9); + } else { + throw; + } + } +} + +void PIXCfgParser::hostaddr_std() { + ANTLR_USE_NAMESPACE(antlr)RefToken h = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken m = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + if ((LA(1) == IPV4) && (LA(2) == ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE)) { + { + h = LT(1); + match(IPV4); + } + if ( inputState->guessing==0 ) { +#line 358 "pix.g" + + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + +#line 1617 "PIXCfgParser.cpp" + } + } + else if ((LA(1) == IPV4) && (LA(2) == IPV4)) { + { + a = LT(1); + match(IPV4); + m = LT(1); + match(IPV4); + } + if ( inputState->guessing==0 ) { +#line 365 "pix.g" + + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + +#line 1634 "PIXCfgParser.cpp" + } + } + else if ((LA(1) == ANY)) { + match(ANY); + if ( inputState->guessing==0 ) { +#line 372 "pix.g" + + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + +#line 1646 "PIXCfgParser.cpp" + } + } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } +} + +void PIXCfgParser::nameif() { + ANTLR_USE_NAMESPACE(antlr)RefToken in = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(NAMEIF); + in = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 429 "pix.g" + + importer->addInterfaceLabel( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE LABEL: " << in->getText() << std::endl; + +#line 1678 "PIXCfgParser.cpp" + } + match(NEWLINE); + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } +} + +void PIXCfgParser::intf_address() { + ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken m = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken s = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(ADDRESS); + a = LT(1); + match(IPV4); + m = LT(1); + match(IPV4); + { + switch ( LA(1)) { + case SECONDARY: + { + s = LT(1); + match(SECONDARY); + break; + } + case NEWLINE: + { + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename()); + } + } + } + if ( inputState->guessing==0 ) { +#line 502 "pix.g" + + importer->addInterfaceAddress(a->getText(), m->getText()); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE ADDRESS: " << a->getText() + << "/" << m->getText() << " "; + if (s) + { + *dbg << s->getText(); + } + *dbg << std::endl; + +#line 1734 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } +} + +void PIXCfgParser::switchport() { + ANTLR_USE_NAMESPACE(antlr)RefToken vlan_num = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(SWITCHPORT); + match(ACCESS); + match(VLAN); + vlan_num = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 516 "pix.g" + + +#line 1760 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_2); + } else { + throw; + } + } +} + +void PIXCfgParser::access_group_by_name() { + ANTLR_USE_NAMESPACE(antlr)RefToken acln = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken dir = ANTLR_USE_NAMESPACE(antlr)nullToken; + ANTLR_USE_NAMESPACE(antlr)RefToken intf_label = ANTLR_USE_NAMESPACE(antlr)nullToken; + + try { // for error handling + match(ACCESS_GROUP); + acln = LT(1); + match(WORD); + dir = LT(1); + match(WORD); + match(INTRFACE); + intf_label = LT(1); + match(WORD); + if ( inputState->guessing==0 ) { +#line 523 "pix.g" + + importer->setInterfaceAndDirectionForRuleSet( + acln->getText(), + intf_label->getText(), + dir->getText() ); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE: ACL '" << acln->getText() << "'" + << " " << intf_label->getText() + << " " << dir->getText() << std::endl; + +#line 1799 "PIXCfgParser.cpp" + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) { + if( inputState->guessing == 0 ) { + reportError(ex); + recover(ex,_tokenSet_0); + } else { + throw; + } + } +} + +void PIXCfgParser::initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& ) +{ +} +const char* PIXCfgParser::tokenNames[] = { + "<0>", + "EOF", + "<2>", + "NULL_TREE_LOOKAHEAD", + "NEWLINE", + "\"ip\"", + "\"quit\"", + "\"community-list\"", + "WORD", + "\"certificate\"", + "\"PIX\"", + "\"ASA\"", + "\"Version\"", + "NUMBER", + "\"hostname\"", + "STRING", + "\"access-list\"", + "INT_CONST", + "\"permit\"", + "\"deny\"", + "\"icmp\"", + "\"tcp\"", + "\"udp\"", + "\"eq\"", + "\"gt\"", + "\"lt\"", + "\"neq\"", + "\"range\"", + "\"host\"", + "IPV4", + "\"any\"", + "\"log\"", + "\"log-input\"", + "\"established\"", + "\"fragments\"", + "\"time-range\"", + "\"controller\"", + "\"interface\"", + "\"nameif\"", + "\"description\"", + "\"remark\"", + "\"shutdown\"", + "\"address\"", + "\"secondary\"", + "\"switchport\"", + "\"access\"", + "\"vlan\"", + "\"access-group\"", + "\"exit\"", + "LINE_COMMENT", + "COLON_COMMENT", + "\"extended\"", + "\"standard\"", + "Whitespace", + "HEX_CONST", + "NEG_INT_CONST", + "DIGIT", + "HEXDIGIT", + "PIPE_CHAR", + "NUMBER_SIGN", + "PERCENT", + "AMPERSAND", + "APOSTROPHE", + "OPENING_PAREN", + "CLOSING_PAREN", + "STAR", + "PLUS", + "COMMA", + "MINUS", + "DOT", + "SLASH", + "COLON", + "SEMICOLON", + "LESS_THAN", + "EQUALS", + "GREATER_THAN", + "QUESTION", + "COMMERCIAL_AT", + "OPENING_SQUARE", + "CLOSING_SQUARE", + "CARET", + "UNDERLINE", + "OPENING_BRACE", + "CLOSING_BRACE", + "TILDE", + 0 +}; + +const unsigned long PIXCfgParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL }; +// EOF +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_0(_tokenSet_0_data_,4); +const unsigned long PIXCfgParser::_tokenSet_1_data_[] = { 85874UL, 459440UL, 0UL, 0UL }; +// EOF NEWLINE "ip" "quit" WORD "certificate" "PIX" "ASA" "hostname" "access-list" +// "controller" "interface" "description" "shutdown" "exit" LINE_COMMENT +// COLON_COMMENT +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_1(_tokenSet_1_data_,4); +const unsigned long PIXCfgParser::_tokenSet_2_data_[] = { 16UL, 0UL, 0UL, 0UL }; +// NEWLINE +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_2(_tokenSet_2_data_,4); +const unsigned long PIXCfgParser::_tokenSet_3_data_[] = { 1879048192UL, 0UL, 0UL, 0UL }; +// "host" IPV4 "any" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_3(_tokenSet_3_data_,4); +const unsigned long PIXCfgParser::_tokenSet_4_data_[] = { 4286710032UL, 15UL, 0UL, 0UL }; +// NEWLINE WORD INT_CONST "eq" "gt" "lt" "neq" "range" "host" IPV4 "any" +// "log" "log-input" "established" "fragments" "time-range" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_4(_tokenSet_4_data_,4); +const unsigned long PIXCfgParser::_tokenSet_5_data_[] = { 2147483664UL, 5UL, 0UL, 0UL }; +// NEWLINE "log" "log-input" "fragments" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_5(_tokenSet_5_data_,4); +const unsigned long PIXCfgParser::_tokenSet_6_data_[] = { 2147483664UL, 1UL, 0UL, 0UL }; +// NEWLINE "log" "log-input" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_6(_tokenSet_6_data_,4); +const unsigned long PIXCfgParser::_tokenSet_7_data_[] = { 2147483664UL, 13UL, 0UL, 0UL }; +// NEWLINE "log" "log-input" "fragments" "time-range" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_7(_tokenSet_7_data_,4); +const unsigned long PIXCfgParser::_tokenSet_8_data_[] = { 4026531856UL, 15UL, 0UL, 0UL }; +// NEWLINE "host" IPV4 "any" "log" "log-input" "established" "fragments" +// "time-range" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_8(_tokenSet_8_data_,4); +const unsigned long PIXCfgParser::_tokenSet_9_data_[] = { 4026663184UL, 15UL, 0UL, 0UL }; +// NEWLINE WORD INT_CONST "host" IPV4 "any" "log" "log-input" "established" +// "fragments" "time-range" +const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_9(_tokenSet_9_data_,4); + + diff --git a/src/parsers/PIXCfgParser.hpp b/src/parsers/PIXCfgParser.hpp new file mode 100644 index 000000000..a06e5bda5 --- /dev/null +++ b/src/parsers/PIXCfgParser.hpp @@ -0,0 +1,145 @@ +#ifndef INC_PIXCfgParser_hpp_ +#define INC_PIXCfgParser_hpp_ + +#line 25 "pix.g" + + // gets inserted before antlr generated includes in the header + // file + +#line 10 "PIXCfgParser.hpp" +#include +/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgParser.hpp"$ */ +#include +#include +#include "PIXCfgParserTokenTypes.hpp" +#include + +#line 30 "pix.g" + + // gets inserted after antlr generated includes in the header file + // outside any generated namespace specifications + +#include + +class PIXImporter; + +#line 27 "PIXCfgParser.hpp" +#line 56 "pix.g" + + // gets inserted after generated namespace specifications in the + // header file. But outside the generated class. + +#line 33 "PIXCfgParser.hpp" +class CUSTOM_API PIXCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PIXCfgParserTokenTypes +{ +#line 73 "pix.g" + +// additional methods and members + + public: + + std::ostream *dbg; + PIXImporter *importer; +#line 37 "PIXCfgParser.hpp" +public: + void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory ); +protected: + PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k); +public: + PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf); +protected: + PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer, int k); +public: + PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenStream& lexer); + PIXCfgParser(const ANTLR_USE_NAMESPACE(antlr)ParserSharedInputState& state); + int getNumTokens() const + { + return PIXCfgParser::NUM_TOKENS; + } + const char* getTokenName( int type ) const + { + if( type > getNumTokens() ) return 0; + return PIXCfgParser::tokenNames[type]; + } + const char* const* getTokenNames() const + { + return PIXCfgParser::tokenNames; + } + public: void cfgfile(); + public: void comment(); + public: void version(); + public: void hostname(); + public: void ip_commands(); + public: void intrface(); + public: void controller(); + public: void access_list_commands(); + public: void exit(); + public: void description(); + public: void shutdown(); + public: void certificate(); + public: void quit(); + public: void unknown_command(); + public: void ip_access_list_ext(); + public: void interface_known_commands(); + public: void community_list_command(); + public: void permit_ext(); + public: void deny_ext(); + public: void remark(); + public: void rule_ext(); + public: void ip_protocols(); + public: void hostaddr_ext(); + public: void time_range(); + public: void fragments(); + public: void log(); + public: void icmp_spec(); + public: void xoperator(); + public: void established(); + public: void single_port_op(); + public: void port_range(); + public: void port_spec(); + public: void hostaddr_std(); + public: void nameif(); + public: void intf_address(); + public: void switchport(); + public: void access_group_by_name(); +public: + ANTLR_USE_NAMESPACE(antlr)RefAST getAST() + { + return returnAST; + } + +protected: + ANTLR_USE_NAMESPACE(antlr)RefAST returnAST; +private: + static const char* tokenNames[]; +#ifndef NO_STATIC_CONSTS + static const int NUM_TOKENS = 85; +#else + enum { + NUM_TOKENS = 85 + }; +#endif + + static const unsigned long _tokenSet_0_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_0; + static const unsigned long _tokenSet_1_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_1; + static const unsigned long _tokenSet_2_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_2; + static const unsigned long _tokenSet_3_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_3; + static const unsigned long _tokenSet_4_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_4; + static const unsigned long _tokenSet_5_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_5; + static const unsigned long _tokenSet_6_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_6; + static const unsigned long _tokenSet_7_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_7; + static const unsigned long _tokenSet_8_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_8; + static const unsigned long _tokenSet_9_data_[]; + static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_9; +}; + +#endif /*INC_PIXCfgParser_hpp_*/ diff --git a/src/parsers/PIXCfgParser.txt b/src/parsers/PIXCfgParser.txt new file mode 100644 index 000000000..13b0d56b9 --- /dev/null +++ b/src/parsers/PIXCfgParser.txt @@ -0,0 +1,2144 @@ +ANTLR-generated file resulting from grammar pix.g +Diagnostic output + +Terence Parr, MageLang Institute +with John Lilley, Empathy Software +ANTLR Version 2.7.7 (20090306); 1989-2005 + +*** Header Action. +This action will appear at the top of all generated files. + + // gets inserted after generated namespace specifications in the + // header file. But outside the generated class. + +*** End of Header Action + + +*** Parser Preamble Action. +This action will appear before the declaration of your parser class: + +*** End of Parser Preamble Action + +*** Your parser class is called 'PIXCfgParser' and is a subclass of 'LLkParser'. + +*** User-defined parser class members: +These are the member declarations that you defined for your class: + + // additional methods and members + + public: + + std::ostream *dbg; + PIXImporter *importer; + +*** End of user-defined parser class members + +*** Parser rules: + + + *** Parser Rule: cfgfile + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { + NEWLINE, "ip", "quit", WORD, "certificate", + "PIX", "ASA", "hostname", "access-list", "controller", "interface", + "description", "shutdown", "exit", LINE_COMMENT + } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { + NEWLINE, "ip", "quit", WORD, "certificate", + "PIX", "ASA", "hostname", "access-list", "controller", "interface", + "description", "shutdown", "exit", LINE_COMMENT + } + is matched. + Start ONE-OR-MORE (...)+ block: + Start of an alternative block. + The lookahead set for this block is: + { + NEWLINE, "ip", "quit", WORD, "certificate", + "PIX", "ASA", "hostname", "access-list", "controller", "interface", + "description", "shutdown", "exit", LINE_COMMENT + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { LINE_COMMENT } + is matched. + Rule Reference: comment + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "PIX", "ASA" } + is matched. + Rule Reference: version + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "hostname" } + is matched. + Rule Reference: hostname + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { "ip" } + is matched. + Rule Reference: ip_commands + + Otherwise, Alternate(5) will be taken IF: + The lookahead set: + { "interface" } + is matched. + Rule Reference: intrface + + Otherwise, Alternate(6) will be taken IF: + The lookahead set: + { "controller" } + is matched. + Rule Reference: controller + + Otherwise, Alternate(7) will be taken IF: + The lookahead set: + { "access-list" } + is matched. + Rule Reference: access_list_commands + + Otherwise, Alternate(8) will be taken IF: + The lookahead set: + { "exit" } + is matched. + Rule Reference: exit + + Otherwise, Alternate(9) will be taken IF: + The lookahead set: + { "description" } + is matched. + Rule Reference: description + + Otherwise, Alternate(10) will be taken IF: + The lookahead set: + { "shutdown" } + is matched. + Rule Reference: shutdown + + Otherwise, Alternate(11) will be taken IF: + The lookahead set: + { "certificate" } + is matched. + Rule Reference: certificate + + Otherwise, Alternate(12) will be taken IF: + The lookahead set: + { "quit" } + is matched. + Rule Reference: quit + + Otherwise, Alternate(13) will be taken IF: + The lookahead set: + { WORD } + is matched. + Rule Reference: unknown_command + + Otherwise, Alternate(14) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + Match token NEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + End ONE-OR-MORE block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {EOF } + *** End Parser Rule: cfgfile + + + *** Parser Rule: comment + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { LINE_COMMENT } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { LINE_COMMENT } + is matched. + Match token LINE_COMMENT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: comment + + + *** Parser Rule: version + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "PIX", "ASA" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "PIX", "ASA" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "PIX", "ASA" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "PIX" } + is matched. + Match token PIX_WORD + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "ASA" } + is matched. + Match token ASA_WORD + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Match token VERSION_WORD + Match token TWO_NUMBER_VERSION + ACTION: + importer->setDiscoveredVersion(LT(0)->getText()); + *dbg << "VERSION " << LT(0)->getText() << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: version + + + *** Parser Rule: hostname + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "hostname" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "hostname" } + is matched. + Match token HOSTNAME + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { WORD, STRING } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { STRING } + is matched. + Match token STRING + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { WORD } + is matched. + Match token WORD + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->setHostName( LT(0)->getText() ); + *dbg << "HOSTNAME " + << "LT0=" << LT(0)->getText() + << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: hostname + + + *** Parser Rule: ip_commands + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "ip" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "ip" } + is matched. + Match token IP + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + "community-list", WORD, "access-list", "shutdown", "address", + "switchport" + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "access-list" } + is matched. + Rule Reference: ip_access_list_ext + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "shutdown", "address", "switchport" } + is matched. + Rule Reference: interface_known_commands + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "community-list" } + is matched. + Rule Reference: community_list_command + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { WORD } + is matched. + Rule Reference: unknown_command + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: ip_commands + + + *** Parser Rule: intrface + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "interface" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "interface" } + is matched. + Match token INTRFACE + Match token WORD, label=in + ACTION: + importer->newInterface( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE: " << in->getText() << std::endl; + + Match token NEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: intrface + + + *** Parser Rule: controller + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "controller" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "controller" } + is matched. + Match token CONTROLLER + ACTION: + importer->clearCurrentInterface(); + consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: controller + + + *** Parser Rule: access_list_commands + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "access-list" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "access-list" } + is matched. + Match token ACCESS_LIST + Match token INT_CONST, label=acl_num + ACTION: + importer->newUnidirRuleSet( std::string("acl_") + acl_num->getText() ); + *dbg << acl_num->getLine() << ":" + << " ACL #" << acl_num->getText() << " "; + + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "permit", "deny", "remark" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "permit" } + is matched. + Rule Reference: permit_ext + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "deny" } + is matched. + Rule Reference: deny_ext + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "remark" } + is matched. + Rule Reference: remark + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: access_list_commands + + + *** Parser Rule: exit + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "exit" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "exit" } + is matched. + Match token EXIT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: exit + + + *** Parser Rule: description + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "description" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "description" } + is matched. + Match token DESCRIPTION + ACTION: + *dbg << LT(1)->getLine() << ":"; + std::string descr; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + descr += LT(1)->getText() + " "; + consume(); + } + importer->addInterfaceComment( descr ); + *dbg << " DESCRIPTION " << descr << std::endl; + //consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: description + + + *** Parser Rule: shutdown + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "shutdown" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "shutdown" } + is matched. + Match token SHUTDOWN + ACTION: + *dbg<< LT(1)->getLine() << ":" + << " INTERFACE SHUTDOWN " << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: shutdown + + + *** Parser Rule: certificate + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "certificate" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "certificate" } + is matched. + Match token CERTIFICATE + Match token WORD + ACTION: + consumeUntil(NEWLINE); + consumeUntil(QUIT); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: certificate + + + *** Parser Rule: quit + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "quit" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "quit" } + is matched. + Match token QUIT + ACTION: + consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: quit + + + *** Parser Rule: unknown_command + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { WORD } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { WORD } + is matched. + Match token WORD + ACTION: + consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: unknown_command + + + *** Parser Rule: ip_access_list_ext + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "access-list" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "access-list" } + is matched. + Match token ACCESS_LIST + Match token WORD, label=name + ACTION: + importer->newUnidirRuleSet( name->getText() ); + *dbg << name->getLine() << ":" + << " ACL ext " << name->getText() << std::endl; + + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "permit", "deny", "remark", LINE_COMMENT } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "permit" } + is matched. + Rule Reference: permit_ext + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "deny" } + is matched. + Rule Reference: deny_ext + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { LINE_COMMENT } + is matched. + Rule Reference: comment + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { "remark" } + is matched. + Rule Reference: remark + + Otherwise, Alternate(5) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + Match token NEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + *dbg << LT(0)->getLine() << ":" + << " ACL line end" << std::endl << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: ip_access_list_ext + + + *** Parser Rule: interface_known_commands + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "shutdown", "address", "switchport" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "shutdown", "address", "switchport" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "shutdown", "address", "switchport" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "address" } + is matched. + Rule Reference: intf_address + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "switchport" } + is matched. + Rule Reference: switchport + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "shutdown" } + is matched. + Rule Reference: shutdown + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Match token NEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: interface_known_commands + + + *** Parser Rule: community_list_command + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "community-list" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "community-list" } + is matched. + Match token COMMUNITY_LIST + ACTION: + consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: community_list_command + + + *** Parser Rule: permit_ext + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "permit" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "permit" } + is matched. + Match token PERMIT + ACTION: + importer->newPolicyRule(); + importer->action = "permit"; + *dbg << LT(1)->getLine() << ":" << " permit "; + + Rule Reference: rule_ext + Match token NEWLINE + ACTION: + importer->pushRule(); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: permit_ext + + + *** Parser Rule: deny_ext + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "deny" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "deny" } + is matched. + Match token DENY + ACTION: + importer->newPolicyRule(); + importer->action = "deny"; + *dbg << LT(1)->getLine() << ":" << " deny "; + + Rule Reference: rule_ext + Match token NEWLINE + ACTION: + importer->pushRule(); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: deny_ext + + + *** Parser Rule: remark + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "remark" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "remark" } + is matched. + Match token REMARK + ACTION: + *dbg << LT(1)->getLine() << ":"; + std::string rem; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + rem += LT(1)->getText() + " "; + consume(); + } + importer->addRuleComment( rem ); + *dbg << " REMARK " << rem << std::endl; + //consumeUntil(NEWLINE); + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + EOF, NEWLINE, "ip", "quit", WORD, + "certificate", "PIX", "ASA", "hostname", "access-list", "controller", + "interface", "description", "shutdown", "exit", LINE_COMMENT + } + *** End Parser Rule: remark + + + *** Parser Rule: rule_ext + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "ip", WORD, "icmp", "tcp", "udp" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "ip", WORD, "icmp", "tcp", "udp" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "ip", WORD, "icmp", "tcp", "udp" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "ip", WORD } + is matched. + Rule Reference: ip_protocols + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToSrc(); *dbg << "(src) "; + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToDst(); *dbg << "(dst) "; + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments", "time-range" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "time-range" } + is matched. + Rule Reference: time_range + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input", "fragments" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "fragments" } + is matched. + Rule Reference: fragments + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "log", "log-input" } + is matched. + Rule Reference: log + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "icmp" } + is matched. + Match token ICMP + ACTION: + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToSrc(); *dbg << "(src) "; + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToDst(); *dbg << "(dst) "; + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + NEWLINE, WORD, INT_CONST, "log", "log-input", + "fragments", "time-range" + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { WORD, INT_CONST } + is matched. + Rule Reference: icmp_spec + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input", "fragments", "time-range" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments", "time-range" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "time-range" } + is matched. + Rule Reference: time_range + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input", "fragments" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "fragments" } + is matched. + Rule Reference: fragments + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "log", "log-input" } + is matched. + Rule Reference: log + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "tcp", "udp" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "tcp", "udp" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "tcp" } + is matched. + Match token TCP + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "udp" } + is matched. + Match token UDP + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToSrc(); *dbg << "(src) "; + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + "eq", "gt", "lt", "neq", "range", + "host", IPV4, "any" + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "eq", "gt", "lt", "neq", "range" } + is matched. + Rule Reference: xoperator + ACTION: importer->SaveTmpPortToSrc(); + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "host", IPV4, "any" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Rule Reference: hostaddr_ext + ACTION: importer->SaveTmpAddrToDst(); *dbg << "(dst) "; + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + NEWLINE, "eq", "gt", "lt", "neq", + "range", "log", "log-input", "established", "fragments", "time-range" + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "eq", "gt", "lt", "neq", "range" } + is matched. + Rule Reference: xoperator + ACTION: importer->SaveTmpPortToDst(); + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { + NEWLINE, "log", "log-input", "established", "fragments", + "time-range" + } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { + NEWLINE, "log", "log-input", "established", "fragments", + "time-range" + } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "established" } + is matched. + Rule Reference: established + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input", "fragments", "time-range" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments", "time-range" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "time-range" } + is matched. + Rule Reference: time_range + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input", "fragments" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input", "fragments" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "fragments" } + is matched. + Rule Reference: fragments + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE, "log", "log-input" } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "log", "log-input" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "log", "log-input" } + is matched. + Rule Reference: log + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + *dbg << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE } + *** End Parser Rule: rule_ext + + + *** Parser Rule: ip_protocols + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "ip", WORD } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "ip", WORD } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "ip", WORD } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "ip" } + is matched. + Match token IP + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { WORD } + is matched. + Match token WORD + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {"host", IPV4, "any" } + *** End Parser Rule: ip_protocols + + + *** Parser Rule: hostaddr_ext + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "host", IPV4, "any" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "host" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "host" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "host" } + is matched. + Match token HOST + Match token IPV4, label=h + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { IPV4 } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { IPV4 } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { IPV4 } + is matched. + Match token IPV4, label=a + Match token IPV4, label=m + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "any" } + is matched. + Match token ANY + ACTION: + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + NEWLINE, WORD, INT_CONST, "eq", "gt", + "lt", "neq", "range", "host", IPV4, "any", + "log", "log-input", "established", "fragments", "time-range" + } + *** End Parser Rule: hostaddr_ext + + + *** Parser Rule: time_range + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "time-range" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "time-range" } + is matched. + Match token TIME_RANGE + Match token WORD, label=tr_name + ACTION: + importer->time_range_name = tr_name->getText(); + *dbg << "time_range " << tr_name->getText() << " "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE, "log", "log-input", "fragments" } + *** End Parser Rule: time_range + + + *** Parser Rule: fragments + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "fragments" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "fragments" } + is matched. + Match token FRAGMENTS + ACTION: + importer->fragments = true; + *dbg << "fragments "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE, "log", "log-input" } + *** End Parser Rule: fragments + + + *** Parser Rule: log + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "log", "log-input" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "log", "log-input" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "log", "log-input" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "log" } + is matched. + Match token LOG + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "log-input" } + is matched. + Match token LOG_INPUT + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->logging = true; + *dbg << "logging "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE } + *** End Parser Rule: log + + + *** Parser Rule: icmp_spec + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { WORD, INT_CONST } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { WORD, INT_CONST } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { WORD, INT_CONST } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { INT_CONST } + is matched, AND the syntactic predicate: + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { INT_CONST } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { INT_CONST } + is matched. + Match token INT_CONST + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { INT_CONST } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { INT_CONST } + is matched. + Match token INT_CONST, label=icmp_type + Match token INT_CONST, label=icmp_code + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: + importer->icmp_type = icmp_type->getText(); + importer->icmp_code = icmp_code->getText(); + importer->icmp_spec = ""; + *dbg << icmp_type->getText() << " " + << icmp_code->getText() << " "; + + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { WORD } + is matched. + Match token WORD, label=icmp_word + ACTION: + importer->icmp_spec = icmp_word->getText(); + *dbg << icmp_word->getText() << " "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE, "log", "log-input", "fragments", "time-range" } + *** End Parser Rule: icmp_spec + + + *** Parser Rule: xoperator + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "eq", "gt", "lt", "neq", "range" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "eq", "gt", "lt", "neq" } + is matched. + Rule Reference: single_port_op + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "range" } + is matched. + Rule Reference: port_range + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + NEWLINE, "host", IPV4, "any", "log", + "log-input", "established", "fragments", "time-range" + } + *** End Parser Rule: xoperator + + + *** Parser Rule: established + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "established" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "established" } + is matched. + Match token ESTABLISHED + ACTION: + importer->established = true; + *dbg << "established "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE, "log", "log-input", "fragments", "time-range" } + *** End Parser Rule: established + + + *** Parser Rule: single_port_op + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "eq", "gt", "lt", "neq" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "eq", "gt", "lt", "neq" } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { "eq", "gt", "lt", "neq" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "eq" } + is matched. + Match token P_EQ + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { "gt" } + is matched. + Match token P_GT + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "lt" } + is matched. + Match token P_LT + + Otherwise, Alternate(4) will be taken IF: + The lookahead set: + { "neq" } + is matched. + Match token P_NEQ + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + + Rule Reference: port_spec + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + NEWLINE, "host", IPV4, "any", "log", + "log-input", "established", "fragments", "time-range" + } + *** End Parser Rule: single_port_op + + + *** Parser Rule: port_range + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "range" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "range" } + is matched. + Match token P_RANGE + ACTION: + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + + Rule Reference: port_spec + Rule Reference: port_spec + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + NEWLINE, "host", IPV4, "any", "log", + "log-input", "established", "fragments", "time-range" + } + *** End Parser Rule: port_range + + + *** Parser Rule: port_spec + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { WORD, INT_CONST } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { WORD, INT_CONST } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { WORD, INT_CONST } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { WORD } + is matched. + Match token WORD + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { INT_CONST } + is matched. + Match token INT_CONST + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->tmp_port_spec += (std::string(" ") + LT(0)->getText()); + *dbg << LT(0)->getText() << " "; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: { + NEWLINE, WORD, INT_CONST, "host", IPV4, + "any", "log", "log-input", "established", "fragments", "time-range" + } + *** End Parser Rule: port_spec + + + *** Parser Rule: hostaddr_std + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + k==1: {IPV4, "any" } + k==2: {EOF, IPV4 } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + k==1: {IPV4 } + k==2: {EOF } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { IPV4 } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { IPV4 } + is matched. + Match token IPV4, label=h + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + k==1: {IPV4 } + k==2: {IPV4 } + is matched. + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { IPV4 } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { IPV4 } + is matched. + Match token IPV4, label=a + Match token IPV4, label=m + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + ACTION: + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + + + Otherwise, Alternate(3) will be taken IF: + The lookahead set: + { "any" } + is matched. + Match token ANY + ACTION: + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {EOF } + *** End Parser Rule: hostaddr_std + + + *** Parser Rule: nameif + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "nameif" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "nameif" } + is matched. + Match token NAMEIF + Match token WORD, label=in + ACTION: + importer->addInterfaceLabel( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE LABEL: " << in->getText() << std::endl; + + Match token NEWLINE + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {EOF } + *** End Parser Rule: nameif + + + *** Parser Rule: intf_address + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "address" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "address" } + is matched. + Match token ADDRESS + Match token IPV4, label=a + Match token IPV4, label=m + Start of alternative block. + Start of an alternative block. + The lookahead set for this block is: + { NEWLINE, "secondary" } + This block has multiple alternatives: + + Alternate(1) will be taken IF: + The lookahead set: + { "secondary" } + is matched. + Match token SECONDARY, label=s + + Otherwise, Alternate(2) will be taken IF: + The lookahead set: + { NEWLINE } + is matched. + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternatives + End of alternative block. + ACTION: + importer->addInterfaceAddress(a->getText(), m->getText()); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE ADDRESS: " << a->getText() + << "/" << m->getText() << " "; + if (s) + { + *dbg << s->getText(); + } + *dbg << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE } + *** End Parser Rule: intf_address + + + *** Parser Rule: switchport + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "switchport" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "switchport" } + is matched. + Match token SWITCHPORT + Match token ACCESS + Match token VLAN + Match token WORD, label=vlan_num + ACTION: + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {NEWLINE } + *** End Parser Rule: switchport + + + *** Parser Rule: access_group_by_name + Access: public + Return value: none + Start of an alternative block. + The lookahead set for this block is: + { "access-group" } + This block has a single alternative + + Alternate(1) will be taken IF: + The lookahead set: + { "access-group" } + is matched. + Match token ACCESS_GROUP + Match token WORD, label=acln + Match token WORD, label=dir + Match token INTRFACE + Match token WORD, label=intf_label + ACTION: + importer->setInterfaceAndDirectionForRuleSet( + acln->getText(), + intf_label->getText(), + dir->getText() ); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE: ACL '" << acln->getText() << "'" + << " " << intf_label->getText() + << " " << dir->getText() << std::endl; + + + OTHERWISE, a NoViableAlt exception will be thrown + + End of alternative block. + Default error-handling will be generated, which catches all + parser exceptions and consumes tokens until the follow-set is seen. + The follow set for this rule is: + k==1: {EOF } + *** End Parser Rule: access_group_by_name + +*** End of parser rules + +*** End of parser diff --git a/src/parsers/PIXCfgParserTokenTypes.hpp b/src/parsers/PIXCfgParserTokenTypes.hpp new file mode 100644 index 000000000..2ae527315 --- /dev/null +++ b/src/parsers/PIXCfgParserTokenTypes.hpp @@ -0,0 +1,101 @@ +#ifndef INC_PIXCfgParserTokenTypes_hpp_ +#define INC_PIXCfgParserTokenTypes_hpp_ + +/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgParserTokenTypes.hpp"$ */ + +#ifndef CUSTOM_API +# define CUSTOM_API +#endif + +#ifdef __cplusplus +struct CUSTOM_API PIXCfgParserTokenTypes { +#endif + enum { + EOF_ = 1, + NEWLINE = 4, + IP = 5, + QUIT = 6, + COMMUNITY_LIST = 7, + WORD = 8, + CERTIFICATE = 9, + PIX_WORD = 10, + ASA_WORD = 11, + VERSION_WORD = 12, + NUMBER = 13, + HOSTNAME = 14, + STRING = 15, + ACCESS_LIST = 16, + INT_CONST = 17, + PERMIT = 18, + DENY = 19, + ICMP = 20, + TCP = 21, + UDP = 22, + P_EQ = 23, + P_GT = 24, + P_LT = 25, + P_NEQ = 26, + P_RANGE = 27, + HOST = 28, + IPV4 = 29, + ANY = 30, + LOG = 31, + LOG_INPUT = 32, + ESTABLISHED = 33, + FRAGMENTS = 34, + TIME_RANGE = 35, + CONTROLLER = 36, + INTRFACE = 37, + NAMEIF = 38, + DESCRIPTION = 39, + REMARK = 40, + SHUTDOWN = 41, + ADDRESS = 42, + SECONDARY = 43, + SWITCHPORT = 44, + ACCESS = 45, + VLAN = 46, + ACCESS_GROUP = 47, + EXIT = 48, + LINE_COMMENT = 49, + COLON_COMMENT = 50, + EXTENDED = 51, + STANDARD = 52, + Whitespace = 53, + HEX_CONST = 54, + NEG_INT_CONST = 55, + DIGIT = 56, + HEXDIGIT = 57, + PIPE_CHAR = 58, + NUMBER_SIGN = 59, + PERCENT = 60, + AMPERSAND = 61, + APOSTROPHE = 62, + OPENING_PAREN = 63, + CLOSING_PAREN = 64, + STAR = 65, + PLUS = 66, + COMMA = 67, + MINUS = 68, + DOT = 69, + SLASH = 70, + COLON = 71, + SEMICOLON = 72, + LESS_THAN = 73, + EQUALS = 74, + GREATER_THAN = 75, + QUESTION = 76, + COMMERCIAL_AT = 77, + OPENING_SQUARE = 78, + CLOSING_SQUARE = 79, + CARET = 80, + UNDERLINE = 81, + OPENING_BRACE = 82, + CLOSING_BRACE = 83, + TILDE = 84, + NULL_TREE_LOOKAHEAD = 3 + }; +#ifdef __cplusplus +}; +#endif +#endif /*INC_PIXCfgParserTokenTypes_hpp_*/ diff --git a/src/parsers/PIXCfgParserTokenTypes.txt b/src/parsers/PIXCfgParserTokenTypes.txt new file mode 100644 index 000000000..90f570336 --- /dev/null +++ b/src/parsers/PIXCfgParserTokenTypes.txt @@ -0,0 +1,83 @@ +// $ANTLR 2.7.7 (20090306): pix.g -> PIXCfgParserTokenTypes.txt$ +PIXCfgParser // output token vocab name +NEWLINE=4 +IP="ip"=5 +QUIT="quit"=6 +COMMUNITY_LIST="community-list"=7 +WORD=8 +CERTIFICATE="certificate"=9 +PIX_WORD="PIX"=10 +ASA_WORD="ASA"=11 +VERSION_WORD="Version"=12 +NUMBER=13 +HOSTNAME="hostname"=14 +STRING=15 +ACCESS_LIST="access-list"=16 +INT_CONST=17 +PERMIT="permit"=18 +DENY="deny"=19 +ICMP="icmp"=20 +TCP="tcp"=21 +UDP="udp"=22 +P_EQ="eq"=23 +P_GT="gt"=24 +P_LT="lt"=25 +P_NEQ="neq"=26 +P_RANGE="range"=27 +HOST="host"=28 +IPV4=29 +ANY="any"=30 +LOG="log"=31 +LOG_INPUT="log-input"=32 +ESTABLISHED="established"=33 +FRAGMENTS="fragments"=34 +TIME_RANGE="time-range"=35 +CONTROLLER="controller"=36 +INTRFACE="interface"=37 +NAMEIF="nameif"=38 +DESCRIPTION="description"=39 +REMARK="remark"=40 +SHUTDOWN="shutdown"=41 +ADDRESS="address"=42 +SECONDARY="secondary"=43 +SWITCHPORT="switchport"=44 +ACCESS="access"=45 +VLAN="vlan"=46 +ACCESS_GROUP="access-group"=47 +EXIT="exit"=48 +LINE_COMMENT=49 +COLON_COMMENT=50 +EXTENDED="extended"=51 +STANDARD="standard"=52 +Whitespace=53 +HEX_CONST=54 +NEG_INT_CONST=55 +DIGIT=56 +HEXDIGIT=57 +PIPE_CHAR=58 +NUMBER_SIGN=59 +PERCENT=60 +AMPERSAND=61 +APOSTROPHE=62 +OPENING_PAREN=63 +CLOSING_PAREN=64 +STAR=65 +PLUS=66 +COMMA=67 +MINUS=68 +DOT=69 +SLASH=70 +COLON=71 +SEMICOLON=72 +LESS_THAN=73 +EQUALS=74 +GREATER_THAN=75 +QUESTION=76 +COMMERCIAL_AT=77 +OPENING_SQUARE=78 +CLOSING_SQUARE=79 +CARET=80 +UNDERLINE=81 +OPENING_BRACE=82 +CLOSING_BRACE=83 +TILDE=84 diff --git a/src/parsers/parsers.pro b/src/parsers/parsers.pro index f07fe4640..1871d340e 100644 --- a/src/parsers/parsers.pro +++ b/src/parsers/parsers.pro @@ -7,7 +7,9 @@ TEMPLATE = lib SOURCES = IOSCfgLexer.cpp \ IOSCfgParser.cpp \ IPTCfgLexer.cpp \ - IPTCfgParser.cpp + IPTCfgParser.cpp \ + PIXCfgLexer.cpp \ + PIXCfgParser.cpp HEADERS = ../../config.h \ IOSCfgLexer.hpp \ @@ -16,6 +18,9 @@ HEADERS = ../../config.h \ IPTCfgLexer.hpp \ IPTCfgParser.hpp \ IPTCfgParserTokenTypes.hpp \ + PIXCfgLexer.hpp \ + PIXCfgParser.hpp \ + PIXCfgParserTokenTypes.hpp \ CONFIG += staticlib diff --git a/src/parsers/pix.g b/src/parsers/pix.g new file mode 100644 index 000000000..299e6bf75 --- /dev/null +++ b/src/parsers/pix.g @@ -0,0 +1,721 @@ +/* + + Firewall Builder + + Copyright (C) 2011 NetCitadel, LLC + + Author: Vadim Kurland vadim@fwbuilder.org + + This program is free software which we release under the GNU General Public + License. You may redistribute and/or modify this program under the terms + of that license as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + To get a copy of the GNU General Public License, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +*/ + +header "pre_include_hpp" +{ + // gets inserted before antlr generated includes in the header + // file +} +header "post_include_hpp" +{ + // gets inserted after antlr generated includes in the header file + // outside any generated namespace specifications + +#include + +class PIXImporter; +} + +header "pre_include_cpp" +{ + // gets inserted before the antlr generated includes in the cpp + // file +} + +header "post_include_cpp" +{ + // gets inserted after the antlr generated includes in the cpp + // file +#include +#include + +#include "../libgui/PIXImporter.h" +} + +header +{ + // gets inserted after generated namespace specifications in the + // header file. But outside the generated class. +} + +options +{ + language="Cpp"; +} + + +class PIXCfgParser extends Parser; +options +{ + k = 2; +// defaultErrorHandler=false; +} +{ +// additional methods and members + + public: + + std::ostream *dbg; + PIXImporter *importer; +} + +cfgfile : + ( + comment + | + version + | + hostname + | + ip_commands + | + intrface + | + controller + | + access_list_commands + | + exit + | + description + | + shutdown + | + certificate + | + quit + | + unknown_command + | + NEWLINE + )+ + ; + +//**************************************************************** + +ip_commands : IP ( ip_access_list_ext | interface_known_commands | community_list_command | unknown_command ) + ; + +//**************************************************************** +quit : QUIT + { + consumeUntil(NEWLINE); + } + ; + +//**************************************************************** +community_list_command : COMMUNITY_LIST + { + consumeUntil(NEWLINE); + } + ; + +//**************************************************************** +unknown_command : WORD + { + consumeUntil(NEWLINE); + } + ; + +//**************************************************************** +certificate : CERTIFICATE WORD + { + consumeUntil(NEWLINE); + consumeUntil(QUIT); + } + ; + +//**************************************************************** +version : (PIX_WORD | ASA_WORD) VERSION_WORD NUMBER + { + importer->setDiscoveredVersion(LT(0)->getText()); + *dbg << "VERSION " << LT(0)->getText() << std::endl; + consumeUntil(NEWLINE); + } + ; + +//**************************************************************** +hostname : HOSTNAME ( STRING | WORD ) + { + importer->setHostName( LT(0)->getText() ); + *dbg << "HOSTNAME " + << "LT0=" << LT(0)->getText() + << std::endl; + } + ; + +//**************************************************************** +// note that permit_ext and deny_ext eat NEWLINE. This is necessary +// because the same parser rules are used for ip access-list commands, +// where they should work the same way as LINE_COMMENT which eats +// NEWLINE +// +access_list_commands : ACCESS_LIST acl_num:INT_CONST + { + importer->newUnidirRuleSet( std::string("acl_") + acl_num->getText() ); + *dbg << acl_num->getLine() << ":" + << " ACL #" << acl_num->getText() << " "; + } + ( + permit_ext + | + deny_ext + | + remark + ) + ; + +//**************************************************************** + +ip_access_list_ext : ACCESS_LIST name:WORD + { + importer->newUnidirRuleSet( name->getText() ); + *dbg << name->getLine() << ":" + << " ACL ext " << name->getText() << std::endl; + } + ( + permit_ext + | + deny_ext + | + comment + | + remark + | + NEWLINE + ) + { + *dbg << LT(0)->getLine() << ":" + << " ACL line end" << std::endl << std::endl; + } + ; + +//**************************************************************** +permit_ext: PERMIT + { + importer->newPolicyRule(); + importer->action = "permit"; + *dbg << LT(1)->getLine() << ":" << " permit "; + } + rule_ext NEWLINE + { + importer->pushRule(); + } + ; + +deny_ext: DENY + { + importer->newPolicyRule(); + importer->action = "deny"; + *dbg << LT(1)->getLine() << ":" << " deny "; + } + rule_ext NEWLINE + { + importer->pushRule(); + } + ; + +//**************************************************************** +// the difference between standard and extended acls should be in these rules +rule_ext : + ( + ip_protocols + hostaddr_ext { importer->SaveTmpAddrToSrc(); *dbg << "(src) "; } + hostaddr_ext { importer->SaveTmpAddrToDst(); *dbg << "(dst) "; } + (time_range)? + (fragments)? + (log)? + | + ICMP + { + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + } + hostaddr_ext { importer->SaveTmpAddrToSrc(); *dbg << "(src) "; } + hostaddr_ext { importer->SaveTmpAddrToDst(); *dbg << "(dst) "; } + (icmp_spec)? + (time_range)? + (fragments)? + (log)? + | + (TCP|UDP) + { + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + } + hostaddr_ext { importer->SaveTmpAddrToSrc(); *dbg << "(src) "; } + (xoperator { importer->SaveTmpPortToSrc(); } )? + hostaddr_ext { importer->SaveTmpAddrToDst(); *dbg << "(dst) "; } + (xoperator { importer->SaveTmpPortToDst(); } )? + (established)? + (time_range)? + (fragments)? + (log)? + ) + { + *dbg << std::endl; + } + ; + +//**************************************************************** +// ip_protocols : (IP | AHP | EIGRP | ESP | GRE | IGRP | IPINIP | NOS | OSPF | PCP | PIM ) +ip_protocols : (IP | WORD ) + { + importer->protocol = LT(0)->getText(); + *dbg << "protocol " << LT(0)->getText() << " "; + }; + +icmp_spec : + ( + (INT_CONST) => (icmp_type:INT_CONST icmp_code:INT_CONST) + { + importer->icmp_type = icmp_type->getText(); + importer->icmp_code = icmp_code->getText(); + importer->icmp_spec = ""; + *dbg << icmp_type->getText() << " " + << icmp_code->getText() << " "; + } + | + icmp_word:WORD + { + importer->icmp_spec = icmp_word->getText(); + *dbg << icmp_word->getText() << " "; + } + ) + ; + + +xoperator : single_port_op | port_range ; + +single_port_op : (P_EQ | P_GT | P_LT | P_NEQ ) + { + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + } + port_spec + ; + +port_range : P_RANGE + { + importer->tmp_port_op = LT(0)->getText(); + *dbg << LT(0)->getText() << " "; + } + port_spec port_spec + ; + +port_spec : (WORD|INT_CONST) + { + importer->tmp_port_spec += (std::string(" ") + LT(0)->getText()); + *dbg << LT(0)->getText() << " "; + } + ; + +hostaddr_ext : + (HOST h:IPV4) + { + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + } + | + (a:IPV4 m:IPV4) + { + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + } + | + ANY + { + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + } + ; + +hostaddr_std : + (h:IPV4) + { + importer->tmp_a = h->getText(); + importer->tmp_nm = "0.0.0.0"; + *dbg << h->getText() << "/0.0.0.0"; + } + | + (a:IPV4 m:IPV4) + { + importer->tmp_a = a->getText(); + importer->tmp_nm = m->getText(); + *dbg << a->getText() << "/" << m->getText(); + } + | + ANY + { + importer->tmp_a = "0.0.0.0"; + importer->tmp_nm = "0.0.0.0"; + *dbg << "0.0.0.0/0.0.0.0"; + } + ; + +log : (LOG | LOG_INPUT) + { + importer->logging = true; + *dbg << "logging "; + } + ; + +established : ESTABLISHED + { + importer->established = true; + *dbg << "established "; + } + ; + +fragments : FRAGMENTS + { + importer->fragments = true; + *dbg << "fragments "; + } + ; + +time_range : TIME_RANGE tr_name:WORD + { + importer->time_range_name = tr_name->getText(); + *dbg << "time_range " << tr_name->getText() << " "; + } + ; + + +//**************************************************************** + +controller : CONTROLLER + { + importer->clearCurrentInterface(); + consumeUntil(NEWLINE); + } + ; + +//**************************************************************** + +intrface : INTRFACE in:WORD + { + importer->newInterface( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE: " << in->getText() << std::endl; + } + NEWLINE + ; + +nameif : NAMEIF in:WORD + { + importer->addInterfaceLabel( in->getText() ); + *dbg << in->getLine() << ":" + << " INTRFACE LABEL: " << in->getText() << std::endl; + } + NEWLINE + ; + +// interface description +// Use it for comment +description : DESCRIPTION + { + *dbg << LT(1)->getLine() << ":"; + std::string descr; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + descr += LT(1)->getText() + " "; + consume(); + } + importer->addInterfaceComment( descr ); + *dbg << " DESCRIPTION " << descr << std::endl; + //consumeUntil(NEWLINE); + } + ; + +//**************************************************************** + +// remark. According to the Cisco docs, can only be used +// within access list +// Use it for the current rule comment +remark : REMARK + { + *dbg << LT(1)->getLine() << ":"; + std::string rem; + while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) + { + rem += LT(1)->getText() + " "; + consume(); + } + importer->addRuleComment( rem ); + *dbg << " REMARK " << rem << std::endl; + //consumeUntil(NEWLINE); + } + ; + +shutdown : SHUTDOWN + { + *dbg<< LT(1)->getLine() << ":" + << " INTERFACE SHUTDOWN " << std::endl; + } + ; + +interface_known_commands : + ( + intf_address + | + switchport + | + shutdown + ) NEWLINE ; + + +// need this because "ospf", "bgp" and others are a known tokens +// (needed for protocol and ports in access lists) and "ip ospf" and +// similar are legit interface commands + +// ignore_interface_commands : (BGP | OSPF | DHCP) +// { +// consumeUntil(NEWLINE); +// } +// ; + +intf_address : ADDRESS a:IPV4 m:IPV4 (s:SECONDARY)? + { + importer->addInterfaceAddress(a->getText(), m->getText()); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE ADDRESS: " << a->getText() + << "/" << m->getText() << " "; + if (s) + { + *dbg << s->getText(); + } + *dbg << std::endl; + } + ; + +switchport : SWITCHPORT ACCESS VLAN vlan_num:WORD + { + } + ; + +//**************************************************************** + +access_group_by_name : ACCESS_GROUP acln:WORD dir:WORD INTRFACE intf_label:WORD + { + importer->setInterfaceAndDirectionForRuleSet( + acln->getText(), + intf_label->getText(), + dir->getText() ); + *dbg << LT(1)->getLine() << ":" + << " INTRFACE: ACL '" << acln->getText() << "'" + << " " << intf_label->getText() + << " " << dir->getText() << std::endl; + } + ; + +//**************************************************************** + +exit: EXIT + ; + +comment : (LINE_COMMENT | COLON_COMMENT) ; + +// comment: COMMENT_START +// { +// *dbg << LT(1)->getLine() << ":"; +// std::string comm; +// while (LA(1) != ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE && LA(1) != NEWLINE) +// { +// comm += LT(1)->getText() + " "; +// consume(); +// } +// importer->addInterfaceComment( comm ); +// *dbg << " COMMENT " << comm << std::endl; +// } +// ; + + +//**************************************************************** + +class PIXCfgLexer extends Lexer; +options { + k = 10; + // ASCII only + charVocabulary = '\3'..'\377'; +} + + +tokens +{ + EXIT = "exit"; + QUIT = "quit"; + + HOSTNAME = "hostname"; + CERTIFICATE = "certificate"; + + INTRFACE = "interface"; + CONTROLLER = "controller"; + DESCRIPTION = "description"; + REMARK = "remark"; + SHUTDOWN = "shutdown"; + + VLAN = "vlan"; + SWITCHPORT = "switchport"; + ACCESS = "access"; + NAMEIF = "nameif"; + + ACCESS_LIST = "access-list"; + ACCESS_GROUP = "access-group"; + + ADDRESS = "address"; + SECONDARY = "secondary"; + + COMMUNITY_LIST = "community-list"; + + PERMIT = "permit"; + DENY = "deny"; + +// protocols for 'permit' and 'deny' commands + + IP = "ip"; + ICMP = "icmp"; + TCP = "tcp"; + UDP = "udp"; + +// AHP = "ahp"; +// EIGRP = "eigrp"; +// ESP = "esp"; +// GRE = "gre"; +// IGMP = "igmp"; +// IGRP = "igrp"; +// IPINIP = "ipinip"; +// NOS = "nos"; +// OSPF = "ospf"; +// PCP = "pcp"; +// PIM = "pim"; + + HOST = "host"; + ANY = "any"; + + P_EQ = "eq"; + P_GT = "gt"; + P_LT = "lt"; + P_NEQ = "neq"; + P_RANGE = "range"; + + LOG = "log"; + LOG_INPUT = "log-input"; + + ESTABLISHED = "established"; + FRAGMENTS = "fragments"; + TIME_RANGE = "time-range"; + + EXTENDED = "extended" ; + STANDARD = "standard" ; + + PIX_WORD = "PIX" ; + ASA_WORD = "ASA" ; + VERSION_WORD = "Version" ; +} + + +LINE_COMMENT : "!" (~('\r' | '\n'))* NEWLINE ; + +// This is for lines like these that appear at the top of "show run" +// : Saved +// : + +COLON_COMMENT : COLON (~('\r' | '\n'))* NEWLINE ; + +Whitespace : ( '\003'..'\010' | '\t' | '\013' | '\f' | '\016'.. '\037' | '\177'..'\377' | ' ' ) + { _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; } ; + + +//COMMENT_START : '!' ; + +NEWLINE : ( "\r\n" | '\r' | '\n' ) { newline(); } ; + +protected +INT_CONST:; + +protected +HEX_CONST:; + +protected +NEG_INT_CONST:; + +protected +DIGIT : '0'..'9' ; + +protected +HEXDIGIT : '0'..'9' | 'A'..'F' ; + +NUMBER : + ( + ( (DIGIT)+ DOT (DIGIT)+ DOT (DIGIT)+ )=> ( (DIGIT)+ DOT (DIGIT)+ DOT (DIGIT)+ DOT (DIGIT)+ ) + { _ttype = IPV4; } + | + ( (DIGIT)+ DOT (DIGIT)+ )=> ( (DIGIT)+ DOT (DIGIT)+ ) + | + ( DIGIT )+ { _ttype = INT_CONST; } + | + ( '0' 'x' ( HEXDIGIT )+ ) { _ttype = HEX_CONST; } + ) + ; + +WORD : ( 'a'..'z' | 'A'..'Z' | '$' ) ( '!'..'/' | '0'..'9' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | 'A'..'Z' | '\\' | '^' | '_' | '`' | 'a'..'z' )* + ; + +STRING : '"' (~'"')* '"'; + +PIPE_CHAR : '|'; +NUMBER_SIGN : '#' ; +// DOLLAR : '$' ; +PERCENT : '%' ; +AMPERSAND : '&' ; +APOSTROPHE : '\'' ; +OPENING_PAREN : '(' ; +CLOSING_PAREN : ')' ; +STAR : '*' ; +PLUS : '+' ; +COMMA : ',' ; +MINUS : '-' ; +DOT : '.' ; +SLASH : '/' ; + +COLON : ':' ; +SEMICOLON : ';' ; +LESS_THAN : '<' ; +EQUALS : '=' ; +GREATER_THAN : '>' ; +QUESTION : '?' ; +COMMERCIAL_AT : '@' ; + +OPENING_SQUARE : '[' ; +CLOSING_SQUARE : ']' ; +CARET : '^' ; +UNDERLINE : '_' ; + +OPENING_BRACE : '{' ; +CLOSING_BRACE : '}' ; +TILDE : '~' ; +