1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-21 18:57:14 +01:00

overloaded t error reporting functions in all grammars to make errors appear in the importer log

This commit is contained in:
Vadim Kurland 2011-03-21 19:56:34 -07:00
parent d4b79a1d35
commit 5a83ec15ff
23 changed files with 831 additions and 734 deletions

View File

@ -7,7 +7,7 @@ FWB_MICRO_VERSION=0
# build number is like "nano" version number. I am incrementing build
# number during development cycle
#
BUILD_NUM="3505"
BUILD_NUM="3506"
VERSION="$FWB_MAJOR_VERSION.$FWB_MINOR_VERSION.$FWB_MICRO_VERSION.$BUILD_NUM"

View File

@ -1,2 +1,2 @@
#define VERSION "4.2.0.3505"
#define VERSION "4.2.0.3506"
#define GENERATION "4.2"

View File

@ -3,7 +3,7 @@
%define name fwbuilder
%define version 4.2.0.3505
%define version 4.2.0.3506
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -4,6 +4,6 @@ Replaces: fwbuilder (<=4.1.1-1), fwbuilder-common, fwbuilder-bsd, fwbuilder-linu
Priority: extra
Section: checkinstall
Maintainer: vadim@fwbuilder.org
Version: 4.2.0.3505-1
Version: 4.2.0.3506-1
Depends: libqt4-gui (>= 4.3.0), libxml2, libxslt1.1, libsnmp | libsnmp15
Description: Firewall Builder GUI and policy compilers

View File

@ -1,6 +1,6 @@
%define name fwbuilder
%define version 4.2.0.3505
%define version 4.2.0.3506
%define release 1
%if "%_vendor" == "MandrakeSoft"

View File

@ -75,20 +75,16 @@ void IOSImporter::run()
parser.cfgfile();
} catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e)
{
err << parser_err;
err << e.toString().c_str();
err << parser_err + " " + e.toString().c_str();
} catch(ObjectMakerException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(ImporterException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(std::exception& e)
{
err << parser_err;
err << e.what();
err << parser_err + " " + e.what();
}
if (haveFirewallObject())

View File

@ -119,20 +119,16 @@ void IPTImporter::run()
parser.cfgfile();
} catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e)
{
err << parser_err;
err << e.toString().c_str();
err << parser_err + " " + e.toString().c_str();
} catch(ObjectMakerException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(ImporterException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(std::exception& e)
{
err << parser_err;
err << e.what();
err << parser_err + " " + e.what();
}
if (haveFirewallObject())

View File

@ -73,20 +73,16 @@ void PIXImporter::run()
parser.cfgfile();
} catch(ANTLR_USE_NAMESPACE(antlr)ANTLRException &e)
{
err << parser_err;
err << e.toString().c_str();
err << parser_err + " " + e.toString().c_str();
} catch(ObjectMakerException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(ImporterException &e)
{
err << gen_err;
err << e.toString();
err << gen_err + " " + e.toString();
} catch(std::exception& e)
{
err << parser_err;
err << e.what();
err << parser_err + " " + e.what();
}
if (haveFirewallObject())

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "iosacl.g" -> "IOSCfgLexer.cpp"$ */
#line 42 "iosacl.g"
#line 43 "iosacl.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -14,18 +14,16 @@
#include <antlr/CharStreamIOException.hpp>
#include <antlr/NoViableAltForCharException.hpp>
#line 48 "iosacl.g"
#line 49 "iosacl.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IOSImporter.h"
#line 27 "IOSCfgLexer.cpp"
#line 25 "IOSCfgLexer.cpp"
#line 1 "iosacl.g"
#line 29 "IOSCfgLexer.cpp"
#line 27 "IOSCfgLexer.cpp"
IOSCfgLexer::IOSCfgLexer(ANTLR_USE_NAMESPACE(std)istream& in)
: ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),true)
{
@ -432,9 +430,9 @@ void IOSCfgLexer::mNEWLINE(bool _createToken) {
}
if ( inputState->guessing==0 ) {
#line 712 "iosacl.g"
#line 729 "iosacl.g"
newline();
#line 438 "IOSCfgLexer.cpp"
#line 436 "IOSCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -513,9 +511,9 @@ void IOSCfgLexer::mWhitespace(bool _createToken) {
}
}
if ( inputState->guessing==0 ) {
#line 707 "iosacl.g"
#line 724 "iosacl.g"
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
#line 519 "IOSCfgLexer.cpp"
#line 517 "IOSCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -749,9 +747,9 @@ void IOSCfgLexer::mNUMBER(bool _createToken) {
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 732 "iosacl.g"
#line 749 "iosacl.g"
_ttype = IPV4;
#line 755 "IOSCfgLexer.cpp"
#line 753 "IOSCfgLexer.cpp"
}
}
else {
@ -852,9 +850,9 @@ void IOSCfgLexer::mNUMBER(bool _createToken) {
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 738 "iosacl.g"
#line 755 "iosacl.g"
_ttype = HEX_CONST;
#line 858 "IOSCfgLexer.cpp"
#line 856 "IOSCfgLexer.cpp"
}
}
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
@ -873,9 +871,9 @@ void IOSCfgLexer::mNUMBER(bool _createToken) {
_loop124:;
} // ( ... )+
if ( inputState->guessing==0 ) {
#line 736 "iosacl.g"
#line 753 "iosacl.g"
_ttype = INT_CONST;
#line 879 "IOSCfgLexer.cpp"
#line 877 "IOSCfgLexer.cpp"
}
}
else {

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "IOSImporter.h"
#line 10 "IOSCfgLexer.hpp"
#line 11 "IOSCfgLexer.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "iosacl.g" -> "IOSCfgLexer.hpp"$ */
#include <antlr/CommonToken.hpp>
@ -14,7 +15,7 @@
#include <antlr/BitSet.hpp>
#include "IOSCfgParserTokenTypes.hpp"
#include <antlr/CharScanner.hpp>
#line 32 "iosacl.g"
#line 33 "iosacl.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,17 +24,17 @@
class IOSImporter;
#line 27 "IOSCfgLexer.hpp"
#line 58 "iosacl.g"
#line 28 "IOSCfgLexer.hpp"
#line 57 "iosacl.g"
// gets inserted after generated namespace specifications in the
// header file. But outside the generated class.
#line 33 "IOSCfgLexer.hpp"
#line 34 "IOSCfgLexer.hpp"
class CUSTOM_API IOSCfgLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public IOSCfgParserTokenTypes
{
#line 1 "iosacl.g"
#line 37 "IOSCfgLexer.hpp"
#line 38 "IOSCfgLexer.hpp"
private:
void initLiterals();
public:

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "iosacl.g" -> "IOSCfgParser.cpp"$ */
#line 42 "iosacl.g"
#line 43 "iosacl.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -9,18 +9,16 @@
#include <antlr/NoViableAltException.hpp>
#include <antlr/SemanticException.hpp>
#include <antlr/ASTFactory.hpp>
#line 48 "iosacl.g"
#line 49 "iosacl.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IOSImporter.h"
#line 22 "IOSCfgParser.cpp"
#line 20 "IOSCfgParser.cpp"
#line 1 "iosacl.g"
#line 24 "IOSCfgParser.cpp"
#line 22 "IOSCfgParser.cpp"
IOSCfgParser::IOSCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k)
: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k)
{
@ -171,11 +169,11 @@ void IOSCfgParser::version() {
v = LT(1);
match(NUMBER);
if ( inputState->guessing==0 ) {
#line 154 "iosacl.g"
#line 171 "iosacl.g"
*dbg << "VERSION " << v->getText() << std::endl;
#line 179 "IOSCfgParser.cpp"
#line 177 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -211,7 +209,7 @@ void IOSCfgParser::hostname() {
}
}
if ( inputState->guessing==0 ) {
#line 161 "iosacl.g"
#line 178 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setHostName( LT(0)->getText() );
@ -219,7 +217,7 @@ void IOSCfgParser::hostname() {
<< "LT0=" << LT(0)->getText()
<< std::endl;
#line 223 "IOSCfgParser.cpp"
#line 221 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -284,14 +282,14 @@ void IOSCfgParser::intrface() {
in = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 488 "iosacl.g"
#line 505 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newInterface( in->getText() );
*dbg << in->getLine() << ":"
<< " INTRFACE: " << in->getText() << std::endl;
#line 295 "IOSCfgParser.cpp"
#line 293 "IOSCfgParser.cpp"
}
match(NEWLINE);
}
@ -310,13 +308,13 @@ void IOSCfgParser::controller() {
try { // for error handling
match(CONTROLLER);
if ( inputState->guessing==0 ) {
#line 478 "iosacl.g"
#line 495 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->clearCurrentInterface();
consumeUntil(NEWLINE);
#line 320 "IOSCfgParser.cpp"
#line 318 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -352,13 +350,13 @@ void IOSCfgParser::vlan() {
}
}
if ( inputState->guessing==0 ) {
#line 468 "iosacl.g"
#line 485 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->clearCurrentInterface();
consumeUntil(NEWLINE);
#line 362 "IOSCfgParser.cpp"
#line 360 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -379,14 +377,14 @@ void IOSCfgParser::access_list_commands() {
acl_num = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 177 "iosacl.g"
#line 194 "iosacl.g"
importer->newUnidirRuleSet( std::string("acl_") + acl_num->getText(),
libfwbuilder::Policy::TYPENAME);
*dbg << acl_num->getLine() << ":"
<< " ACL #" << acl_num->getText() << " ";
#line 390 "IOSCfgParser.cpp"
#line 388 "IOSCfgParser.cpp"
}
{
if ((LA(1) == PERMIT) && (LA(2) == IPV4 || LA(2) == ANY)) {
@ -440,7 +438,7 @@ void IOSCfgParser::description() {
try { // for error handling
match(DESCRIPTION);
if ( inputState->guessing==0 ) {
#line 500 "iosacl.g"
#line 517 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
*dbg << LT(1)->getLine() << ":";
@ -454,7 +452,7 @@ void IOSCfgParser::description() {
*dbg << " DESCRIPTION " << descr << std::endl;
//consumeUntil(NEWLINE);
#line 458 "IOSCfgParser.cpp"
#line 456 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -472,12 +470,12 @@ void IOSCfgParser::shutdown() {
try { // for error handling
match(SHUTDOWN);
if ( inputState->guessing==0 ) {
#line 535 "iosacl.g"
#line 552 "iosacl.g"
*dbg<< LT(1)->getLine() << ":"
<< " INTERFACE SHUTDOWN " << std::endl;
#line 481 "IOSCfgParser.cpp"
#line 479 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -496,12 +494,12 @@ void IOSCfgParser::certificate() {
match(CERTIFICATE);
match(WORD);
if ( inputState->guessing==0 ) {
#line 146 "iosacl.g"
#line 163 "iosacl.g"
consumeUntil(NEWLINE);
consumeUntil(QUIT);
#line 505 "IOSCfgParser.cpp"
#line 503 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -519,11 +517,11 @@ void IOSCfgParser::quit() {
try { // for error handling
match(QUIT);
if ( inputState->guessing==0 ) {
#line 125 "iosacl.g"
#line 142 "iosacl.g"
consumeUntil(NEWLINE);
#line 527 "IOSCfgParser.cpp"
#line 525 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -541,11 +539,11 @@ void IOSCfgParser::unknown_command() {
try { // for error handling
match(WORD);
if ( inputState->guessing==0 ) {
#line 139 "iosacl.g"
#line 156 "iosacl.g"
consumeUntil(NEWLINE);
#line 549 "IOSCfgParser.cpp"
#line 547 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -567,13 +565,13 @@ void IOSCfgParser::ip_access_list_ext() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 199 "iosacl.g"
#line 216 "iosacl.g"
importer->newUnidirRuleSet( name->getText(), libfwbuilder::Policy::TYPENAME );
*dbg << name->getLine() << ":"
<< " ACL ext " << name->getText() << std::endl;
#line 577 "IOSCfgParser.cpp"
#line 575 "IOSCfgParser.cpp"
}
match(NEWLINE);
{ // ( ... )+
@ -611,12 +609,12 @@ void IOSCfgParser::ip_access_list_ext() {
_loop17:;
} // ( ... )+
if ( inputState->guessing==0 ) {
#line 216 "iosacl.g"
#line 233 "iosacl.g"
*dbg << LT(0)->getLine() << ":"
<< " ACL end" << std::endl << std::endl;
#line 620 "IOSCfgParser.cpp"
#line 618 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -664,11 +662,11 @@ void IOSCfgParser::community_list_command() {
try { // for error handling
match(COMMUNITY_LIST);
if ( inputState->guessing==0 ) {
#line 132 "iosacl.g"
#line 149 "iosacl.g"
consumeUntil(NEWLINE);
#line 672 "IOSCfgParser.cpp"
#line 670 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -686,23 +684,23 @@ void IOSCfgParser::permit_std() {
try { // for error handling
match(PERMIT);
if ( inputState->guessing==0 ) {
#line 251 "iosacl.g"
#line 268 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "permit";
*dbg << LT(1)->getLine() << ":" << " permit ";
#line 697 "IOSCfgParser.cpp"
#line 695 "IOSCfgParser.cpp"
}
rule_std();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 258 "iosacl.g"
#line 275 "iosacl.g"
importer->pushRule();
#line 706 "IOSCfgParser.cpp"
#line 704 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -720,23 +718,23 @@ void IOSCfgParser::deny_std() {
try { // for error handling
match(DENY);
if ( inputState->guessing==0 ) {
#line 264 "iosacl.g"
#line 281 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "deny";
*dbg << LT(1)->getLine() << ":" << " deny ";
#line 731 "IOSCfgParser.cpp"
#line 729 "IOSCfgParser.cpp"
}
rule_std();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 271 "iosacl.g"
#line 288 "iosacl.g"
importer->pushRule();
#line 740 "IOSCfgParser.cpp"
#line 738 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -754,23 +752,23 @@ void IOSCfgParser::permit_ext() {
try { // for error handling
match(PERMIT);
if ( inputState->guessing==0 ) {
#line 224 "iosacl.g"
#line 241 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "permit";
*dbg << LT(1)->getLine() << ":" << " permit ";
#line 765 "IOSCfgParser.cpp"
#line 763 "IOSCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 231 "iosacl.g"
#line 248 "iosacl.g"
importer->pushRule();
#line 774 "IOSCfgParser.cpp"
#line 772 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -788,23 +786,23 @@ void IOSCfgParser::deny_ext() {
try { // for error handling
match(DENY);
if ( inputState->guessing==0 ) {
#line 237 "iosacl.g"
#line 254 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "deny";
*dbg << LT(1)->getLine() << ":" << " deny ";
#line 799 "IOSCfgParser.cpp"
#line 797 "IOSCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 244 "iosacl.g"
#line 261 "iosacl.g"
importer->pushRule();
#line 808 "IOSCfgParser.cpp"
#line 806 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -822,7 +820,7 @@ void IOSCfgParser::remark() {
try { // for error handling
match(REMARK);
if ( inputState->guessing==0 ) {
#line 519 "iosacl.g"
#line 536 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
*dbg << LT(1)->getLine() << ":";
@ -836,7 +834,7 @@ void IOSCfgParser::remark() {
*dbg << " REMARK " << rem << std::endl;
//consumeUntil(NEWLINE);
#line 840 "IOSCfgParser.cpp"
#line 838 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -860,15 +858,15 @@ void IOSCfgParser::rule_ext() {
ip_protocols();
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 281 "iosacl.g"
#line 298 "iosacl.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 866 "IOSCfgParser.cpp"
#line 864 "IOSCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 282 "iosacl.g"
#line 299 "iosacl.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 872 "IOSCfgParser.cpp"
#line 870 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -933,24 +931,24 @@ void IOSCfgParser::rule_ext() {
{
match(ICMP);
if ( inputState->guessing==0 ) {
#line 288 "iosacl.g"
#line 305 "iosacl.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 942 "IOSCfgParser.cpp"
#line 940 "IOSCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 292 "iosacl.g"
#line 309 "iosacl.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 948 "IOSCfgParser.cpp"
#line 946 "IOSCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 293 "iosacl.g"
#line 310 "iosacl.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 954 "IOSCfgParser.cpp"
#line 952 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1055,18 +1053,18 @@ void IOSCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 300 "iosacl.g"
#line 317 "iosacl.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 1064 "IOSCfgParser.cpp"
#line 1062 "IOSCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 304 "iosacl.g"
#line 321 "iosacl.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 1070 "IOSCfgParser.cpp"
#line 1068 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1078,9 +1076,9 @@ void IOSCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 305 "iosacl.g"
#line 322 "iosacl.g"
importer->SaveTmpPortToSrc();
#line 1084 "IOSCfgParser.cpp"
#line 1082 "IOSCfgParser.cpp"
}
break;
}
@ -1098,9 +1096,9 @@ void IOSCfgParser::rule_ext() {
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 306 "iosacl.g"
#line 323 "iosacl.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 1104 "IOSCfgParser.cpp"
#line 1102 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1112,9 +1110,9 @@ void IOSCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 307 "iosacl.g"
#line 324 "iosacl.g"
importer->SaveTmpPortToDst();
#line 1118 "IOSCfgParser.cpp"
#line 1116 "IOSCfgParser.cpp"
}
break;
}
@ -1220,11 +1218,11 @@ void IOSCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 313 "iosacl.g"
#line 330 "iosacl.g"
*dbg << std::endl;
#line 1228 "IOSCfgParser.cpp"
#line 1226 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1243,9 +1241,9 @@ void IOSCfgParser::rule_std() {
{
hostaddr_std();
if ( inputState->guessing==0 ) {
#line 321 "iosacl.g"
#line 338 "iosacl.g"
importer->SaveTmpAddrToSrc(); *dbg << "(std) ";
#line 1249 "IOSCfgParser.cpp"
#line 1247 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1267,11 +1265,11 @@ void IOSCfgParser::rule_std() {
}
}
if ( inputState->guessing==0 ) {
#line 324 "iosacl.g"
#line 341 "iosacl.g"
*dbg << std::endl;
#line 1275 "IOSCfgParser.cpp"
#line 1273 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1306,12 +1304,12 @@ void IOSCfgParser::ip_protocols() {
}
}
if ( inputState->guessing==0 ) {
#line 332 "iosacl.g"
#line 349 "iosacl.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 1315 "IOSCfgParser.cpp"
#line 1313 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1339,13 +1337,13 @@ void IOSCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 384 "iosacl.g"
#line 401 "iosacl.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 1349 "IOSCfgParser.cpp"
#line 1347 "IOSCfgParser.cpp"
}
break;
}
@ -1358,13 +1356,13 @@ void IOSCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 391 "iosacl.g"
#line 408 "iosacl.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 1368 "IOSCfgParser.cpp"
#line 1366 "IOSCfgParser.cpp"
}
break;
}
@ -1372,13 +1370,13 @@ void IOSCfgParser::hostaddr_ext() {
{
match(ANY);
if ( inputState->guessing==0 ) {
#line 398 "iosacl.g"
#line 415 "iosacl.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 1382 "IOSCfgParser.cpp"
#line 1380 "IOSCfgParser.cpp"
}
break;
}
@ -1406,12 +1404,12 @@ void IOSCfgParser::time_range() {
tr_name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 450 "iosacl.g"
#line 467 "iosacl.g"
importer->time_range_name = tr_name->getText();
*dbg << "time_range " << tr_name->getText() << " ";
#line 1415 "IOSCfgParser.cpp"
#line 1413 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1429,12 +1427,12 @@ void IOSCfgParser::fragments() {
try { // for error handling
match(FRAGMENTS);
if ( inputState->guessing==0 ) {
#line 443 "iosacl.g"
#line 460 "iosacl.g"
importer->fragments = true;
*dbg << "fragments ";
#line 1438 "IOSCfgParser.cpp"
#line 1436 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1469,12 +1467,12 @@ void IOSCfgParser::log() {
}
}
if ( inputState->guessing==0 ) {
#line 429 "iosacl.g"
#line 446 "iosacl.g"
importer->logging = true;
*dbg << "logging ";
#line 1478 "IOSCfgParser.cpp"
#line 1476 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1504,7 +1502,7 @@ void IOSCfgParser::icmp_spec() {
match(INT_CONST);
}
if ( inputState->guessing==0 ) {
#line 340 "iosacl.g"
#line 357 "iosacl.g"
importer->icmp_type = icmp_type->getText();
importer->icmp_code = icmp_code->getText();
@ -1512,7 +1510,7 @@ void IOSCfgParser::icmp_spec() {
*dbg << icmp_type->getText() << " "
<< icmp_code->getText() << " ";
#line 1516 "IOSCfgParser.cpp"
#line 1514 "IOSCfgParser.cpp"
}
break;
}
@ -1521,12 +1519,12 @@ void IOSCfgParser::icmp_spec() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 349 "iosacl.g"
#line 366 "iosacl.g"
importer->icmp_spec = icmp_word->getText();
*dbg << icmp_word->getText() << " ";
#line 1530 "IOSCfgParser.cpp"
#line 1528 "IOSCfgParser.cpp"
}
break;
}
@ -1585,12 +1583,12 @@ void IOSCfgParser::established() {
try { // for error handling
match(ESTABLISHED);
if ( inputState->guessing==0 ) {
#line 436 "iosacl.g"
#line 453 "iosacl.g"
importer->established = true;
*dbg << "established ";
#line 1594 "IOSCfgParser.cpp"
#line 1592 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1615,13 +1613,13 @@ void IOSCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 407 "iosacl.g"
#line 424 "iosacl.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 1625 "IOSCfgParser.cpp"
#line 1623 "IOSCfgParser.cpp"
}
}
else if ((LA(1) == IPV4) && (LA(2) == IPV4)) {
@ -1632,25 +1630,25 @@ void IOSCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 414 "iosacl.g"
#line 431 "iosacl.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 1642 "IOSCfgParser.cpp"
#line 1640 "IOSCfgParser.cpp"
}
}
else if ((LA(1) == ANY)) {
match(ANY);
if ( inputState->guessing==0 ) {
#line 421 "iosacl.g"
#line 438 "iosacl.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 1654 "IOSCfgParser.cpp"
#line 1652 "IOSCfgParser.cpp"
}
}
else {
@ -1700,12 +1698,12 @@ void IOSCfgParser::single_port_op() {
}
}
if ( inputState->guessing==0 ) {
#line 360 "iosacl.g"
#line 377 "iosacl.g"
importer->tmp_port_op = LT(0)->getText();
*dbg << LT(0)->getText() << " ";
#line 1709 "IOSCfgParser.cpp"
#line 1707 "IOSCfgParser.cpp"
}
port_spec();
}
@ -1724,12 +1722,12 @@ void IOSCfgParser::port_range() {
try { // for error handling
match(P_RANGE);
if ( inputState->guessing==0 ) {
#line 368 "iosacl.g"
#line 385 "iosacl.g"
importer->tmp_port_op = LT(0)->getText();
*dbg << LT(0)->getText() << " ";
#line 1733 "IOSCfgParser.cpp"
#line 1731 "IOSCfgParser.cpp"
}
port_spec();
port_spec();
@ -1766,12 +1764,12 @@ void IOSCfgParser::port_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 376 "iosacl.g"
#line 393 "iosacl.g"
importer->tmp_port_spec += (std::string(" ") + LT(0)->getText());
*dbg << LT(0)->getText() << " ";
#line 1775 "IOSCfgParser.cpp"
#line 1773 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1795,7 +1793,7 @@ void IOSCfgParser::access_group_by_name() {
dir = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 561 "iosacl.g"
#line 578 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setInterfaceAndDirectionForRuleSet(
@ -1806,7 +1804,7 @@ void IOSCfgParser::access_group_by_name() {
<< " INTRFACE: ACL '" << acln->getText() << "'"
<< " " << dir->getText() << std::endl;
#line 1810 "IOSCfgParser.cpp"
#line 1808 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1830,7 +1828,7 @@ void IOSCfgParser::access_group_by_number() {
dir = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 577 "iosacl.g"
#line 594 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setInterfaceAndDirectionForRuleSet(
@ -1841,7 +1839,7 @@ void IOSCfgParser::access_group_by_number() {
<< " INTRFACE: ACL '" << acln->getText() << "'"
<< " " << dir->getText() << std::endl;
#line 1845 "IOSCfgParser.cpp"
#line 1843 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1884,7 +1882,7 @@ void IOSCfgParser::intf_address() {
}
}
if ( inputState->guessing==0 ) {
#line 590 "iosacl.g"
#line 607 "iosacl.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->addInterfaceAddress(a->getText(), m->getText());
@ -1897,7 +1895,7 @@ void IOSCfgParser::intf_address() {
}
*dbg << std::endl;
#line 1901 "IOSCfgParser.cpp"
#line 1899 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "IOSImporter.h"
#line 10 "IOSCfgParser.hpp"
#line 11 "IOSCfgParser.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "iosacl.g" -> "IOSCfgParser.hpp"$ */
#include <antlr/TokenStream.hpp>
@ -14,7 +15,7 @@
#include "IOSCfgParserTokenTypes.hpp"
#include <antlr/LLkParser.hpp>
#line 32 "iosacl.g"
#line 33 "iosacl.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,16 +24,16 @@
class IOSImporter;
#line 27 "IOSCfgParser.hpp"
#line 58 "iosacl.g"
#line 28 "IOSCfgParser.hpp"
#line 57 "iosacl.g"
// gets inserted after generated namespace specifications in the
// header file. But outside the generated class.
#line 33 "IOSCfgParser.hpp"
#line 34 "IOSCfgParser.hpp"
class CUSTOM_API IOSCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public IOSCfgParserTokenTypes
{
#line 75 "iosacl.g"
#line 74 "iosacl.g"
// additional methods and members
@ -40,7 +41,25 @@ class CUSTOM_API IOSCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, publ
std::ostream *dbg;
IOSImporter *importer;
#line 37 "IOSCfgParser.hpp"
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
#line 38 "IOSCfgParser.hpp"
public:
void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory );
protected:

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "iptables.g" -> "IPTCfgLexer.cpp"$ */
#line 42 "iptables.g"
#line 44 "iptables.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -14,24 +14,21 @@
#include <antlr/CharStreamIOException.hpp>
#include <antlr/NoViableAltForCharException.hpp>
#line 48 "iptables.g"
#line 50 "iptables.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IPTImporter.h"
#include "fwbuilder/TCPService.h"
#include "fwbuilder/Logger.h"
#include <algorithm>
#line 33 "IPTCfgLexer.cpp"
#line 30 "IPTCfgLexer.cpp"
#line 1 "iptables.g"
#line 35 "IPTCfgLexer.cpp"
#line 32 "IPTCfgLexer.cpp"
IPTCfgLexer::IPTCfgLexer(ANTLR_USE_NAMESPACE(std)istream& in)
: ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),true)
{
@ -681,9 +678,9 @@ void IPTCfgLexer::mNEWLINE(bool _createToken) {
}
if ( inputState->guessing==0 ) {
#line 1186 "iptables.g"
#line 1204 "iptables.g"
newline(); resetText();
#line 687 "IPTCfgLexer.cpp"
#line 684 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -762,9 +759,9 @@ void IPTCfgLexer::mWhitespace(bool _createToken) {
}
}
if ( inputState->guessing==0 ) {
#line 1184 "iptables.g"
#line 1202 "iptables.g"
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
#line 768 "IPTCfgLexer.cpp"
#line 765 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -1029,9 +1026,9 @@ void IPTCfgLexer::mNUMBER(bool _createToken) {
match('.' /* charlit */ );
mNUM_3DIGIT(false);
if ( inputState->guessing==0 ) {
#line 1249 "iptables.g"
#line 1267 "iptables.g"
_ttype = IPV4;
#line 1035 "IPTCfgLexer.cpp"
#line 1032 "IPTCfgLexer.cpp"
}
}
}
@ -1055,9 +1052,9 @@ void IPTCfgLexer::mNUMBER(bool _createToken) {
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 1252 "iptables.g"
#line 1270 "iptables.g"
_ttype = HEX_CONST;
#line 1061 "IPTCfgLexer.cpp"
#line 1058 "IPTCfgLexer.cpp"
}
}
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
@ -1076,9 +1073,9 @@ void IPTCfgLexer::mNUMBER(bool _createToken) {
_loop198:;
} // ( ... )+
if ( inputState->guessing==0 ) {
#line 1254 "iptables.g"
#line 1272 "iptables.g"
_ttype = INT_CONST;
#line 1082 "IPTCfgLexer.cpp"
#line 1079 "IPTCfgLexer.cpp"
}
}
else {
@ -1392,9 +1389,9 @@ void IPTCfgLexer::mRSOURCE(bool _createToken) {
match("--rsource");
if ( inputState->guessing==0 ) {
#line 1278 "iptables.g"
#line 1296 "iptables.g"
_ttype = UNSUPPORTED_OPTION;
#line 1398 "IPTCfgLexer.cpp"
#line 1395 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -2055,9 +2052,9 @@ void IPTCfgLexer::mULOG_QTHR(bool _createToken) {
match("--ulog-qthreshold");
if ( inputState->guessing==0 ) {
#line 1345 "iptables.g"
#line 1363 "iptables.g"
_ttype = UNSUPPORTED_OPTION;
#line 2061 "IPTCfgLexer.cpp"
#line 2058 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -2074,9 +2071,9 @@ void IPTCfgLexer::mULOG_NLG(bool _createToken) {
match("--ulog-nlgroup");
if ( inputState->guessing==0 ) {
#line 1346 "iptables.g"
#line 1364 "iptables.g"
_ttype = UNSUPPORTED_OPTION;
#line 2080 "IPTCfgLexer.cpp"
#line 2077 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -2093,9 +2090,9 @@ void IPTCfgLexer::mULOG_CPR(bool _createToken) {
match("--ulog-cprange");
if ( inputState->guessing==0 ) {
#line 1347 "iptables.g"
#line 1365 "iptables.g"
_ttype = UNSUPPORTED_OPTION;
#line 2099 "IPTCfgLexer.cpp"
#line 2096 "IPTCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "IPTImporter.h"
#line 10 "IPTCfgLexer.hpp"
#line 11 "IPTCfgLexer.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "iptables.g" -> "IPTCfgLexer.hpp"$ */
#include <antlr/CommonToken.hpp>
@ -14,7 +15,7 @@
#include <antlr/BitSet.hpp>
#include "IPTCfgParserTokenTypes.hpp"
#include <antlr/CharScanner.hpp>
#line 32 "iptables.g"
#line 34 "iptables.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,17 +24,17 @@
class IPTImporter;
#line 27 "IPTCfgLexer.hpp"
#line 64 "iptables.g"
#line 28 "IPTCfgLexer.hpp"
#line 63 "iptables.g"
// gets inserted after generated namespace specifications in the
// header file. But outside the generated class.
#line 33 "IPTCfgLexer.hpp"
#line 34 "IPTCfgLexer.hpp"
class CUSTOM_API IPTCfgLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public IPTCfgParserTokenTypes
{
#line 1 "iptables.g"
#line 37 "IPTCfgLexer.hpp"
#line 38 "IPTCfgLexer.hpp"
private:
void initLiterals();
public:

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "iptables.g" -> "IPTCfgParser.cpp"$ */
#line 42 "iptables.g"
#line 44 "iptables.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -9,24 +9,21 @@
#include <antlr/NoViableAltException.hpp>
#include <antlr/SemanticException.hpp>
#include <antlr/ASTFactory.hpp>
#line 48 "iptables.g"
#line 50 "iptables.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IPTImporter.h"
#include "fwbuilder/TCPService.h"
#include "fwbuilder/Logger.h"
#include <algorithm>
#line 28 "IPTCfgParser.cpp"
#line 25 "IPTCfgParser.cpp"
#line 1 "iptables.g"
#line 30 "IPTCfgParser.cpp"
#line 27 "IPTCfgParser.cpp"
IPTCfgParser::IPTCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k)
: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k)
{
@ -130,7 +127,7 @@ void IPTCfgParser::start_table() {
match(STAR);
match(WORD);
if ( inputState->guessing==0 ) {
#line 125 "iptables.g"
#line 143 "iptables.g"
if (!importer->current_table.empty())
{
@ -151,7 +148,7 @@ void IPTCfgParser::start_table() {
importer->current_table = LT(0)->getText();
*dbg << "TABLE " << LT(0)->getText() << std::endl;
#line 155 "IPTCfgParser.cpp"
#line 152 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -170,7 +167,7 @@ void IPTCfgParser::create_chain() {
match(COLON);
chain_def();
if ( inputState->guessing==0 ) {
#line 160 "iptables.g"
#line 178 "iptables.g"
importer->setCurrentLineNumber(LT(0)->getLine());
if (importer->current_table=="nat")
@ -181,7 +178,7 @@ void IPTCfgParser::create_chain() {
libfwbuilder::Policy::TYPENAME);
*dbg << "NEW CHAIN " << LT(0)->getText() << std::endl;
#line 185 "IPTCfgParser.cpp"
#line 182 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -202,12 +199,12 @@ void IPTCfgParser::create_chain() {
}
}
if ( inputState->guessing==0 ) {
#line 171 "iptables.g"
#line 189 "iptables.g"
importer->setDefaultAction(LT(0)->getText());
*dbg << "DEFAULT ACTION " << LT(0)->getText() << std::endl;
#line 211 "IPTCfgParser.cpp"
#line 208 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -253,7 +250,7 @@ void IPTCfgParser::add_rule() {
match(ADD_RULE);
chain_def();
if ( inputState->guessing==0 ) {
#line 181 "iptables.g"
#line 199 "iptables.g"
// push previous rule
*dbg << std::endl;
@ -268,7 +265,7 @@ void IPTCfgParser::add_rule() {
*dbg << "add_rule: line=" << LT(0)->getLine()
<< " chain=" << LT(0)->getText();
#line 272 "IPTCfgParser.cpp"
#line 269 "IPTCfgParser.cpp"
}
{ // ( ... )+
int _cnt14=0;
@ -301,7 +298,7 @@ void IPTCfgParser::commit() {
try { // for error handling
match(COMMIT);
if ( inputState->guessing==0 ) {
#line 113 "iptables.g"
#line 131 "iptables.g"
// push last rule
importer->pushRule();
@ -309,7 +306,7 @@ void IPTCfgParser::commit() {
// clear current table
importer->current_table = "";
#line 313 "IPTCfgParser.cpp"
#line 310 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -588,9 +585,9 @@ void IPTCfgParser::match_mark() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 673 "iptables.g"
#line 691 "iptables.g"
importer->neg_match_mark = true;
#line 594 "IPTCfgParser.cpp"
#line 591 "IPTCfgParser.cpp"
}
break;
}
@ -624,12 +621,12 @@ void IPTCfgParser::match_mark() {
}
}
if ( inputState->guessing==0 ) {
#line 675 "iptables.g"
#line 693 "iptables.g"
importer->match_mark = LT(0)->getText();
*dbg << " MATCH MARK " << LT(0)->getText();
#line 633 "IPTCfgParser.cpp"
#line 630 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -677,11 +674,11 @@ void IPTCfgParser::src() {
try { // for error handling
match(OPT_SRC);
if ( inputState->guessing==0 ) {
#line 316 "iptables.g"
#line 334 "iptables.g"
*dbg << " SRC=";
#line 685 "IPTCfgParser.cpp"
#line 682 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -689,11 +686,11 @@ void IPTCfgParser::src() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 321 "iptables.g"
#line 339 "iptables.g"
importer->src_neg = true;
#line 697 "IPTCfgParser.cpp"
#line 694 "IPTCfgParser.cpp"
}
break;
}
@ -728,12 +725,12 @@ void IPTCfgParser::src() {
}
}
if ( inputState->guessing==0 ) {
#line 326 "iptables.g"
#line 344 "iptables.g"
importer->src_a = LT(0)->getText();
*dbg << LT(0)->getText();
#line 737 "IPTCfgParser.cpp"
#line 734 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -759,12 +756,12 @@ void IPTCfgParser::src() {
}
}
if ( inputState->guessing==0 ) {
#line 331 "iptables.g"
#line 349 "iptables.g"
importer->src_nm = LT(0)->getText();
*dbg << "/" << LT(0)->getText();
#line 768 "IPTCfgParser.cpp"
#line 765 "IPTCfgParser.cpp"
}
break;
}
@ -822,11 +819,11 @@ void IPTCfgParser::dst() {
try { // for error handling
match(OPT_DST);
if ( inputState->guessing==0 ) {
#line 340 "iptables.g"
#line 358 "iptables.g"
*dbg << " DST=";
#line 830 "IPTCfgParser.cpp"
#line 827 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -834,11 +831,11 @@ void IPTCfgParser::dst() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 345 "iptables.g"
#line 363 "iptables.g"
importer->dst_neg = true;
#line 842 "IPTCfgParser.cpp"
#line 839 "IPTCfgParser.cpp"
}
break;
}
@ -873,12 +870,12 @@ void IPTCfgParser::dst() {
}
}
if ( inputState->guessing==0 ) {
#line 350 "iptables.g"
#line 368 "iptables.g"
importer->dst_a = LT(0)->getText();
*dbg << LT(0)->getText();
#line 882 "IPTCfgParser.cpp"
#line 879 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -904,12 +901,12 @@ void IPTCfgParser::dst() {
}
}
if ( inputState->guessing==0 ) {
#line 355 "iptables.g"
#line 373 "iptables.g"
importer->dst_nm = LT(0)->getText();
*dbg << "/" << LT(0)->getText();
#line 913 "IPTCfgParser.cpp"
#line 910 "IPTCfgParser.cpp"
}
break;
}
@ -973,11 +970,11 @@ void IPTCfgParser::i_intf() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 366 "iptables.g"
#line 384 "iptables.g"
importer->intf_neg = true;
#line 981 "IPTCfgParser.cpp"
#line 978 "IPTCfgParser.cpp"
}
break;
}
@ -994,12 +991,12 @@ void IPTCfgParser::i_intf() {
i = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 371 "iptables.g"
#line 389 "iptables.g"
importer->i_intf = LT(0)->getText();
*dbg << " I_INTF=" << i->getText();
#line 1003 "IPTCfgParser.cpp"
#line 1000 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1023,11 +1020,11 @@ void IPTCfgParser::o_intf() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 381 "iptables.g"
#line 399 "iptables.g"
importer->intf_neg = true;
#line 1031 "IPTCfgParser.cpp"
#line 1028 "IPTCfgParser.cpp"
}
break;
}
@ -1044,12 +1041,12 @@ void IPTCfgParser::o_intf() {
i = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 386 "iptables.g"
#line 404 "iptables.g"
importer->o_intf = LT(0)->getText();
*dbg << " O_INTF=" << i->getText();
#line 1053 "IPTCfgParser.cpp"
#line 1050 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1072,11 +1069,11 @@ void IPTCfgParser::proto() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 399 "iptables.g"
#line 417 "iptables.g"
importer->srv_neg = true;
#line 1080 "IPTCfgParser.cpp"
#line 1077 "IPTCfgParser.cpp"
}
break;
}
@ -1096,7 +1093,7 @@ void IPTCfgParser::proto() {
}
protocol_word();
if ( inputState->guessing==0 ) {
#line 404 "iptables.g"
#line 422 "iptables.g"
std::string tmp_s = LT(0)->getText();
importer->protocol.resize(tmp_s.size());
@ -1106,7 +1103,7 @@ void IPTCfgParser::proto() {
::tolower);
*dbg << " PROTO=" << importer->protocol;
#line 1110 "IPTCfgParser.cpp"
#line 1107 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1127,12 +1124,12 @@ void IPTCfgParser::target() {
t = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 417 "iptables.g"
#line 435 "iptables.g"
importer->target = LT(0)->getText();
*dbg << " TARGET=" << t->getText();
#line 1136 "IPTCfgParser.cpp"
#line 1133 "IPTCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -1162,12 +1159,12 @@ void IPTCfgParser::fragm() {
try { // for error handling
match(OPT_FRAGM);
if ( inputState->guessing==0 ) {
#line 622 "iptables.g"
#line 640 "iptables.g"
importer->fragments = true;
*dbg << " FRAGM";
#line 1171 "IPTCfgParser.cpp"
#line 1168 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1190,12 +1187,12 @@ void IPTCfgParser::icmp_type_spec() {
{
match(WORD);
if ( inputState->guessing==0 ) {
#line 905 "iptables.g"
#line 923 "iptables.g"
importer->icmp_spec = LT(0)->getText();
*dbg << " ICMP_SPEC=" << LT(0)->getText();
#line 1199 "IPTCfgParser.cpp"
#line 1196 "IPTCfgParser.cpp"
}
break;
}
@ -1204,13 +1201,13 @@ void IPTCfgParser::icmp_type_spec() {
{
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 912 "iptables.g"
#line 930 "iptables.g"
importer->icmp_type = LT(0)->getText();
importer->icmp_code = "-1";
*dbg << " ICMP_TYPE=" << LT(0)->getText();
#line 1214 "IPTCfgParser.cpp"
#line 1211 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1219,12 +1216,12 @@ void IPTCfgParser::icmp_type_spec() {
match(SLASH);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 919 "iptables.g"
#line 937 "iptables.g"
importer->icmp_code = LT(0)->getText();
*dbg << " ICMP_CODE=" << LT(0)->getText();
#line 1228 "IPTCfgParser.cpp"
#line 1225 "IPTCfgParser.cpp"
}
break;
}
@ -1316,11 +1313,11 @@ void IPTCfgParser::basic_tcp_udp_port_spec() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 1003 "iptables.g"
#line 1021 "iptables.g"
importer->srv_neg = true;
#line 1324 "IPTCfgParser.cpp"
#line 1321 "IPTCfgParser.cpp"
}
break;
}
@ -1356,11 +1353,11 @@ void IPTCfgParser::basic_tcp_udp_port_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 1008 "iptables.g"
#line 1026 "iptables.g"
importer->pushTmpPortSpecToSrcPortList();
#line 1364 "IPTCfgParser.cpp"
#line 1361 "IPTCfgParser.cpp"
}
break;
}
@ -1391,11 +1388,11 @@ void IPTCfgParser::basic_tcp_udp_port_spec() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 1015 "iptables.g"
#line 1033 "iptables.g"
importer->srv_neg = true;
#line 1399 "IPTCfgParser.cpp"
#line 1396 "IPTCfgParser.cpp"
}
break;
}
@ -1431,11 +1428,11 @@ void IPTCfgParser::basic_tcp_udp_port_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 1020 "iptables.g"
#line 1038 "iptables.g"
importer->pushTmpPortSpecToDstPortList();
#line 1439 "IPTCfgParser.cpp"
#line 1436 "IPTCfgParser.cpp"
}
break;
}
@ -1465,20 +1462,20 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
{
match(MATCH_SRC_MULTIPORT);
if ( inputState->guessing==0 ) {
#line 842 "iptables.g"
#line 860 "iptables.g"
importer->startSrcMultiPort();
*dbg << " SRC MULTIPORT=";
#line 1474 "IPTCfgParser.cpp"
#line 1471 "IPTCfgParser.cpp"
}
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 847 "iptables.g"
#line 865 "iptables.g"
importer->pushTmpPortSpecToSrcPortList();
#line 1482 "IPTCfgParser.cpp"
#line 1479 "IPTCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -1486,11 +1483,11 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
match(COMMA);
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 851 "iptables.g"
#line 869 "iptables.g"
importer->pushTmpPortSpecToSrcPortList();
#line 1494 "IPTCfgParser.cpp"
#line 1491 "IPTCfgParser.cpp"
}
}
else {
@ -1508,20 +1505,20 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
{
match(MATCH_DST_MULTIPORT);
if ( inputState->guessing==0 ) {
#line 858 "iptables.g"
#line 876 "iptables.g"
importer->startDstMultiPort();
*dbg << " DST MULTIPORT=";
#line 1517 "IPTCfgParser.cpp"
#line 1514 "IPTCfgParser.cpp"
}
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 863 "iptables.g"
#line 881 "iptables.g"
importer->pushTmpPortSpecToDstPortList();
#line 1525 "IPTCfgParser.cpp"
#line 1522 "IPTCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -1529,11 +1526,11 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
match(COMMA);
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 867 "iptables.g"
#line 885 "iptables.g"
importer->pushTmpPortSpecToDstPortList();
#line 1537 "IPTCfgParser.cpp"
#line 1534 "IPTCfgParser.cpp"
}
}
else {
@ -1551,20 +1548,20 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
{
match(MATCH_BOTH_MULTIPORT);
if ( inputState->guessing==0 ) {
#line 874 "iptables.g"
#line 892 "iptables.g"
importer->startBothMultiPort();
*dbg << " MULTIPORT PORTS=";
#line 1560 "IPTCfgParser.cpp"
#line 1557 "IPTCfgParser.cpp"
}
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 879 "iptables.g"
#line 897 "iptables.g"
importer->pushTmpPortSpecToBothPortList();
#line 1568 "IPTCfgParser.cpp"
#line 1565 "IPTCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -1572,11 +1569,11 @@ void IPTCfgParser::multiport_tcp_udp_port_spec() {
match(COMMA);
port_def_no_range();
if ( inputState->guessing==0 ) {
#line 883 "iptables.g"
#line 901 "iptables.g"
importer->pushTmpPortSpecToBothPortList();
#line 1580 "IPTCfgParser.cpp"
#line 1577 "IPTCfgParser.cpp"
}
}
else {
@ -1615,9 +1612,9 @@ void IPTCfgParser::tcp_options() {
{
match(EXCLAMATION);
if ( inputState->guessing==0 ) {
#line 1049 "iptables.g"
#line 1067 "iptables.g"
importer->srv_neg = true;
#line 1621 "IPTCfgParser.cpp"
#line 1618 "IPTCfgParser.cpp"
}
break;
}
@ -1689,12 +1686,12 @@ void IPTCfgParser::match_limit_burst() {
match(MATCH_LIMIT_BURST);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 706 "iptables.g"
#line 724 "iptables.g"
importer->limit_burst = LT(0)->getText();
*dbg << " LIMIT BURST " << LT(0)->getText();
#line 1698 "IPTCfgParser.cpp"
#line 1695 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1746,12 +1743,12 @@ void IPTCfgParser::match_iprange_src() {
}
}
if ( inputState->guessing==0 ) {
#line 729 "iptables.g"
#line 747 "iptables.g"
importer->iprange_src_from = LT(0)->getText();
importer->using_iprange_src = true;
#line 1755 "IPTCfgParser.cpp"
#line 1752 "IPTCfgParser.cpp"
}
match(MINUS);
{
@ -1773,11 +1770,11 @@ void IPTCfgParser::match_iprange_src() {
}
}
if ( inputState->guessing==0 ) {
#line 734 "iptables.g"
#line 752 "iptables.g"
importer->iprange_src_to = LT(0)->getText();
#line 1781 "IPTCfgParser.cpp"
#line 1778 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1813,12 +1810,12 @@ void IPTCfgParser::match_iprange_dst() {
}
}
if ( inputState->guessing==0 ) {
#line 740 "iptables.g"
#line 758 "iptables.g"
importer->iprange_dst_from = LT(0)->getText();
importer->using_iprange_dst = true;
#line 1822 "IPTCfgParser.cpp"
#line 1819 "IPTCfgParser.cpp"
}
match(MINUS);
{
@ -1840,11 +1837,11 @@ void IPTCfgParser::match_iprange_dst() {
}
}
if ( inputState->guessing==0 ) {
#line 745 "iptables.g"
#line 763 "iptables.g"
importer->iprange_dst_to = LT(0)->getText();
#line 1848 "IPTCfgParser.cpp"
#line 1845 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1865,13 +1862,13 @@ void IPTCfgParser::unknown_option() {
match(MINUS);
match(WORD);
if ( inputState->guessing==0 ) {
#line 247 "iptables.g"
#line 265 "iptables.g"
importer->markCurrentRuleBad(
std::string("Unknown option: -")+LT(0)->getText());
*dbg << " UNKNOWN OPTION=-" << LT(0)->getText();
#line 1875 "IPTCfgParser.cpp"
#line 1872 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1929,13 +1926,13 @@ void IPTCfgParser::unknown_option() {
match(WORD);
}
if ( inputState->guessing==0 ) {
#line 257 "iptables.g"
#line 275 "iptables.g"
importer->markCurrentRuleBad(
std::string("Unknown option: --")+LT(0)->getText());
*dbg << " UNKNOWN OPTION=--" << LT(0)->getText();
#line 1939 "IPTCfgParser.cpp"
#line 1936 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1989,13 +1986,13 @@ void IPTCfgParser::unknown_option() {
{
match(UNSUPPORTED_OPTION);
if ( inputState->guessing==0 ) {
#line 267 "iptables.g"
#line 285 "iptables.g"
importer->markCurrentRuleBad(
std::string("Unknown option: ")+LT(0)->getText());
*dbg << " UNKNOWN OPTION=" << LT(0)->getText();
#line 1999 "IPTCfgParser.cpp"
#line 1996 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2061,9 +2058,9 @@ void IPTCfgParser::unknown_option() {
}
void IPTCfgParser::unknown_parameter() {
#line 276 "iptables.g"
#line 294 "iptables.g"
std::string s;
#line 2067 "IPTCfgParser.cpp"
#line 2064 "IPTCfgParser.cpp"
try { // for error handling
if ((LA(1) == INT_CONST || LA(1) == DIGIT) && (LA(2) == SLASH)) {
@ -2075,9 +2072,9 @@ void IPTCfgParser::unknown_parameter() {
{
match(DIGIT);
if ( inputState->guessing==0 ) {
#line 282 "iptables.g"
#line 300 "iptables.g"
s+=LT(0)->getText();
#line 2081 "IPTCfgParser.cpp"
#line 2078 "IPTCfgParser.cpp"
}
break;
}
@ -2085,9 +2082,9 @@ void IPTCfgParser::unknown_parameter() {
{
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 284 "iptables.g"
#line 302 "iptables.g"
s+=LT(0)->getText();
#line 2091 "IPTCfgParser.cpp"
#line 2088 "IPTCfgParser.cpp"
}
break;
}
@ -2099,25 +2096,25 @@ void IPTCfgParser::unknown_parameter() {
}
match(SLASH);
if ( inputState->guessing==0 ) {
#line 286 "iptables.g"
#line 304 "iptables.g"
s+=LT(0)->getText();
#line 2105 "IPTCfgParser.cpp"
#line 2102 "IPTCfgParser.cpp"
}
match(WORD);
if ( inputState->guessing==0 ) {
#line 287 "iptables.g"
#line 305 "iptables.g"
s+=LT(0)->getText();
#line 2111 "IPTCfgParser.cpp"
#line 2108 "IPTCfgParser.cpp"
}
}
if ( inputState->guessing==0 ) {
#line 289 "iptables.g"
#line 307 "iptables.g"
importer->markCurrentRuleBad(
std::string("Unknown parameter: ")+s);
*dbg << " UNKNOWN PARMETER=" << s;
#line 2121 "IPTCfgParser.cpp"
#line 2118 "IPTCfgParser.cpp"
}
}
}
@ -2147,13 +2144,13 @@ void IPTCfgParser::unknown_parameter() {
}
}
if ( inputState->guessing==0 ) {
#line 298 "iptables.g"
#line 316 "iptables.g"
importer->markCurrentRuleBad(
std::string("Unknown parameter: ")+LT(0)->getText());
*dbg << " UNKNOWN PARMETER=" << LT(0)->getText();
#line 2157 "IPTCfgParser.cpp"
#line 2154 "IPTCfgParser.cpp"
}
}
}
@ -2178,19 +2175,19 @@ void IPTCfgParser::m_state() {
match(M_STATE);
match(MATCH_STATE);
if ( inputState->guessing==0 ) {
#line 643 "iptables.g"
#line 661 "iptables.g"
importer->current_state = "";
#line 2186 "IPTCfgParser.cpp"
#line 2183 "IPTCfgParser.cpp"
}
state_word();
if ( inputState->guessing==0 ) {
#line 647 "iptables.g"
#line 665 "iptables.g"
importer->current_state += LT(0)->getText();
#line 2194 "IPTCfgParser.cpp"
#line 2191 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2199,11 +2196,11 @@ void IPTCfgParser::m_state() {
match(COMMA);
state_word();
if ( inputState->guessing==0 ) {
#line 652 "iptables.g"
#line 670 "iptables.g"
importer->current_state += std::string(",") + LT(0)->getText();
#line 2207 "IPTCfgParser.cpp"
#line 2204 "IPTCfgParser.cpp"
}
break;
}
@ -2245,11 +2242,11 @@ void IPTCfgParser::m_state() {
}
}
if ( inputState->guessing==0 ) {
#line 656 "iptables.g"
#line 674 "iptables.g"
*dbg << " STATE MATCH=" << importer->current_state;
#line 2253 "IPTCfgParser.cpp"
#line 2250 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2267,11 +2264,11 @@ void IPTCfgParser::m_mport() {
try { // for error handling
match(M_MPORT);
if ( inputState->guessing==0 ) {
#line 814 "iptables.g"
#line 832 "iptables.g"
*dbg << " MULTIPORT";
#line 2275 "IPTCfgParser.cpp"
#line 2272 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2289,12 +2286,12 @@ void IPTCfgParser::m_icmp() {
try { // for error handling
match(ICMP);
if ( inputState->guessing==0 ) {
#line 895 "iptables.g"
#line 913 "iptables.g"
importer->protocol = "icmp";
*dbg << " ICMP";
#line 2298 "IPTCfgParser.cpp"
#line 2295 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2312,12 +2309,12 @@ void IPTCfgParser::m_tcp() {
try { // for error handling
match(TCP);
if ( inputState->guessing==0 ) {
#line 1038 "iptables.g"
#line 1056 "iptables.g"
importer->protocol = "tcp";
*dbg << " TCP";
#line 2321 "IPTCfgParser.cpp"
#line 2318 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2335,12 +2332,12 @@ void IPTCfgParser::m_udp() {
try { // for error handling
match(UDP);
if ( inputState->guessing==0 ) {
#line 1029 "iptables.g"
#line 1047 "iptables.g"
importer->protocol = "udp";
*dbg << " UDP";
#line 2344 "IPTCfgParser.cpp"
#line 2341 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2358,11 +2355,11 @@ void IPTCfgParser::m_limit() {
try { // for error handling
match(M_LIMIT);
if ( inputState->guessing==0 ) {
#line 684 "iptables.g"
#line 702 "iptables.g"
*dbg << " LIMIT";
#line 2366 "IPTCfgParser.cpp"
#line 2363 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2380,11 +2377,11 @@ void IPTCfgParser::m_length() {
try { // for error handling
match(M_LENGTH);
if ( inputState->guessing==0 ) {
#line 779 "iptables.g"
#line 797 "iptables.g"
*dbg << " LENGTH";
#line 2388 "IPTCfgParser.cpp"
#line 2385 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2402,11 +2399,11 @@ void IPTCfgParser::m_iprange() {
try { // for error handling
match(M_IPRANGE);
if ( inputState->guessing==0 ) {
#line 723 "iptables.g"
#line 741 "iptables.g"
*dbg << " IPRANGE";
#line 2410 "IPTCfgParser.cpp"
#line 2407 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2426,11 +2423,11 @@ void IPTCfgParser::m_comment() {
match(MATCH_COMMENT);
match(STRING);
if ( inputState->guessing==0 ) {
#line 822 "iptables.g"
#line 840 "iptables.g"
*dbg << " COMMENT=" << LT(0)->getText();
#line 2434 "IPTCfgParser.cpp"
#line 2431 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2465,13 +2462,13 @@ void IPTCfgParser::m_unknown_module() {
try { // for error handling
match(WORD);
if ( inputState->guessing==0 ) {
#line 630 "iptables.g"
#line 648 "iptables.g"
*dbg << " UNKNOWN MODULE=" << LT(0)->getText();
importer->markCurrentRuleBad(
std::string("Unknown module: ")+LT(0)->getText());
#line 2475 "IPTCfgParser.cpp"
#line 2472 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2541,12 +2538,12 @@ void IPTCfgParser::target_options() {
match(REJECT_WITH);
match(WORD);
if ( inputState->guessing==0 ) {
#line 428 "iptables.g"
#line 446 "iptables.g"
importer->action_params["reject_with"] = LT(0)->getText();
*dbg << " REJECT WITH=" << LT(0)->getText();
#line 2550 "IPTCfgParser.cpp"
#line 2547 "IPTCfgParser.cpp"
}
break;
}
@ -2572,12 +2569,12 @@ void IPTCfgParser::target_options() {
}
}
if ( inputState->guessing==0 ) {
#line 434 "iptables.g"
#line 452 "iptables.g"
importer->action_params["log_prefix"] = LT(0)->getText();
*dbg << " LOG PREFIX=" << LT(0)->getText();
#line 2581 "IPTCfgParser.cpp"
#line 2578 "IPTCfgParser.cpp"
}
break;
}
@ -2585,12 +2582,12 @@ void IPTCfgParser::target_options() {
{
match(LOG_TCP_SEQ);
if ( inputState->guessing==0 ) {
#line 440 "iptables.g"
#line 458 "iptables.g"
importer->action_params["log_tcp_seq"] = LT(0)->getText();
*dbg << " LOG TCP SEQUENCE=";
#line 2594 "IPTCfgParser.cpp"
#line 2591 "IPTCfgParser.cpp"
}
break;
}
@ -2598,12 +2595,12 @@ void IPTCfgParser::target_options() {
{
match(LOG_TCP_OPT);
if ( inputState->guessing==0 ) {
#line 446 "iptables.g"
#line 464 "iptables.g"
importer->action_params["log_tcp_options"] = LT(0)->getText();
*dbg << " LOG TCP OPTIONS=";
#line 2607 "IPTCfgParser.cpp"
#line 2604 "IPTCfgParser.cpp"
}
break;
}
@ -2611,12 +2608,12 @@ void IPTCfgParser::target_options() {
{
match(LOG_IP_OPT);
if ( inputState->guessing==0 ) {
#line 452 "iptables.g"
#line 470 "iptables.g"
importer->action_params["log_ip_options"] = LT(0)->getText();
*dbg << " LOG IP OPTIONS=";
#line 2620 "IPTCfgParser.cpp"
#line 2617 "IPTCfgParser.cpp"
}
break;
}
@ -2642,12 +2639,12 @@ void IPTCfgParser::target_options() {
}
}
if ( inputState->guessing==0 ) {
#line 458 "iptables.g"
#line 476 "iptables.g"
importer->action_params["log_prefix"] = LT(0)->getText();
*dbg << " ULOG PREFIX=" << LT(0)->getText();
#line 2651 "IPTCfgParser.cpp"
#line 2648 "IPTCfgParser.cpp"
}
break;
}
@ -2673,12 +2670,12 @@ void IPTCfgParser::target_options() {
}
}
if ( inputState->guessing==0 ) {
#line 464 "iptables.g"
#line 482 "iptables.g"
importer->action_params["log_level"] = LT(0)->getText();
*dbg << " LOG LEVEL=" << LT(0)->getText();
#line 2682 "IPTCfgParser.cpp"
#line 2679 "IPTCfgParser.cpp"
}
break;
}
@ -2704,12 +2701,12 @@ void IPTCfgParser::target_options() {
}
}
if ( inputState->guessing==0 ) {
#line 470 "iptables.g"
#line 488 "iptables.g"
importer->action_params["set_mark"] = LT(0)->getText();
*dbg << " SET MARK=" << LT(0)->getText();
#line 2713 "IPTCfgParser.cpp"
#line 2710 "IPTCfgParser.cpp"
}
break;
}
@ -2717,12 +2714,12 @@ void IPTCfgParser::target_options() {
{
match(SAVE_MARK);
if ( inputState->guessing==0 ) {
#line 488 "iptables.g"
#line 506 "iptables.g"
importer->action_params["connmark_save_mark"] = "--save-mark";
*dbg << " SAVE MARK";
#line 2726 "IPTCfgParser.cpp"
#line 2723 "IPTCfgParser.cpp"
}
break;
}
@ -2730,12 +2727,12 @@ void IPTCfgParser::target_options() {
{
match(RESTORE_MARK);
if ( inputState->guessing==0 ) {
#line 494 "iptables.g"
#line 512 "iptables.g"
importer->action_params["connmark_restore_mark"] = "--restore-mark";
*dbg << " RESTORE MARK";
#line 2739 "IPTCfgParser.cpp"
#line 2736 "IPTCfgParser.cpp"
}
break;
}
@ -2743,12 +2740,12 @@ void IPTCfgParser::target_options() {
{
match(CONTINUE);
if ( inputState->guessing==0 ) {
#line 500 "iptables.g"
#line 518 "iptables.g"
importer->action_params["route_continue"] = "--continue";
*dbg << " CONTINUE";
#line 2752 "IPTCfgParser.cpp"
#line 2749 "IPTCfgParser.cpp"
}
break;
}
@ -2757,12 +2754,12 @@ void IPTCfgParser::target_options() {
match(ROUTE_IIF);
match(WORD);
if ( inputState->guessing==0 ) {
#line 506 "iptables.g"
#line 524 "iptables.g"
importer->action_params["route_iif"] = LT(0)->getText();
*dbg << " ROUTE_IIF=" << LT(0)->getText();
#line 2766 "IPTCfgParser.cpp"
#line 2763 "IPTCfgParser.cpp"
}
break;
}
@ -2771,12 +2768,12 @@ void IPTCfgParser::target_options() {
match(ROUTE_OIF);
match(WORD);
if ( inputState->guessing==0 ) {
#line 512 "iptables.g"
#line 530 "iptables.g"
importer->action_params["route_oif"] = LT(0)->getText();
*dbg << " ROUTE_OIF=" << LT(0)->getText();
#line 2780 "IPTCfgParser.cpp"
#line 2777 "IPTCfgParser.cpp"
}
break;
}
@ -2785,12 +2782,12 @@ void IPTCfgParser::target_options() {
match(ROUTE_GW);
match(IPV4);
if ( inputState->guessing==0 ) {
#line 518 "iptables.g"
#line 536 "iptables.g"
importer->action_params["route_gw"] = LT(0)->getText();
*dbg << " ROUTE_GW=" << LT(0)->getText();
#line 2794 "IPTCfgParser.cpp"
#line 2791 "IPTCfgParser.cpp"
}
break;
}
@ -2798,12 +2795,12 @@ void IPTCfgParser::target_options() {
{
match(ROUTE_TEE);
if ( inputState->guessing==0 ) {
#line 524 "iptables.g"
#line 542 "iptables.g"
importer->action_params["route_tee"] = "--tee";
*dbg << " ROUTE_TEE";
#line 2807 "IPTCfgParser.cpp"
#line 2804 "IPTCfgParser.cpp"
}
break;
}
@ -2811,11 +2808,11 @@ void IPTCfgParser::target_options() {
{
match(TO_SOURCE);
if ( inputState->guessing==0 ) {
#line 530 "iptables.g"
#line 548 "iptables.g"
*dbg << " TO-SOURCE";
#line 2819 "IPTCfgParser.cpp"
#line 2816 "IPTCfgParser.cpp"
}
nat_spec();
break;
@ -2824,11 +2821,11 @@ void IPTCfgParser::target_options() {
{
match(TO_DESTINATION);
if ( inputState->guessing==0 ) {
#line 536 "iptables.g"
#line 554 "iptables.g"
*dbg << " TO-DESTINATION";
#line 2832 "IPTCfgParser.cpp"
#line 2829 "IPTCfgParser.cpp"
}
nat_spec();
break;
@ -2843,22 +2840,22 @@ void IPTCfgParser::target_options() {
{
match(TO_NETMAP);
if ( inputState->guessing==0 ) {
#line 544 "iptables.g"
#line 562 "iptables.g"
*dbg << " TO-NETMAP";
#line 2851 "IPTCfgParser.cpp"
#line 2848 "IPTCfgParser.cpp"
}
{
match(IPV4);
if ( inputState->guessing==0 ) {
#line 549 "iptables.g"
#line 567 "iptables.g"
importer->nat_addr1 = LT(0)->getText();
importer->nat_addr2 = LT(0)->getText();
*dbg << LT(0)->getText();
#line 2862 "IPTCfgParser.cpp"
#line 2859 "IPTCfgParser.cpp"
}
match(SLASH);
{
@ -2880,12 +2877,12 @@ void IPTCfgParser::target_options() {
}
}
if ( inputState->guessing==0 ) {
#line 555 "iptables.g"
#line 573 "iptables.g"
importer->nat_nm = LT(0)->getText();
*dbg << "/" << LT(0)->getText();
#line 2889 "IPTCfgParser.cpp"
#line 2886 "IPTCfgParser.cpp"
}
}
break;
@ -2894,12 +2891,12 @@ void IPTCfgParser::target_options() {
{
match(CLAMP_MSS);
if ( inputState->guessing==0 ) {
#line 562 "iptables.g"
#line 580 "iptables.g"
importer->action_params["clamp-mss-to-pmtu"] = "--clamp-mss-to-pmtu";
*dbg << " TO-NETMAP";
#line 2903 "IPTCfgParser.cpp"
#line 2900 "IPTCfgParser.cpp"
}
break;
}
@ -2908,24 +2905,24 @@ void IPTCfgParser::target_options() {
match(SET_TOS);
match(HEX_CONST);
if ( inputState->guessing==0 ) {
#line 476 "iptables.g"
#line 494 "iptables.g"
importer->action_params["set_tos"] = LT(0)->getText();
*dbg << " SET TOS=" << LT(0)->getText();
#line 2917 "IPTCfgParser.cpp"
#line 2914 "IPTCfgParser.cpp"
}
}
else if ((LA(1) == SET_TOS) && (LA(2) == WORD)) {
match(SET_TOS);
match(WORD);
if ( inputState->guessing==0 ) {
#line 482 "iptables.g"
#line 500 "iptables.g"
importer->action_params["set_tos"] = LT(0)->getText();
*dbg << " SET TOS=" << LT(0)->getText();
#line 2929 "IPTCfgParser.cpp"
#line 2926 "IPTCfgParser.cpp"
}
}
else {
@ -3015,7 +3012,7 @@ void IPTCfgParser::nat_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 573 "iptables.g"
#line 591 "iptables.g"
*dbg << " "
<< importer->nat_addr1
@ -3026,7 +3023,7 @@ void IPTCfgParser::nat_spec() {
<< "-"
<< importer->nat_port_range_end;
#line 3030 "IPTCfgParser.cpp"
#line 3027 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3044,7 +3041,7 @@ void IPTCfgParser::redirect_spec() {
try { // for error handling
nat_port_def_with_range();
if ( inputState->guessing==0 ) {
#line 608 "iptables.g"
#line 626 "iptables.g"
*dbg << " TO-PORTS "
<< importer->nat_addr1
@ -3055,7 +3052,7 @@ void IPTCfgParser::redirect_spec() {
<< "-"
<< importer->nat_port_range_end;
#line 3059 "IPTCfgParser.cpp"
#line 3056 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3098,28 +3095,28 @@ void IPTCfgParser::nat_addr_range() {
a2 = LT(1);
match(IPV4);
if ( inputState->guessing==0 ) {
#line 589 "iptables.g"
#line 607 "iptables.g"
importer->nat_port_range_start = "";
importer->nat_port_range_end = "";
importer->nat_addr1 = a1->getText();
importer->nat_addr2 = a2->getText();
#line 3109 "IPTCfgParser.cpp"
#line 3106 "IPTCfgParser.cpp"
}
}
}
else if ((LA(1) == IPV4) && (_tokenSet_8.member(LA(2)))) {
match(IPV4);
if ( inputState->guessing==0 ) {
#line 598 "iptables.g"
#line 616 "iptables.g"
importer->nat_port_range_start = "";
importer->nat_port_range_end = "";
importer->nat_addr1 = LT(0)->getText();
importer->nat_addr2 = LT(0)->getText();
#line 3123 "IPTCfgParser.cpp"
#line 3120 "IPTCfgParser.cpp"
}
}
else {
@ -3195,13 +3192,13 @@ void IPTCfgParser::nat_port_def_with_range() {
}
}
if ( inputState->guessing==0 ) {
#line 978 "iptables.g"
#line 996 "iptables.g"
importer->nat_port_range_start = LT(0)->getText();
importer->nat_port_range_end = LT(0)->getText();
*dbg << " PORT=" << LT(0)->getText();
#line 3205 "IPTCfgParser.cpp"
#line 3202 "IPTCfgParser.cpp"
}
match(MINUS);
{
@ -3223,12 +3220,12 @@ void IPTCfgParser::nat_port_def_with_range() {
}
}
if ( inputState->guessing==0 ) {
#line 984 "iptables.g"
#line 1002 "iptables.g"
importer->nat_port_range_end = LT(0)->getText();
*dbg << ":" << LT(0)->getText();
#line 3232 "IPTCfgParser.cpp"
#line 3229 "IPTCfgParser.cpp"
}
}
}
@ -3252,13 +3249,13 @@ void IPTCfgParser::nat_port_def_with_range() {
}
}
if ( inputState->guessing==0 ) {
#line 991 "iptables.g"
#line 1009 "iptables.g"
importer->nat_port_range_start = LT(0)->getText();
importer->nat_port_range_end = LT(0)->getText();
*dbg << " PORT=" << LT(0)->getText();
#line 3262 "IPTCfgParser.cpp"
#line 3259 "IPTCfgParser.cpp"
}
}
else {
@ -3323,11 +3320,11 @@ void IPTCfgParser::m_mark() {
try { // for error handling
match(M_MARK);
if ( inputState->guessing==0 ) {
#line 665 "iptables.g"
#line 683 "iptables.g"
*dbg << " MARK";
#line 3331 "IPTCfgParser.cpp"
#line 3328 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3345,25 +3342,25 @@ void IPTCfgParser::limit_rate() {
try { // for error handling
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 695 "iptables.g"
#line 713 "iptables.g"
importer->limit_val = LT(0)->getText();
#line 3351 "IPTCfgParser.cpp"
#line 3348 "IPTCfgParser.cpp"
}
match(SLASH);
match(WORD);
if ( inputState->guessing==0 ) {
#line 697 "iptables.g"
#line 715 "iptables.g"
importer->limit_suffix = LT(0)->getText();
#line 3358 "IPTCfgParser.cpp"
#line 3355 "IPTCfgParser.cpp"
}
if ( inputState->guessing==0 ) {
#line 698 "iptables.g"
#line 716 "iptables.g"
*dbg << " MATCH LIMIT "
<< importer->limit_val << "/"
<< importer->limit_suffix;
#line 3367 "IPTCfgParser.cpp"
#line 3364 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3381,11 +3378,11 @@ void IPTCfgParser::m_recent() {
try { // for error handling
match(M_RECENT);
if ( inputState->guessing==0 ) {
#line 715 "iptables.g"
#line 733 "iptables.g"
*dbg << " RECENT";
#line 3389 "IPTCfgParser.cpp"
#line 3386 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3483,9 +3480,9 @@ void IPTCfgParser::recent_args_no_param() {
}
}
if ( inputState->guessing==0 ) {
#line 767 "iptables.g"
#line 785 "iptables.g"
importer->recent_match += LT(0)->getText() + " ";
#line 3489 "IPTCfgParser.cpp"
#line 3486 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3525,9 +3522,9 @@ void IPTCfgParser::recent_args_param() {
}
}
if ( inputState->guessing==0 ) {
#line 771 "iptables.g"
#line 789 "iptables.g"
importer->recent_match += LT(0)->getText() + " ";
#line 3531 "IPTCfgParser.cpp"
#line 3528 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3548,9 +3545,9 @@ void IPTCfgParser::recent_args_param() {
}
}
if ( inputState->guessing==0 ) {
#line 773 "iptables.g"
#line 791 "iptables.g"
importer->recent_match += LT(0)->getText() + " ";
#line 3554 "IPTCfgParser.cpp"
#line 3551 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3568,24 +3565,24 @@ void IPTCfgParser::length_spec() {
try { // for error handling
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 790 "iptables.g"
#line 808 "iptables.g"
importer->length_spec = LT(0)->getText();
#line 3574 "IPTCfgParser.cpp"
#line 3571 "IPTCfgParser.cpp"
}
match(COLON);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 792 "iptables.g"
#line 810 "iptables.g"
importer->length_spec += ":";
importer->length_spec += LT(0)->getText();
#line 3582 "IPTCfgParser.cpp"
#line 3579 "IPTCfgParser.cpp"
}
if ( inputState->guessing==0 ) {
#line 794 "iptables.g"
#line 812 "iptables.g"
*dbg << " MATCH LENGTH " << importer->length_spec;
#line 3589 "IPTCfgParser.cpp"
#line 3586 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3625,12 +3622,12 @@ void IPTCfgParser::pkt_type_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 805 "iptables.g"
#line 823 "iptables.g"
importer->pkt_type_spec = LT(0)->getText();
*dbg << " PKT_TYPE " << importer->pkt_type_spec;
#line 3634 "IPTCfgParser.cpp"
#line 3631 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3665,13 +3662,13 @@ void IPTCfgParser::port_def_no_range() {
}
}
if ( inputState->guessing==0 ) {
#line 931 "iptables.g"
#line 949 "iptables.g"
importer->tmp_port_range_start = LT(0)->getText();
importer->tmp_port_range_end = LT(0)->getText();
*dbg << " PORT=" << LT(0)->getText();
#line 3675 "IPTCfgParser.cpp"
#line 3672 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3715,13 +3712,13 @@ void IPTCfgParser::port_def_with_range() {
}
}
if ( inputState->guessing==0 ) {
#line 949 "iptables.g"
#line 967 "iptables.g"
importer->tmp_port_range_start = LT(0)->getText();
importer->tmp_port_range_end = LT(0)->getText();
*dbg << " PORT=" << LT(0)->getText();
#line 3725 "IPTCfgParser.cpp"
#line 3722 "IPTCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3778,12 +3775,12 @@ void IPTCfgParser::port_def_with_range() {
}
}
if ( inputState->guessing==0 ) {
#line 956 "iptables.g"
#line 974 "iptables.g"
importer->tmp_port_range_end = LT(0)->getText();
*dbg << ":" << LT(0)->getText();
#line 3787 "IPTCfgParser.cpp"
#line 3784 "IPTCfgParser.cpp"
}
break;
}
@ -3858,13 +3855,13 @@ void IPTCfgParser::port_def_with_incomplete_range() {
}
}
if ( inputState->guessing==0 ) {
#line 965 "iptables.g"
#line 983 "iptables.g"
importer->tmp_port_range_start = "0";
importer->tmp_port_range_end = LT(0)->getText();
*dbg << "PORT 0:" << LT(0)->getText();
#line 3868 "IPTCfgParser.cpp"
#line 3865 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3882,7 +3879,7 @@ void IPTCfgParser::syn() {
try { // for error handling
match(MATCH_SYN);
if ( inputState->guessing==0 ) {
#line 1054 "iptables.g"
#line 1072 "iptables.g"
importer->tcp_flags_mask.clear();
importer->tcp_flags_mask.push_back(libfwbuilder::TCPService::SYN);
@ -3892,7 +3889,7 @@ void IPTCfgParser::syn() {
importer->tcp_flags_comp.clear();
importer->tcp_flags_comp.push_back(libfwbuilder::TCPService::SYN);
#line 3896 "IPTCfgParser.cpp"
#line 3893 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3911,16 +3908,16 @@ void IPTCfgParser::tcp_flags() {
match(MATCH_TCP_FLAGS);
tcp_flags_list();
if ( inputState->guessing==0 ) {
#line 1105 "iptables.g"
#line 1123 "iptables.g"
importer->tcp_flags_mask = importer->tmp_tcp_flags_list;
importer->tmp_tcp_flags_list.clear();
#line 3920 "IPTCfgParser.cpp"
#line 3917 "IPTCfgParser.cpp"
}
tcp_flags_list();
if ( inputState->guessing==0 ) {
#line 1110 "iptables.g"
#line 1128 "iptables.g"
importer->tcp_flags_comp = importer->tmp_tcp_flags_list;
importer->tmp_tcp_flags_list.clear();
@ -3931,7 +3928,7 @@ void IPTCfgParser::tcp_flags() {
foreach(int x, importer->tcp_flags_comp)
*dbg << x << "|";
#line 3935 "IPTCfgParser.cpp"
#line 3932 "IPTCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3987,9 +3984,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(SYN);
if ( inputState->guessing==0 ) {
#line 1067 "iptables.g"
#line 1085 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::SYN;
#line 3993 "IPTCfgParser.cpp"
#line 3990 "IPTCfgParser.cpp"
}
break;
}
@ -3997,9 +3994,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(ACK);
if ( inputState->guessing==0 ) {
#line 1069 "iptables.g"
#line 1087 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::ACK;
#line 4003 "IPTCfgParser.cpp"
#line 4000 "IPTCfgParser.cpp"
}
break;
}
@ -4007,9 +4004,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(FIN);
if ( inputState->guessing==0 ) {
#line 1071 "iptables.g"
#line 1089 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::FIN;
#line 4013 "IPTCfgParser.cpp"
#line 4010 "IPTCfgParser.cpp"
}
break;
}
@ -4017,9 +4014,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(RST);
if ( inputState->guessing==0 ) {
#line 1073 "iptables.g"
#line 1091 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::RST;
#line 4023 "IPTCfgParser.cpp"
#line 4020 "IPTCfgParser.cpp"
}
break;
}
@ -4027,9 +4024,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(URG);
if ( inputState->guessing==0 ) {
#line 1075 "iptables.g"
#line 1093 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::URG;
#line 4033 "IPTCfgParser.cpp"
#line 4030 "IPTCfgParser.cpp"
}
break;
}
@ -4037,9 +4034,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(PSH);
if ( inputState->guessing==0 ) {
#line 1077 "iptables.g"
#line 1095 "iptables.g"
importer->tmp_tcp_flag_code = libfwbuilder::TCPService::PSH;
#line 4043 "IPTCfgParser.cpp"
#line 4040 "IPTCfgParser.cpp"
}
break;
}
@ -4047,9 +4044,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(ALL);
if ( inputState->guessing==0 ) {
#line 1079 "iptables.g"
#line 1097 "iptables.g"
importer->tmp_tcp_flag_code = 99;
#line 4053 "IPTCfgParser.cpp"
#line 4050 "IPTCfgParser.cpp"
}
break;
}
@ -4057,9 +4054,9 @@ void IPTCfgParser::tcp_flag_word() {
{
match(NONE);
if ( inputState->guessing==0 ) {
#line 1081 "iptables.g"
#line 1099 "iptables.g"
importer->tmp_tcp_flag_code = 98;
#line 4063 "IPTCfgParser.cpp"
#line 4060 "IPTCfgParser.cpp"
}
break;
}
@ -4084,20 +4081,20 @@ void IPTCfgParser::tcp_flags_list() {
try { // for error handling
if ( inputState->guessing==0 ) {
#line 1086 "iptables.g"
#line 1104 "iptables.g"
importer->tmp_tcp_flags_list.clear();
importer->tmp_tcp_flag_code = 0;
#line 4093 "IPTCfgParser.cpp"
#line 4090 "IPTCfgParser.cpp"
}
tcp_flag_word();
if ( inputState->guessing==0 ) {
#line 1091 "iptables.g"
#line 1109 "iptables.g"
importer->tmp_tcp_flags_list.push_back(importer->tmp_tcp_flag_code);
#line 4101 "IPTCfgParser.cpp"
#line 4098 "IPTCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -4105,12 +4102,12 @@ void IPTCfgParser::tcp_flags_list() {
match(COMMA);
tcp_flag_word();
if ( inputState->guessing==0 ) {
#line 1096 "iptables.g"
#line 1114 "iptables.g"
importer->tmp_tcp_flags_list.push_back(
importer->tmp_tcp_flag_code);
#line 4114 "IPTCfgParser.cpp"
#line 4111 "IPTCfgParser.cpp"
}
}
else {

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "IPTImporter.h"
#line 10 "IPTCfgParser.hpp"
#line 11 "IPTCfgParser.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "iptables.g" -> "IPTCfgParser.hpp"$ */
#include <antlr/TokenStream.hpp>
@ -14,7 +15,7 @@
#include "IPTCfgParserTokenTypes.hpp"
#include <antlr/LLkParser.hpp>
#line 32 "iptables.g"
#line 34 "iptables.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,16 +24,16 @@
class IPTImporter;
#line 27 "IPTCfgParser.hpp"
#line 64 "iptables.g"
#line 28 "IPTCfgParser.hpp"
#line 63 "iptables.g"
// gets inserted after generated namespace specifications in the
// header file. But outside the generated class.
#line 33 "IPTCfgParser.hpp"
#line 34 "IPTCfgParser.hpp"
class CUSTOM_API IPTCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public IPTCfgParserTokenTypes
{
#line 81 "iptables.g"
#line 80 "iptables.g"
// additional methods and members
@ -40,7 +41,26 @@ class CUSTOM_API IPTCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, publ
std::ostream *dbg;
IPTImporter *importer;
#line 37 "IPTCfgParser.hpp"
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
#line 38 "IPTCfgParser.hpp"
public:
void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory );
protected:

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgLexer.cpp"$ */
#line 40 "pix.g"
#line 42 "pix.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -14,18 +14,16 @@
#include <antlr/CharStreamIOException.hpp>
#include <antlr/NoViableAltForCharException.hpp>
#line 46 "pix.g"
#line 48 "pix.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "PIXImporter.h"
#line 27 "PIXCfgLexer.cpp"
#line 25 "PIXCfgLexer.cpp"
#line 1 "pix.g"
#line 29 "PIXCfgLexer.cpp"
#line 27 "PIXCfgLexer.cpp"
PIXCfgLexer::PIXCfgLexer(ANTLR_USE_NAMESPACE(std)istream& in)
: ANTLR_USE_NAMESPACE(antlr)CharScanner(new ANTLR_USE_NAMESPACE(antlr)CharBuffer(in),true)
{
@ -482,9 +480,9 @@ void PIXCfgLexer::mNEWLINE(bool _createToken) {
}
if ( inputState->guessing==0 ) {
#line 1526 "pix.g"
#line 1552 "pix.g"
newline();
#line 488 "PIXCfgLexer.cpp"
#line 486 "PIXCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -606,9 +604,9 @@ void PIXCfgLexer::mWhitespace(bool _createToken) {
}
}
if ( inputState->guessing==0 ) {
#line 1521 "pix.g"
#line 1547 "pix.g"
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
#line 612 "PIXCfgLexer.cpp"
#line 610 "PIXCfgLexer.cpp"
}
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
_token = makeToken(_ttype);
@ -835,9 +833,9 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 1560 "pix.g"
#line 1586 "pix.g"
_ttype = IPV6;
#line 841 "PIXCfgLexer.cpp"
#line 839 "PIXCfgLexer.cpp"
}
}
}
@ -982,9 +980,9 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
} // ( ... )+
}
if ( inputState->guessing==0 ) {
#line 1549 "pix.g"
#line 1575 "pix.g"
_ttype = IPV4;
#line 988 "PIXCfgLexer.cpp"
#line 986 "PIXCfgLexer.cpp"
}
}
else {
@ -1081,9 +1079,9 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
_loop232:;
} // ( ... )+
if ( inputState->guessing==0 ) {
#line 1553 "pix.g"
#line 1579 "pix.g"
_ttype = INT_CONST;
#line 1087 "PIXCfgLexer.cpp"
#line 1085 "PIXCfgLexer.cpp"
}
}
else {
@ -1326,9 +1324,9 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
_loop247:;
} // ( ... )*
if ( inputState->guessing==0 ) {
#line 1566 "pix.g"
#line 1592 "pix.g"
_ttype = WORD;
#line 1332 "PIXCfgLexer.cpp"
#line 1330 "PIXCfgLexer.cpp"
}
}
else {

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "PIXImporter.h"
#line 10 "PIXCfgLexer.hpp"
#line 11 "PIXCfgLexer.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgLexer.hpp"$ */
#include <antlr/CommonToken.hpp>
@ -14,7 +15,7 @@
#include <antlr/BitSet.hpp>
#include "PIXCfgParserTokenTypes.hpp"
#include <antlr/CharScanner.hpp>
#line 30 "pix.g"
#line 32 "pix.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,17 +24,17 @@
class PIXImporter;
#line 27 "PIXCfgLexer.hpp"
#line 28 "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"
#line 34 "PIXCfgLexer.hpp"
class CUSTOM_API PIXCfgLexer : public ANTLR_USE_NAMESPACE(antlr)CharScanner, public PIXCfgParserTokenTypes
{
#line 1 "pix.g"
#line 37 "PIXCfgLexer.hpp"
#line 38 "PIXCfgLexer.hpp"
private:
void initLiterals();
public:

View File

@ -1,5 +1,5 @@
/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgParser.cpp"$ */
#line 40 "pix.g"
#line 42 "pix.g"
// gets inserted before the antlr generated includes in the cpp
// file
@ -9,18 +9,16 @@
#include <antlr/NoViableAltException.hpp>
#include <antlr/SemanticException.hpp>
#include <antlr/ASTFactory.hpp>
#line 46 "pix.g"
#line 48 "pix.g"
// gets inserted after the antlr generated includes in the cpp
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "PIXImporter.h"
#line 22 "PIXCfgParser.cpp"
#line 20 "PIXCfgParser.cpp"
#line 1 "pix.g"
#line 24 "PIXCfgParser.cpp"
#line 22 "PIXCfgParser.cpp"
PIXCfgParser::PIXCfgParser(ANTLR_USE_NAMESPACE(antlr)TokenBuffer& tokenBuf, int k)
: ANTLR_USE_NAMESPACE(antlr)LLkParser(tokenBuf,k)
{
@ -231,14 +229,14 @@ void PIXCfgParser::version() {
match(VERSION_WORD);
match(NUMBER);
if ( inputState->guessing==0 ) {
#line 743 "pix.g"
#line 769 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setDiscoveredVersion(LT(0)->getText());
*dbg << "VERSION " << LT(0)->getText() << std::endl;
consumeUntil(NEWLINE);
#line 242 "PIXCfgParser.cpp"
#line 240 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -274,7 +272,7 @@ void PIXCfgParser::hostname() {
}
}
if ( inputState->guessing==0 ) {
#line 753 "pix.g"
#line 779 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setHostName( LT(0)->getText() );
@ -282,7 +280,7 @@ void PIXCfgParser::hostname() {
<< "LT0=" << LT(0)->getText()
<< std::endl;
#line 286 "PIXCfgParser.cpp"
#line 284 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -304,7 +302,7 @@ void PIXCfgParser::ip_access_list_ext() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 789 "pix.g"
#line 815 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -313,7 +311,7 @@ void PIXCfgParser::ip_access_list_ext() {
*dbg << name->getLine() << ":"
<< " ACL ext " << name->getText() << std::endl;
#line 317 "PIXCfgParser.cpp"
#line 315 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -350,12 +348,12 @@ void PIXCfgParser::ip_access_list_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 808 "pix.g"
#line 834 "pix.g"
*dbg << LT(0)->getLine() << ":"
<< " ACL line end" << std::endl << std::endl;
#line 359 "PIXCfgParser.cpp"
#line 357 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -374,11 +372,11 @@ void PIXCfgParser::community_list_command() {
match(IP);
match(COMMUNITY_LIST);
if ( inputState->guessing==0 ) {
#line 144 "pix.g"
#line 170 "pix.g"
consumeUntil(NEWLINE);
#line 382 "PIXCfgParser.cpp"
#line 380 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -397,11 +395,11 @@ void PIXCfgParser::unknown_ip_command() {
match(IP);
match(WORD);
if ( inputState->guessing==0 ) {
#line 721 "pix.g"
#line 747 "pix.g"
consumeUntil(NEWLINE);
#line 405 "PIXCfgParser.cpp"
#line 403 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -422,7 +420,7 @@ void PIXCfgParser::intrface() {
in = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 1070 "pix.g"
#line 1096 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newInterface( in->getText() );
@ -430,7 +428,7 @@ void PIXCfgParser::intrface() {
<< " INTRFACE: " << in->getText() << std::endl;
consumeUntil(NEWLINE);
#line 434 "PIXCfgParser.cpp"
#line 432 "PIXCfgParser.cpp"
}
{
if ((LA(1) == NEWLINE) && (_tokenSet_2.member(LA(2)))) {
@ -453,13 +451,13 @@ void PIXCfgParser::intrface() {
{
}
if ( inputState->guessing==0 ) {
#line 1083 "pix.g"
#line 1109 "pix.g"
importer->ignoreCurrentInterface();
*dbg<< LT(1)->getLine() << ":"
<< " EMPTY INTERFACE " << std::endl;
#line 463 "PIXCfgParser.cpp"
#line 461 "PIXCfgParser.cpp"
}
}
else {
@ -485,12 +483,12 @@ void PIXCfgParser::controller() {
try { // for error handling
match(CONTROLLER);
if ( inputState->guessing==0 ) {
#line 1024 "pix.g"
#line 1050 "pix.g"
importer->clearCurrentInterface();
consumeUntil(NEWLINE);
#line 494 "PIXCfgParser.cpp"
#line 492 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -511,7 +509,7 @@ void PIXCfgParser::access_list_commands() {
acl_num = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 769 "pix.g"
#line 795 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -520,7 +518,7 @@ void PIXCfgParser::access_list_commands() {
*dbg << acl_num->getLine() << ":"
<< " ACL #" << acl_num->getText() << " ";
#line 524 "PIXCfgParser.cpp"
#line 522 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -577,12 +575,12 @@ void PIXCfgParser::certificate() {
match(CERTIFICATE);
match(WORD);
if ( inputState->guessing==0 ) {
#line 735 "pix.g"
#line 761 "pix.g"
consumeUntil(NEWLINE);
consumeUntil(QUIT);
#line 586 "PIXCfgParser.cpp"
#line 584 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -600,11 +598,11 @@ void PIXCfgParser::quit() {
try { // for error handling
match(QUIT);
if ( inputState->guessing==0 ) {
#line 137 "pix.g"
#line 163 "pix.g"
consumeUntil(NEWLINE);
#line 608 "PIXCfgParser.cpp"
#line 606 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -622,7 +620,7 @@ void PIXCfgParser::names_section() {
try { // for error handling
match(NAMES);
if ( inputState->guessing==0 ) {
#line 151 "pix.g"
#line 177 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->addMessageToLog(
@ -630,7 +628,7 @@ void PIXCfgParser::names_section() {
"Import of configuration that uses \"names\" "
"is not supported at this time");
#line 634 "PIXCfgParser.cpp"
#line 632 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -673,7 +671,7 @@ void PIXCfgParser::name_entry() {
n = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 161 "pix.g"
#line 187 "pix.g"
if (a)
{
@ -689,7 +687,7 @@ void PIXCfgParser::name_entry() {
consumeUntil(NEWLINE);
}
#line 693 "PIXCfgParser.cpp"
#line 691 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -711,7 +709,7 @@ void PIXCfgParser::named_object_network() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 194 "pix.g"
#line 220 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -719,7 +717,7 @@ void PIXCfgParser::named_object_network() {
*dbg << name->getLine() << ":"
<< " Named Object " << name->getText() << std::endl;
#line 723 "PIXCfgParser.cpp"
#line 721 "PIXCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -754,7 +752,7 @@ void PIXCfgParser::named_object_service() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 304 "pix.g"
#line 330 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -762,7 +760,7 @@ void PIXCfgParser::named_object_service() {
*dbg << name->getLine() << ":"
<< " Named Object " << name->getText() << std::endl;
#line 766 "PIXCfgParser.cpp"
#line 764 "PIXCfgParser.cpp"
}
{ // ( ... )*
for (;;) {
@ -797,7 +795,7 @@ void PIXCfgParser::object_group_network() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 419 "pix.g"
#line 445 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -805,7 +803,7 @@ void PIXCfgParser::object_group_network() {
*dbg << name->getLine() << ":"
<< " Object Group " << name->getText() << std::endl;
#line 809 "PIXCfgParser.cpp"
#line 807 "PIXCfgParser.cpp"
}
{ // ( ... )+
int _cnt48=0;
@ -841,7 +839,7 @@ void PIXCfgParser::object_group_service() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 640 "pix.g"
#line 666 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -849,7 +847,7 @@ void PIXCfgParser::object_group_service() {
*dbg << name->getLine() << ":"
<< " Object Group " << name->getText() << std::endl;
#line 853 "PIXCfgParser.cpp"
#line 851 "PIXCfgParser.cpp"
}
{ // ( ... )+
int _cnt79=0;
@ -885,7 +883,7 @@ void PIXCfgParser::object_group_protocol() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 517 "pix.g"
#line 543 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -893,7 +891,7 @@ void PIXCfgParser::object_group_protocol() {
*dbg << name->getLine() << ":"
<< " Object Group " << name->getText() << std::endl;
#line 897 "PIXCfgParser.cpp"
#line 895 "PIXCfgParser.cpp"
}
{ // ( ... )+
int _cnt60=0;
@ -929,7 +927,7 @@ void PIXCfgParser::object_group_icmp_8_0() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 572 "pix.g"
#line 598 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -937,7 +935,7 @@ void PIXCfgParser::object_group_icmp_8_0() {
*dbg << name->getLine() << ":"
<< " Object Group " << name->getText() << std::endl;
#line 941 "PIXCfgParser.cpp"
#line 939 "PIXCfgParser.cpp"
}
{ // ( ... )+
int _cnt68=0;
@ -973,7 +971,7 @@ void PIXCfgParser::object_group_icmp_8_3() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 585 "pix.g"
#line 611 "pix.g"
importer->clear();
importer->setCurrentLineNumber(LT(0)->getLine());
@ -981,7 +979,7 @@ void PIXCfgParser::object_group_icmp_8_3() {
*dbg << name->getLine() << ":"
<< " Object Group " << name->getText() << std::endl;
#line 985 "PIXCfgParser.cpp"
#line 983 "PIXCfgParser.cpp"
}
{ // ( ... )+
int _cnt71=0;
@ -1013,11 +1011,11 @@ void PIXCfgParser::crypto() {
try { // for error handling
match(CRYPTO);
if ( inputState->guessing==0 ) {
#line 714 "pix.g"
#line 740 "pix.g"
consumeUntil(NEWLINE);
#line 1021 "PIXCfgParser.cpp"
#line 1019 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1035,11 +1033,11 @@ void PIXCfgParser::unknown_command() {
try { // for error handling
match(WORD);
if ( inputState->guessing==0 ) {
#line 728 "pix.g"
#line 754 "pix.g"
consumeUntil(NEWLINE);
#line 1043 "PIXCfgParser.cpp"
#line 1041 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1201,7 +1199,7 @@ void PIXCfgParser::named_object_nat() {
try { // for error handling
match(NAT);
if ( inputState->guessing==0 ) {
#line 222 "pix.g"
#line 248 "pix.g"
importer->addMessageToLog(
"Parser warning: "
@ -1209,7 +1207,7 @@ void PIXCfgParser::named_object_nat() {
"is not supported at this time");
consumeUntil(NEWLINE);
#line 1213 "PIXCfgParser.cpp"
#line 1211 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1251,7 +1249,7 @@ void PIXCfgParser::host_addr() {
}
}
if ( inputState->guessing==0 ) {
#line 253 "pix.g"
#line 279 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
if (h)
@ -1268,7 +1266,7 @@ void PIXCfgParser::host_addr() {
consumeUntil(NEWLINE);
}
#line 1272 "PIXCfgParser.cpp"
#line 1270 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1294,7 +1292,7 @@ void PIXCfgParser::range_addr() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 272 "pix.g"
#line 298 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->tmp_range_1 = r1->getText();
@ -1302,7 +1300,7 @@ void PIXCfgParser::range_addr() {
importer->commitNamedAddressRangeObject();
*dbg << r1->getText() << "/" << r2->getText();
#line 1306 "PIXCfgParser.cpp"
#line 1304 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1349,7 +1347,7 @@ void PIXCfgParser::subnet_addr() {
}
}
if ( inputState->guessing==0 ) {
#line 282 "pix.g"
#line 308 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
if (a)
@ -1366,7 +1364,7 @@ void PIXCfgParser::subnet_addr() {
consumeUntil(NEWLINE);
}
#line 1370 "PIXCfgParser.cpp"
#line 1368 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1384,7 +1382,7 @@ void PIXCfgParser::named_object_description() {
try { // for error handling
match(DESCRIPTION);
if ( inputState->guessing==0 ) {
#line 232 "pix.g"
#line 258 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
*dbg << LT(1)->getLine() << ":";
@ -1397,7 +1395,7 @@ void PIXCfgParser::named_object_description() {
importer->setNamedObjectDescription(descr);
*dbg << " DESCRIPTION " << descr << std::endl;
#line 1401 "PIXCfgParser.cpp"
#line 1399 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1462,11 +1460,11 @@ void PIXCfgParser::service_icmp() {
icmp_type = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 336 "pix.g"
#line 362 "pix.g"
importer->icmp_type = LT(0)->getText();
#line 1470 "PIXCfgParser.cpp"
#line 1468 "PIXCfgParser.cpp"
}
break;
}
@ -1475,11 +1473,11 @@ void PIXCfgParser::service_icmp() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 340 "pix.g"
#line 366 "pix.g"
importer->icmp_spec = icmp_word->getText();
#line 1483 "PIXCfgParser.cpp"
#line 1481 "PIXCfgParser.cpp"
}
break;
}
@ -1490,13 +1488,13 @@ void PIXCfgParser::service_icmp() {
}
}
if ( inputState->guessing==0 ) {
#line 344 "pix.g"
#line 370 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->commitNamedICMPServiceObject();
*dbg << "NAMED OBJECT SERVICE ICMP " << LT(0)->getText() << " ";
#line 1500 "PIXCfgParser.cpp"
#line 1498 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1533,7 +1531,7 @@ void PIXCfgParser::service_icmp6() {
}
}
if ( inputState->guessing==0 ) {
#line 352 "pix.g"
#line 378 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->addMessageToLog("Parser warning: "
@ -1542,7 +1540,7 @@ void PIXCfgParser::service_icmp6() {
*dbg << "NAMED OBJECT SERVICE ICMP6 " << LT(0)->getText() << " ";
consumeUntil(NEWLINE);
#line 1546 "PIXCfgParser.cpp"
#line 1544 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1578,12 +1576,12 @@ void PIXCfgParser::service_tcp_udp() {
}
}
if ( inputState->guessing==0 ) {
#line 363 "pix.g"
#line 389 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "NAMED OBJECT SERVICE " << LT(0)->getText() << " ";
#line 1587 "PIXCfgParser.cpp"
#line 1585 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -1669,12 +1667,12 @@ void PIXCfgParser::service_tcp_udp() {
}
}
if ( inputState->guessing==0 ) {
#line 369 "pix.g"
#line 395 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->commitNamedTCPUDPServiceObject();
#line 1678 "PIXCfgParser.cpp"
#line 1676 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1724,14 +1722,14 @@ void PIXCfgParser::service_other() {
}
}
if ( inputState->guessing==0 ) {
#line 388 "pix.g"
#line 414 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->protocol = LT(0)->getText();
importer->commitNamedIPServiceObject();
*dbg << "NAMED OBJECT SERVICE " << LT(0)->getText() << " ";
#line 1735 "PIXCfgParser.cpp"
#line 1733 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1750,7 +1748,7 @@ void PIXCfgParser::service_unknown() {
match(SERVICE);
match(WORD);
if ( inputState->guessing==0 ) {
#line 403 "pix.g"
#line 429 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->protocol = "ip";
@ -1761,7 +1759,7 @@ void PIXCfgParser::service_unknown() {
importer->addMessageToLog(err);
*dbg << "UNKNOWN SERVICE " << LT(0)->getText() << " ";
#line 1765 "PIXCfgParser.cpp"
#line 1763 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1780,11 +1778,11 @@ void PIXCfgParser::src_port_spec() {
match(SOURCE);
xoperator();
if ( inputState->guessing==0 ) {
#line 376 "pix.g"
#line 402 "pix.g"
importer->SaveTmpPortToSrc();
#line 1788 "PIXCfgParser.cpp"
#line 1786 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1823,11 +1821,11 @@ void PIXCfgParser::dst_port_spec() {
}
xoperator();
if ( inputState->guessing==0 ) {
#line 382 "pix.g"
#line 408 "pix.g"
importer->SaveTmpPortToDst();
#line 1831 "PIXCfgParser.cpp"
#line 1829 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1916,7 +1914,7 @@ void PIXCfgParser::object_group_description() {
try { // for error handling
match(DESCRIPTION);
if ( inputState->guessing==0 ) {
#line 443 "pix.g"
#line 469 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
*dbg << LT(1)->getLine() << ":";
@ -1929,7 +1927,7 @@ void PIXCfgParser::object_group_description() {
importer->setObjectGroupDescription(descr);
*dbg << " DESCRIPTION " << descr << std::endl;
#line 1933 "PIXCfgParser.cpp"
#line 1931 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1950,14 +1948,14 @@ void PIXCfgParser::group_object() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 458 "pix.g"
#line 484 "pix.g"
importer->clearTempVars();
importer->setCurrentLineNumber(LT(0)->getLine());
importer->addNamedObjectToObjectGroup(name->getText());
*dbg << " GROUP MEMBER " << name->getLine() << std::endl;
#line 1961 "PIXCfgParser.cpp"
#line 1959 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -1981,12 +1979,12 @@ void PIXCfgParser::network_object() {
try { // for error handling
match(NETWORK_OBJECT);
if ( inputState->guessing==0 ) {
#line 467 "pix.g"
#line 493 "pix.g"
importer->clearTempVars();
importer->setCurrentLineNumber(LT(0)->getLine());
#line 1990 "PIXCfgParser.cpp"
#line 1988 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2018,7 +2016,7 @@ void PIXCfgParser::network_object() {
}
}
if ( inputState->guessing==0 ) {
#line 473 "pix.g"
#line 499 "pix.g"
if (a)
{
@ -2034,7 +2032,7 @@ void PIXCfgParser::network_object() {
consumeUntil(NEWLINE);
}
#line 2038 "PIXCfgParser.cpp"
#line 2036 "PIXCfgParser.cpp"
}
break;
}
@ -2062,7 +2060,7 @@ void PIXCfgParser::network_object() {
}
}
if ( inputState->guessing==0 ) {
#line 490 "pix.g"
#line 516 "pix.g"
if (h)
{
@ -2078,7 +2076,7 @@ void PIXCfgParser::network_object() {
consumeUntil(NEWLINE);
}
#line 2082 "PIXCfgParser.cpp"
#line 2080 "PIXCfgParser.cpp"
}
break;
}
@ -2088,12 +2086,12 @@ void PIXCfgParser::network_object() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 507 "pix.g"
#line 533 "pix.g"
importer->addNamedObjectToObjectGroup(name->getText());
*dbg << " GROUP MEMBER " << name->getLine() << std::endl;
#line 2097 "PIXCfgParser.cpp"
#line 2095 "PIXCfgParser.cpp"
}
break;
}
@ -2158,12 +2156,12 @@ void PIXCfgParser::protocol_object() {
try { // for error handling
match(PROTOCOL_OBJECT);
if ( inputState->guessing==0 ) {
#line 541 "pix.g"
#line 567 "pix.g"
importer->clearTempVars();
importer->setCurrentLineNumber(LT(0)->getLine());
#line 2167 "PIXCfgParser.cpp"
#line 2165 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2235,14 +2233,14 @@ void PIXCfgParser::protocol_object() {
}
}
if ( inputState->guessing==0 ) {
#line 547 "pix.g"
#line 573 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->protocol = LT(0)->getText();
importer->addIPServiceToObjectGroup();
*dbg << " GROUP MEMBER " << LT(0)->getText() << " ";
#line 2246 "PIXCfgParser.cpp"
#line 2244 "PIXCfgParser.cpp"
}
break;
}
@ -2250,13 +2248,13 @@ void PIXCfgParser::protocol_object() {
{
match(ICMP6);
if ( inputState->guessing==0 ) {
#line 555 "pix.g"
#line 581 "pix.g"
importer->addMessageToLog(
"Parser warning: IPv6 import is not supported. ");
consumeUntil(NEWLINE);
#line 2260 "PIXCfgParser.cpp"
#line 2258 "PIXCfgParser.cpp"
}
break;
}
@ -2266,12 +2264,12 @@ void PIXCfgParser::protocol_object() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 562 "pix.g"
#line 588 "pix.g"
importer->addNamedObjectToObjectGroup(name->getText());
*dbg << " GROUP MEMBER " << name->getLine() << std::endl;
#line 2275 "PIXCfgParser.cpp"
#line 2273 "PIXCfgParser.cpp"
}
break;
}
@ -2338,12 +2336,12 @@ void PIXCfgParser::icmp_object() {
try { // for error handling
match(ICMP_OBJECT);
if ( inputState->guessing==0 ) {
#line 609 "pix.g"
#line 635 "pix.g"
importer->clearTempVars();
importer->setCurrentLineNumber(LT(0)->getLine());
#line 2347 "PIXCfgParser.cpp"
#line 2345 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2357,11 +2355,11 @@ void PIXCfgParser::icmp_object() {
icmp_type = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 616 "pix.g"
#line 642 "pix.g"
importer->icmp_type = LT(0)->getText();
#line 2365 "PIXCfgParser.cpp"
#line 2363 "PIXCfgParser.cpp"
}
break;
}
@ -2370,11 +2368,11 @@ void PIXCfgParser::icmp_object() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 620 "pix.g"
#line 646 "pix.g"
importer->icmp_spec = icmp_word->getText();
#line 2378 "PIXCfgParser.cpp"
#line 2376 "PIXCfgParser.cpp"
}
break;
}
@ -2385,12 +2383,12 @@ void PIXCfgParser::icmp_object() {
}
}
if ( inputState->guessing==0 ) {
#line 624 "pix.g"
#line 650 "pix.g"
importer->addICMPServiceToObjectGroup();
*dbg << " SERVICE ICMP " << LT(0)->getText() << " ";
#line 2394 "PIXCfgParser.cpp"
#line 2392 "PIXCfgParser.cpp"
}
break;
}
@ -2400,12 +2398,12 @@ void PIXCfgParser::icmp_object() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 630 "pix.g"
#line 656 "pix.g"
importer->addNamedObjectToObjectGroup(name->getText());
*dbg << " GROUP MEMBER " << name->getLine() << std::endl;
#line 2409 "PIXCfgParser.cpp"
#line 2407 "PIXCfgParser.cpp"
}
break;
}
@ -2472,12 +2470,12 @@ void PIXCfgParser::service_object() {
try { // for error handling
match(SERVICE_OBJECT);
if ( inputState->guessing==0 ) {
#line 664 "pix.g"
#line 690 "pix.g"
importer->clearTempVars();
importer->setCurrentLineNumber(LT(0)->getLine());
#line 2481 "PIXCfgParser.cpp"
#line 2479 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2531,14 +2529,14 @@ void PIXCfgParser::service_object() {
}
}
if ( inputState->guessing==0 ) {
#line 670 "pix.g"
#line 696 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->protocol = LT(0)->getText();
importer->addIPServiceToObjectGroup();
*dbg << " GROUP MEMBER " << LT(0)->getText() << " ";
#line 2542 "PIXCfgParser.cpp"
#line 2540 "PIXCfgParser.cpp"
}
break;
}
@ -2564,12 +2562,12 @@ void PIXCfgParser::service_object() {
}
}
if ( inputState->guessing==0 ) {
#line 678 "pix.g"
#line 704 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << " SERVICE TCP/UDP" << LT(0)->getText() << " ";
#line 2573 "PIXCfgParser.cpp"
#line 2571 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2655,11 +2653,11 @@ void PIXCfgParser::service_object() {
}
}
if ( inputState->guessing==0 ) {
#line 684 "pix.g"
#line 710 "pix.g"
importer->addTCPUDPServiceToObjectGroup();
#line 2663 "PIXCfgParser.cpp"
#line 2661 "PIXCfgParser.cpp"
}
break;
}
@ -2673,11 +2671,11 @@ void PIXCfgParser::service_object() {
icmp_type = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 691 "pix.g"
#line 717 "pix.g"
importer->icmp_type = LT(0)->getText();
#line 2681 "PIXCfgParser.cpp"
#line 2679 "PIXCfgParser.cpp"
}
break;
}
@ -2686,11 +2684,11 @@ void PIXCfgParser::service_object() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 695 "pix.g"
#line 721 "pix.g"
importer->icmp_spec = icmp_word->getText();
#line 2694 "PIXCfgParser.cpp"
#line 2692 "PIXCfgParser.cpp"
}
break;
}
@ -2701,12 +2699,12 @@ void PIXCfgParser::service_object() {
}
}
if ( inputState->guessing==0 ) {
#line 699 "pix.g"
#line 725 "pix.g"
importer->addICMPServiceToObjectGroup();
*dbg << " SERVICE ICMP " << LT(0)->getText() << " ";
#line 2710 "PIXCfgParser.cpp"
#line 2708 "PIXCfgParser.cpp"
}
break;
}
@ -2716,12 +2714,12 @@ void PIXCfgParser::service_object() {
name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 705 "pix.g"
#line 731 "pix.g"
importer->addNamedObjectToObjectGroup(name->getText());
*dbg << " GROUP MEMBER " << name->getLine() << std::endl;
#line 2725 "PIXCfgParser.cpp"
#line 2723 "PIXCfgParser.cpp"
}
break;
}
@ -2747,23 +2745,23 @@ void PIXCfgParser::permit_ext() {
try { // for error handling
match(PERMIT);
if ( inputState->guessing==0 ) {
#line 816 "pix.g"
#line 842 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "permit";
*dbg << LT(1)->getLine() << ":" << " permit ";
#line 2758 "PIXCfgParser.cpp"
#line 2756 "PIXCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 823 "pix.g"
#line 849 "pix.g"
importer->pushRule();
#line 2767 "PIXCfgParser.cpp"
#line 2765 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2781,23 +2779,23 @@ void PIXCfgParser::deny_ext() {
try { // for error handling
match(DENY);
if ( inputState->guessing==0 ) {
#line 829 "pix.g"
#line 855 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->newPolicyRule();
importer->action = "deny";
*dbg << LT(1)->getLine() << ":" << " deny ";
#line 2792 "PIXCfgParser.cpp"
#line 2790 "PIXCfgParser.cpp"
}
rule_ext();
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 836 "pix.g"
#line 862 "pix.g"
importer->pushRule();
#line 2801 "PIXCfgParser.cpp"
#line 2799 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2815,7 +2813,7 @@ void PIXCfgParser::remark() {
try { // for error handling
match(REMARK);
if ( inputState->guessing==0 ) {
#line 1330 "pix.g"
#line 1356 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
*dbg << LT(1)->getLine() << ":";
@ -2829,7 +2827,7 @@ void PIXCfgParser::remark() {
*dbg << " REMARK " << rem << std::endl;
//consumeUntil(NEWLINE);
#line 2833 "PIXCfgParser.cpp"
#line 2831 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -2866,15 +2864,15 @@ void PIXCfgParser::rule_ext() {
ip_protocols();
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 846 "pix.g"
#line 872 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 2872 "PIXCfgParser.cpp"
#line 2870 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 847 "pix.g"
#line 873 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 2878 "PIXCfgParser.cpp"
#line 2876 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -2939,24 +2937,24 @@ void PIXCfgParser::rule_ext() {
{
match(ICMP);
if ( inputState->guessing==0 ) {
#line 853 "pix.g"
#line 879 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 2948 "PIXCfgParser.cpp"
#line 2946 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 857 "pix.g"
#line 883 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 2954 "PIXCfgParser.cpp"
#line 2952 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 858 "pix.g"
#line 884 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 2960 "PIXCfgParser.cpp"
#line 2958 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3061,18 +3059,18 @@ void PIXCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 865 "pix.g"
#line 891 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 3070 "PIXCfgParser.cpp"
#line 3068 "PIXCfgParser.cpp"
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 869 "pix.g"
#line 895 "pix.g"
importer->SaveTmpAddrToSrc(); *dbg << "(src) ";
#line 3076 "PIXCfgParser.cpp"
#line 3074 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3084,9 +3082,9 @@ void PIXCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 870 "pix.g"
#line 896 "pix.g"
importer->SaveTmpPortToSrc();
#line 3090 "PIXCfgParser.cpp"
#line 3088 "PIXCfgParser.cpp"
}
break;
}
@ -3104,9 +3102,9 @@ void PIXCfgParser::rule_ext() {
}
hostaddr_ext();
if ( inputState->guessing==0 ) {
#line 871 "pix.g"
#line 897 "pix.g"
importer->SaveTmpAddrToDst(); *dbg << "(dst) ";
#line 3110 "PIXCfgParser.cpp"
#line 3108 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3118,9 +3116,9 @@ void PIXCfgParser::rule_ext() {
{
xoperator();
if ( inputState->guessing==0 ) {
#line 872 "pix.g"
#line 898 "pix.g"
importer->SaveTmpPortToDst();
#line 3124 "PIXCfgParser.cpp"
#line 3122 "PIXCfgParser.cpp"
}
break;
}
@ -3226,11 +3224,11 @@ void PIXCfgParser::rule_ext() {
}
}
if ( inputState->guessing==0 ) {
#line 878 "pix.g"
#line 904 "pix.g"
*dbg << std::endl;
#line 3234 "PIXCfgParser.cpp"
#line 3232 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3248,12 +3246,12 @@ void PIXCfgParser::ip_protocols() {
try { // for error handling
ip_protocol_names();
if ( inputState->guessing==0 ) {
#line 885 "pix.g"
#line 911 "pix.g"
importer->protocol = LT(0)->getText();
*dbg << "protocol " << LT(0)->getText() << " ";
#line 3257 "PIXCfgParser.cpp"
#line 3255 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3281,13 +3279,13 @@ void PIXCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 948 "pix.g"
#line 974 "pix.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "255.255.255.255";
*dbg << h->getText() << "/255.255.255.255";
#line 3291 "PIXCfgParser.cpp"
#line 3289 "PIXCfgParser.cpp"
}
break;
}
@ -3300,13 +3298,13 @@ void PIXCfgParser::hostaddr_ext() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 955 "pix.g"
#line 981 "pix.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 3310 "PIXCfgParser.cpp"
#line 3308 "PIXCfgParser.cpp"
}
break;
}
@ -3314,13 +3312,13 @@ void PIXCfgParser::hostaddr_ext() {
{
match(ANY);
if ( inputState->guessing==0 ) {
#line 962 "pix.g"
#line 988 "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 3324 "PIXCfgParser.cpp"
#line 3322 "PIXCfgParser.cpp"
}
break;
}
@ -3348,12 +3346,12 @@ void PIXCfgParser::time_range() {
tr_name = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 1014 "pix.g"
#line 1040 "pix.g"
importer->time_range_name = tr_name->getText();
*dbg << "time_range " << tr_name->getText() << " ";
#line 3357 "PIXCfgParser.cpp"
#line 3355 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3371,12 +3369,12 @@ void PIXCfgParser::fragments() {
try { // for error handling
match(FRAGMENTS);
if ( inputState->guessing==0 ) {
#line 1007 "pix.g"
#line 1033 "pix.g"
importer->fragments = true;
*dbg << "fragments ";
#line 3380 "PIXCfgParser.cpp"
#line 3378 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3411,12 +3409,12 @@ void PIXCfgParser::log() {
}
}
if ( inputState->guessing==0 ) {
#line 993 "pix.g"
#line 1019 "pix.g"
importer->logging = true;
*dbg << "logging ";
#line 3420 "PIXCfgParser.cpp"
#line 3418 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3446,7 +3444,7 @@ void PIXCfgParser::icmp_spec() {
match(INT_CONST);
}
if ( inputState->guessing==0 ) {
#line 893 "pix.g"
#line 919 "pix.g"
importer->icmp_type = icmp_type->getText();
importer->icmp_code = icmp_code->getText();
@ -3454,7 +3452,7 @@ void PIXCfgParser::icmp_spec() {
*dbg << icmp_type->getText() << " "
<< icmp_code->getText() << " ";
#line 3458 "PIXCfgParser.cpp"
#line 3456 "PIXCfgParser.cpp"
}
break;
}
@ -3463,12 +3461,12 @@ void PIXCfgParser::icmp_spec() {
icmp_word = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 902 "pix.g"
#line 928 "pix.g"
importer->icmp_spec = icmp_word->getText();
*dbg << icmp_word->getText() << " ";
#line 3472 "PIXCfgParser.cpp"
#line 3470 "PIXCfgParser.cpp"
}
break;
}
@ -3494,12 +3492,12 @@ void PIXCfgParser::established() {
try { // for error handling
match(ESTABLISHED);
if ( inputState->guessing==0 ) {
#line 1000 "pix.g"
#line 1026 "pix.g"
importer->established = true;
*dbg << "established ";
#line 3503 "PIXCfgParser.cpp"
#line 3501 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3544,12 +3542,12 @@ void PIXCfgParser::single_port_op() {
}
}
if ( inputState->guessing==0 ) {
#line 913 "pix.g"
#line 939 "pix.g"
importer->tmp_port_op = LT(0)->getText();
*dbg << LT(0)->getText() << " ";
#line 3553 "PIXCfgParser.cpp"
#line 3551 "PIXCfgParser.cpp"
}
port_spec();
}
@ -3569,12 +3567,12 @@ void PIXCfgParser::port_range() {
match(RANGE);
pair_of_ports_spec();
if ( inputState->guessing==0 ) {
#line 928 "pix.g"
#line 954 "pix.g"
importer->tmp_port_op = "range";
*dbg << "range ";
#line 3578 "PIXCfgParser.cpp"
#line 3576 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3609,12 +3607,12 @@ void PIXCfgParser::port_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 921 "pix.g"
#line 947 "pix.g"
importer->tmp_port_spec = (std::string(" ") + LT(0)->getText());
*dbg << LT(0)->getText() << " " << importer->tmp_port_spec;
#line 3618 "PIXCfgParser.cpp"
#line 3616 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3675,7 +3673,7 @@ void PIXCfgParser::pair_of_ports_spec() {
}
}
if ( inputState->guessing==0 ) {
#line 935 "pix.g"
#line 961 "pix.g"
importer->tmp_port_spec = "";
if (s1) importer->tmp_port_spec += s1->getText();
@ -3685,7 +3683,7 @@ void PIXCfgParser::pair_of_ports_spec() {
if (e2) importer->tmp_port_spec += e2->getText();
*dbg << "pair of ports: " << importer->tmp_port_spec;
#line 3689 "PIXCfgParser.cpp"
#line 3687 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3710,13 +3708,13 @@ void PIXCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 971 "pix.g"
#line 997 "pix.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 3720 "PIXCfgParser.cpp"
#line 3718 "PIXCfgParser.cpp"
}
}
else if ((LA(1) == IPV4) && (LA(2) == IPV4)) {
@ -3727,25 +3725,25 @@ void PIXCfgParser::hostaddr_std() {
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 978 "pix.g"
#line 1004 "pix.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 3737 "PIXCfgParser.cpp"
#line 3735 "PIXCfgParser.cpp"
}
}
else if ((LA(1) == ANY)) {
match(ANY);
if ( inputState->guessing==0 ) {
#line 985 "pix.g"
#line 1011 "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 3749 "PIXCfgParser.cpp"
#line 3747 "PIXCfgParser.cpp"
}
}
else {
@ -3768,11 +3766,11 @@ void PIXCfgParser::interface_parameters() {
try { // for error handling
match(NEWLINE);
if ( inputState->guessing==0 ) {
#line 1094 "pix.g"
#line 1120 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
#line 3776 "PIXCfgParser.cpp"
#line 3774 "PIXCfgParser.cpp"
}
{
switch ( LA(1)) {
@ -3894,12 +3892,12 @@ void PIXCfgParser::vlan_interface() {
vlan_id = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 1119 "pix.g"
#line 1145 "pix.g"
importer->setInterfaceVlanId(vlan_id->getText());
*dbg << " VLAN: " << vlan_id->getText() << std::endl;
#line 3903 "PIXCfgParser.cpp"
#line 3901 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3920,12 +3918,12 @@ void PIXCfgParser::sec_level() {
sec_level = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 1171 "pix.g"
#line 1197 "pix.g"
importer->setInterfaceSecurityLevel(sec_level->getText());
*dbg << "SEC_LEVEL: " << sec_level->getText() << std::endl;
#line 3929 "PIXCfgParser.cpp"
#line 3927 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3970,7 +3968,7 @@ void PIXCfgParser::nameif() {
}
}
if ( inputState->guessing==0 ) {
#line 1194 "pix.g"
#line 1220 "pix.g"
std::string label = (intf_label) ? intf_label->getText() : "";
std::string seclevel = (sec_level) ? sec_level->getText() : "";
@ -3978,7 +3976,7 @@ void PIXCfgParser::nameif() {
*dbg << " NAMEIF: "
<< p_intf->getText() << label << seclevel << std::endl;
#line 3982 "PIXCfgParser.cpp"
#line 3980 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -3996,7 +3994,7 @@ void PIXCfgParser::interface_description() {
try { // for error handling
match(DESCRIPTION);
if ( inputState->guessing==0 ) {
#line 1206 "pix.g"
#line 1232 "pix.g"
*dbg << LT(1)->getLine() << ":";
std::string descr;
@ -4009,7 +4007,7 @@ void PIXCfgParser::interface_description() {
*dbg << " DESCRIPTION " << descr << std::endl;
//consumeUntil(NEWLINE);
#line 4013 "PIXCfgParser.cpp"
#line 4011 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4032,12 +4030,12 @@ void PIXCfgParser::switchport() {
vlan_num = LT(1);
match(INT_CONST);
if ( inputState->guessing==0 ) {
#line 1318 "pix.g"
#line 1344 "pix.g"
importer->addMessageToLog("Switch port vlan " + vlan_num->getText());
*dbg << "Switch port vlan " << vlan_num->getText() << std::endl;
#line 4041 "PIXCfgParser.cpp"
#line 4039 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4055,13 +4053,13 @@ void PIXCfgParser::shutdown() {
try { // for error handling
match(SHUTDOWN);
if ( inputState->guessing==0 ) {
#line 1221 "pix.g"
#line 1247 "pix.g"
importer->ignoreCurrentInterface();
*dbg<< LT(1)->getLine() << ":"
<< " INTERFACE SHUTDOWN " << std::endl;
#line 4065 "PIXCfgParser.cpp"
#line 4063 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4112,13 +4110,13 @@ void PIXCfgParser::interface_no_commands() {
}
}
if ( inputState->guessing==0 ) {
#line 1163 "pix.g"
#line 1189 "pix.g"
*dbg << " INTERFACE \"NO\" COMMAND: "
<< LT(0)->getText() << std::endl;
consumeUntil(NEWLINE);
#line 4122 "PIXCfgParser.cpp"
#line 4120 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4213,13 +4211,13 @@ void PIXCfgParser::unsupported_interface_commands() {
}
}
if ( inputState->guessing==0 ) {
#line 1155 "pix.g"
#line 1181 "pix.g"
*dbg << " UNSUPPORTED INTERFACE COMMAND: "
<< LT(0)->getText() << std::endl;
consumeUntil(NEWLINE);
#line 4223 "PIXCfgParser.cpp"
#line 4221 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4296,7 +4294,7 @@ void PIXCfgParser::v6_dhcp_address() {
dhcp = LT(1);
match(DHCP);
if ( inputState->guessing==0 ) {
#line 1256 "pix.g"
#line 1282 "pix.g"
std::string label = lbl->getText();
std::string addr = dhcp->getText();
@ -4307,7 +4305,7 @@ void PIXCfgParser::v6_dhcp_address() {
// which we do not support
consumeUntil(NEWLINE);
#line 4311 "PIXCfgParser.cpp"
#line 4309 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4333,7 +4331,7 @@ void PIXCfgParser::v6_static_address() {
m = LT(1);
match(IPV4);
if ( inputState->guessing==0 ) {
#line 1269 "pix.g"
#line 1295 "pix.g"
std::string label = lbl->getText();
std::string addr = a->getText();
@ -4344,7 +4342,7 @@ void PIXCfgParser::v6_static_address() {
// in case there are some other parameters after address and netmask
consumeUntil(NEWLINE);
#line 4348 "PIXCfgParser.cpp"
#line 4346 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4364,7 +4362,7 @@ void PIXCfgParser::v7_dhcp_address() {
dhcp = LT(1);
match(DHCP);
if ( inputState->guessing==0 ) {
#line 1286 "pix.g"
#line 1312 "pix.g"
std::string addr = dhcp->getText();
importer->addInterfaceAddress(addr, "");
@ -4372,7 +4370,7 @@ void PIXCfgParser::v7_dhcp_address() {
<< " INTRFACE ADDRESS: " << addr << std::endl;
consumeUntil(NEWLINE);
#line 4376 "PIXCfgParser.cpp"
#line 4374 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4414,7 +4412,7 @@ void PIXCfgParser::v7_static_address() {
}
}
if ( inputState->guessing==0 ) {
#line 1297 "pix.g"
#line 1323 "pix.g"
std::string addr = a->getText();
std::string netm = m->getText();
@ -4431,7 +4429,7 @@ void PIXCfgParser::v7_static_address() {
}
consumeUntil(NEWLINE);
#line 4435 "PIXCfgParser.cpp"
#line 4433 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
@ -4459,7 +4457,7 @@ void PIXCfgParser::access_group_by_name() {
intf_label = LT(1);
match(WORD);
if ( inputState->guessing==0 ) {
#line 1348 "pix.g"
#line 1374 "pix.g"
importer->setCurrentLineNumber(LT(0)->getLine());
importer->setInterfaceAndDirectionForRuleSet(
@ -4471,7 +4469,7 @@ void PIXCfgParser::access_group_by_name() {
<< " " << intf_label->getText()
<< " " << dir->getText() << std::endl;
#line 4475 "PIXCfgParser.cpp"
#line 4473 "PIXCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {

View File

@ -5,8 +5,9 @@
// gets inserted before antlr generated includes in the header
// file
#include "PIXImporter.h"
#line 10 "PIXCfgParser.hpp"
#line 11 "PIXCfgParser.hpp"
#include <antlr/config.hpp>
/* $ANTLR 2.7.7 (20090306): "pix.g" -> "PIXCfgParser.hpp"$ */
#include <antlr/TokenStream.hpp>
@ -14,7 +15,7 @@
#include "PIXCfgParserTokenTypes.hpp"
#include <antlr/LLkParser.hpp>
#line 30 "pix.g"
#line 32 "pix.g"
// gets inserted after antlr generated includes in the header file
// outside any generated namespace specifications
@ -23,16 +24,16 @@
class PIXImporter;
#line 27 "PIXCfgParser.hpp"
#line 28 "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"
#line 34 "PIXCfgParser.hpp"
class CUSTOM_API PIXCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, public PIXCfgParserTokenTypes
{
#line 74 "pix.g"
#line 81 "pix.g"
// additional methods and members
@ -40,7 +41,26 @@ class CUSTOM_API PIXCfgParser : public ANTLR_USE_NAMESPACE(antlr)LLkParser, publ
std::ostream *dbg;
PIXImporter *importer;
#line 37 "PIXCfgParser.hpp"
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
#line 38 "PIXCfgParser.hpp"
public:
void initializeASTFactory( ANTLR_USE_NAMESPACE(antlr)ASTFactory& factory );
protected:

View File

@ -27,6 +27,7 @@ header "pre_include_hpp"
{
// gets inserted before antlr generated includes in the header
// file
#include "IOSImporter.h"
}
header "post_include_hpp"
{
@ -50,8 +51,6 @@ header "post_include_cpp"
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IOSImporter.h"
}
header
@ -79,6 +78,24 @@ options
std::ostream *dbg;
IOSImporter *importer;
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
}
cfgfile :

View File

@ -27,7 +27,9 @@ header "pre_include_hpp"
{
// gets inserted before antlr generated includes in the header
// file
#include "IPTImporter.h"
}
header "post_include_hpp"
{
// gets inserted after antlr generated includes in the header file
@ -51,13 +53,10 @@ header "post_include_cpp"
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "IPTImporter.h"
#include "fwbuilder/TCPService.h"
#include "fwbuilder/Logger.h"
#include <algorithm>
}
header
@ -85,6 +84,25 @@ options
std::ostream *dbg;
IPTImporter *importer;
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
}
cfgfile :

View File

@ -25,7 +25,9 @@ header "pre_include_hpp"
{
// gets inserted before antlr generated includes in the header
// file
#include "PIXImporter.h"
}
header "post_include_hpp"
{
// gets inserted after antlr generated includes in the header file
@ -48,8 +50,6 @@ header "post_include_cpp"
// file
#include <antlr/Token.hpp>
#include <antlr/TokenBuffer.hpp>
#include "PIXImporter.h"
}
header
@ -68,7 +68,14 @@ class PIXCfgParser extends Parser;
options
{
k = 2;
// defaultErrorHandler=false;
// when default error handler is disabled, parser errors cause
// exception and terminate parsing process. We can catch the exception
// and make the error appear in importer log, but import process
// terminates which is not always optimal
//
// defaultErrorHandler = false;
// see http://www.antlr2.org/doc/options.html
}
{
@ -78,6 +85,25 @@ options
std::ostream *dbg;
PIXImporter *importer;
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex)
{
importer->addMessageToLog("Parser error: " + ex.toString());
}
/// Parser error-reporting function can be overridden in subclass
virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser error: " + s);
}
/// Parser warning-reporting function can be overridden in subclass
virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s)
{
importer->addMessageToLog("Parser warning: " + s);
}
}
cfgfile :