mirror of
https://github.com/fwbuilder/fwbuilder
synced 2026-09-13 00:19:55 +02:00
see #2223 improvements in the grammar to parse interface parameters better. Some ambiguity warnigns remain.
This commit is contained in:
+160
-137
@@ -48,58 +48,79 @@ void PIXCfgLexer::initLiterals()
|
||||
{
|
||||
literals["name"] = 9;
|
||||
literals["names"] = 8;
|
||||
literals["ospf"] = 61;
|
||||
literals["established"] = 45;
|
||||
literals["nameif"] = 52;
|
||||
literals["mac-address"] = 59;
|
||||
literals["nameif"] = 66;
|
||||
literals["subnet"] = 18;
|
||||
literals["controller"] = 48;
|
||||
literals["object"] = 12;
|
||||
literals["remark"] = 59;
|
||||
literals["pcp"] = 87;
|
||||
literals["remark"] = 73;
|
||||
literals["access-list"] = 35;
|
||||
literals["hostname"] = 33;
|
||||
literals["hold-time"] = 56;
|
||||
literals["community-list"] = 7;
|
||||
literals["permit"] = 36;
|
||||
literals["security-level"] = 51;
|
||||
literals["security-level"] = 65;
|
||||
literals["source"] = 25;
|
||||
literals["quit"] = 6;
|
||||
literals["igrp"] = 84;
|
||||
literals["pim"] = 62;
|
||||
literals["ahp"] = 80;
|
||||
literals["nos"] = 86;
|
||||
literals["ipinip"] = 85;
|
||||
literals["quit"] = 5;
|
||||
literals["crypto"] = 27;
|
||||
literals["PIX"] = 29;
|
||||
literals["exit"] = 61;
|
||||
literals["object-group"] = 68;
|
||||
literals["exit"] = 75;
|
||||
literals["nat"] = 14;
|
||||
literals["object-group"] = 90;
|
||||
literals["range"] = 17;
|
||||
literals["gre"] = 83;
|
||||
literals["gt"] = 39;
|
||||
literals["host"] = 16;
|
||||
literals["secondary"] = 64;
|
||||
literals["secondary"] = 78;
|
||||
literals["interface"] = 49;
|
||||
literals["standard"] = 67;
|
||||
literals["rip"] = 64;
|
||||
literals["standard"] = 89;
|
||||
literals["network"] = 13;
|
||||
literals["vlan"] = 50;
|
||||
literals["access"] = 58;
|
||||
literals["service"] = 19;
|
||||
literals["vlan"] = 50;
|
||||
literals["access"] = 72;
|
||||
literals["multicast"] = 60;
|
||||
literals["any"] = 42;
|
||||
literals["dhcp"] = 55;
|
||||
literals["dhcp"] = 69;
|
||||
literals["speed"] = 51;
|
||||
literals["deny"] = 37;
|
||||
literals["neq"] = 41;
|
||||
literals["address"] = 54;
|
||||
literals["shutdown"] = 53;
|
||||
literals["address"] = 68;
|
||||
literals["esp"] = 82;
|
||||
literals["shutdown"] = 67;
|
||||
literals["delay"] = 55;
|
||||
literals["certificate"] = 28;
|
||||
literals["udp"] = 24;
|
||||
literals["fragments"] = 46;
|
||||
literals["eq"] = 38;
|
||||
literals["destination"] = 26;
|
||||
literals["setroute"] = 65;
|
||||
literals["ip"] = 5;
|
||||
literals["duplex"] = 52;
|
||||
literals["setroute"] = 79;
|
||||
literals["ip"] = 6;
|
||||
literals["eigrp"] = 81;
|
||||
literals["log-input"] = 44;
|
||||
literals["switchport"] = 57;
|
||||
literals["switchport"] = 71;
|
||||
literals["description"] = 15;
|
||||
literals["extended"] = 66;
|
||||
literals["access-group"] = 60;
|
||||
literals["extended"] = 88;
|
||||
literals["igmp"] = 57;
|
||||
literals["access-group"] = 74;
|
||||
literals["ddns"] = 53;
|
||||
literals["Version"] = 31;
|
||||
literals["log"] = 43;
|
||||
literals["forward"] = 54;
|
||||
literals["ASA"] = 30;
|
||||
literals["lt"] = 40;
|
||||
literals["ipv6"] = 58;
|
||||
literals["time-range"] = 47;
|
||||
literals["standby"] = 56;
|
||||
literals["standby"] = 70;
|
||||
literals["icmp"] = 20;
|
||||
literals["tcp"] = 23;
|
||||
}
|
||||
@@ -418,11 +439,11 @@ void PIXCfgLexer::mLINE_COMMENT(bool _createToken) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
goto _loop128;
|
||||
goto _loop130;
|
||||
}
|
||||
|
||||
}
|
||||
_loop128:;
|
||||
_loop130:;
|
||||
} // ( ... )*
|
||||
mNEWLINE(false);
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@@ -454,9 +475,9 @@ void PIXCfgLexer::mNEWLINE(bool _createToken) {
|
||||
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1069 "pix.g"
|
||||
#line 1129 "pix.g"
|
||||
newline();
|
||||
#line 460 "PIXCfgLexer.cpp"
|
||||
#line 481 "PIXCfgLexer.cpp"
|
||||
}
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
_token = makeToken(_ttype);
|
||||
@@ -480,11 +501,11 @@ void PIXCfgLexer::mCOLON_COMMENT(bool _createToken) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
goto _loop132;
|
||||
goto _loop134;
|
||||
}
|
||||
|
||||
}
|
||||
_loop132:;
|
||||
_loop134:;
|
||||
} // ( ... )*
|
||||
mNEWLINE(false);
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@@ -578,9 +599,9 @@ void PIXCfgLexer::mWhitespace(bool _createToken) {
|
||||
}
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1064 "pix.g"
|
||||
#line 1124 "pix.g"
|
||||
_ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP;
|
||||
#line 584 "PIXCfgLexer.cpp"
|
||||
#line 605 "PIXCfgLexer.cpp"
|
||||
}
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
_token = makeToken(_ttype);
|
||||
@@ -692,29 +713,14 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex;
|
||||
|
||||
{
|
||||
bool synPredMatched151 = false;
|
||||
bool synPredMatched153 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (_tokenSet_2.member(LA(4))) && (_tokenSet_2.member(LA(5))) && (_tokenSet_2.member(LA(6))) && (_tokenSet_2.member(LA(7))) && (true) && (true) && (true))) {
|
||||
int _m151 = mark();
|
||||
synPredMatched151 = true;
|
||||
int _m153 = mark();
|
||||
synPredMatched153 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt146=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt146>=1 ) { goto _loop146; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt146++;
|
||||
}
|
||||
_loop146:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt148=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
@@ -743,32 +749,32 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
}
|
||||
_loop150:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt152=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt152>=1 ) { goto _loop152; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt152++;
|
||||
}
|
||||
_loop152:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched151 = false;
|
||||
synPredMatched153 = false;
|
||||
}
|
||||
rewind(_m151);
|
||||
rewind(_m153);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched151 ) {
|
||||
if ( synPredMatched153 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt154=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt154>=1 ) { goto _loop154; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt154++;
|
||||
}
|
||||
_loop154:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt156=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
@@ -812,37 +818,37 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
}
|
||||
_loop160:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt162=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt162>=1 ) { goto _loop162; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt162++;
|
||||
}
|
||||
_loop162:;
|
||||
} // ( ... )+
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1089 "pix.g"
|
||||
#line 1149 "pix.g"
|
||||
_ttype = IPV4;
|
||||
#line 820 "PIXCfgLexer.cpp"
|
||||
#line 841 "PIXCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool synPredMatched166 = false;
|
||||
bool synPredMatched168 = false;
|
||||
if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_2.member(LA(2))) && (_tokenSet_2.member(LA(3))) && (true) && (true) && (true) && (true) && (true) && (true) && (true))) {
|
||||
int _m166 = mark();
|
||||
synPredMatched166 = true;
|
||||
int _m168 = mark();
|
||||
synPredMatched168 = true;
|
||||
inputState->guessing++;
|
||||
try {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt163=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt163>=1 ) { goto _loop163; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt163++;
|
||||
}
|
||||
_loop163:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt165=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
@@ -856,32 +862,32 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
}
|
||||
_loop165:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt167=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt167>=1 ) { goto _loop167; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt167++;
|
||||
}
|
||||
_loop167:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) {
|
||||
synPredMatched166 = false;
|
||||
synPredMatched168 = false;
|
||||
}
|
||||
rewind(_m166);
|
||||
rewind(_m168);
|
||||
inputState->guessing--;
|
||||
}
|
||||
if ( synPredMatched166 ) {
|
||||
if ( synPredMatched168 ) {
|
||||
{
|
||||
{ // ( ... )+
|
||||
int _cnt169=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt169>=1 ) { goto _loop169; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt169++;
|
||||
}
|
||||
_loop169:;
|
||||
} // ( ... )+
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt171=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
@@ -895,34 +901,7 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
}
|
||||
_loop171:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
else if ((LA(1) == 0x30 /* '0' */ ) && (LA(2) == 0x78 /* 'x' */ )) {
|
||||
{
|
||||
match('0' /* charlit */ );
|
||||
match('x' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt176=0;
|
||||
for (;;) {
|
||||
if ((_tokenSet_3.member(LA(1)))) {
|
||||
mHEXDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt176>=1 ) { goto _loop176; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt176++;
|
||||
}
|
||||
_loop176:;
|
||||
} // ( ... )+
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1095 "pix.g"
|
||||
_ttype = HEX_CONST;
|
||||
#line 923 "PIXCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
|
||||
mDOT(false);
|
||||
{ // ( ... )+
|
||||
int _cnt173=0;
|
||||
for (;;) {
|
||||
@@ -937,12 +916,54 @@ void PIXCfgLexer::mNUMBER(bool _createToken) {
|
||||
}
|
||||
_loop173:;
|
||||
} // ( ... )+
|
||||
}
|
||||
}
|
||||
else if ((LA(1) == 0x30 /* '0' */ ) && (LA(2) == 0x78 /* 'x' */ )) {
|
||||
{
|
||||
match('0' /* charlit */ );
|
||||
match('x' /* charlit */ );
|
||||
{ // ( ... )+
|
||||
int _cnt178=0;
|
||||
for (;;) {
|
||||
if ((_tokenSet_3.member(LA(1)))) {
|
||||
mHEXDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt178>=1 ) { goto _loop178; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt178++;
|
||||
}
|
||||
_loop178:;
|
||||
} // ( ... )+
|
||||
}
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1093 "pix.g"
|
||||
_ttype = INT_CONST;
|
||||
#line 1155 "pix.g"
|
||||
_ttype = HEX_CONST;
|
||||
#line 944 "PIXCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true) && (true)) {
|
||||
{ // ( ... )+
|
||||
int _cnt175=0;
|
||||
for (;;) {
|
||||
if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) {
|
||||
mDIGIT(false);
|
||||
}
|
||||
else {
|
||||
if ( _cnt175>=1 ) { goto _loop175; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());}
|
||||
}
|
||||
|
||||
_cnt175++;
|
||||
}
|
||||
_loop175:;
|
||||
} // ( ... )+
|
||||
if ( inputState->guessing==0 ) {
|
||||
#line 1153 "pix.g"
|
||||
_ttype = INT_CONST;
|
||||
#line 965 "PIXCfgLexer.cpp"
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());
|
||||
}
|
||||
@@ -1201,11 +1222,11 @@ void PIXCfgLexer::mWORD(bool _createToken) {
|
||||
}
|
||||
default:
|
||||
{
|
||||
goto _loop180;
|
||||
goto _loop182;
|
||||
}
|
||||
}
|
||||
}
|
||||
_loop180:;
|
||||
_loop182:;
|
||||
} // ( ... )*
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
_token = makeToken(_ttype);
|
||||
@@ -1227,11 +1248,11 @@ void PIXCfgLexer::mSTRING(bool _createToken) {
|
||||
matchNot('\"' /* charlit */ );
|
||||
}
|
||||
else {
|
||||
goto _loop183;
|
||||
goto _loop185;
|
||||
}
|
||||
|
||||
}
|
||||
_loop183:;
|
||||
_loop185:;
|
||||
} // ( ... )*
|
||||
match('\"' /* charlit */ );
|
||||
if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) {
|
||||
@@ -1601,7 +1622,8 @@ const unsigned long PIXCfgLexer::_tokenSet_1_data_[] = { 4294958072UL, 429496729
|
||||
// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xb 0xc 0xe 0xf 0x10 0x11 0x12 0x13 0x14
|
||||
// 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! \" # $ %
|
||||
// & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G
|
||||
// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d
|
||||
// H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g h
|
||||
// i j k l m n o p q r s t u v w x y z
|
||||
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_1(_tokenSet_1_data_,16);
|
||||
const unsigned long PIXCfgLexer::_tokenSet_2_data_[] = { 0UL, 67059712UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL };
|
||||
// . 0 1 2 3 4 5 6 7 8 9
|
||||
@@ -1613,6 +1635,7 @@ const unsigned long PIXCfgLexer::_tokenSet_4_data_[] = { 4294967288UL, 429496729
|
||||
// 0x3 0x4 0x5 0x6 0x7 0x8 0x9 0xa 0xb 0xc 0xd 0xe 0xf 0x10 0x11 0x12 0x13
|
||||
// 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f ! # $
|
||||
// % & \' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F
|
||||
// G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d
|
||||
// G H I J K L M N O P Q R S T U V W X Y Z [ 0x5c ] ^ _ ` a b c d e f g
|
||||
// h i j k l m n o p q r s t u v w x y z
|
||||
const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgLexer::_tokenSet_4(_tokenSet_4_data_,16);
|
||||
|
||||
|
||||
+1057
-863
File diff suppressed because it is too large
Load Diff
@@ -69,13 +69,10 @@ public:
|
||||
public: void comment();
|
||||
public: void version();
|
||||
public: void hostname();
|
||||
public: void ip_commands();
|
||||
public: void ip_access_list_ext();
|
||||
public: void community_list_command();
|
||||
public: void unknown_ip_command();
|
||||
public: void intrface();
|
||||
public: void vlan_interface();
|
||||
public: void switchport();
|
||||
public: void shutdown();
|
||||
public: void sec_level();
|
||||
public: void nameif();
|
||||
public: void controller();
|
||||
public: void access_list_commands();
|
||||
public: void exit();
|
||||
@@ -87,8 +84,6 @@ public:
|
||||
public: void named_object_service();
|
||||
public: void crypto();
|
||||
public: void unknown_command();
|
||||
public: void ip_access_list_ext();
|
||||
public: void community_list_command();
|
||||
public: void named_object_network_parameters();
|
||||
public: void named_object_nat();
|
||||
public: void named_object_description();
|
||||
@@ -121,8 +116,13 @@ public:
|
||||
public: void hostaddr_std();
|
||||
public: void interface_parameters();
|
||||
public: void intf_address();
|
||||
public: void vlan_interface();
|
||||
public: void sec_level();
|
||||
public: void nameif();
|
||||
public: void interface_description();
|
||||
public: void interface_known_commands();
|
||||
public: void switchport();
|
||||
public: void shutdown();
|
||||
public: void unsupported_interface_commands();
|
||||
public: void v6_ip_address();
|
||||
public: void v7_ip_address();
|
||||
public: void v6_dhcp_address();
|
||||
@@ -141,10 +141,10 @@ protected:
|
||||
private:
|
||||
static const char* tokenNames[];
|
||||
#ifndef NO_STATIC_CONSTS
|
||||
static const int NUM_TOKENS = 101;
|
||||
static const int NUM_TOKENS = 123;
|
||||
#else
|
||||
enum {
|
||||
NUM_TOKENS = 101
|
||||
NUM_TOKENS = 123
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -172,6 +172,12 @@ private:
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_10;
|
||||
static const unsigned long _tokenSet_11_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_11;
|
||||
static const unsigned long _tokenSet_12_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_12;
|
||||
static const unsigned long _tokenSet_13_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_13;
|
||||
static const unsigned long _tokenSet_14_data_[];
|
||||
static const ANTLR_USE_NAMESPACE(antlr)BitSet _tokenSet_14;
|
||||
};
|
||||
|
||||
#endif /*INC_PIXCfgParser_hpp_*/
|
||||
|
||||
@@ -13,8 +13,8 @@ struct CUSTOM_API PIXCfgParserTokenTypes {
|
||||
enum {
|
||||
EOF_ = 1,
|
||||
NEWLINE = 4,
|
||||
IP = 5,
|
||||
QUIT = 6,
|
||||
QUIT = 5,
|
||||
IP = 6,
|
||||
COMMUNITY_LIST = 7,
|
||||
NAMES = 8,
|
||||
NAME = 9,
|
||||
@@ -59,56 +59,78 @@ struct CUSTOM_API PIXCfgParserTokenTypes {
|
||||
CONTROLLER = 48,
|
||||
INTRFACE = 49,
|
||||
VLAN = 50,
|
||||
SEC_LEVEL = 51,
|
||||
NAMEIF = 52,
|
||||
SHUTDOWN = 53,
|
||||
ADDRESS = 54,
|
||||
DHCP = 55,
|
||||
STANDBY = 56,
|
||||
SWITCHPORT = 57,
|
||||
ACCESS = 58,
|
||||
REMARK = 59,
|
||||
ACCESS_GROUP = 60,
|
||||
EXIT = 61,
|
||||
LINE_COMMENT = 62,
|
||||
COLON_COMMENT = 63,
|
||||
SECONDARY = 64,
|
||||
SETROUTE = 65,
|
||||
EXTENDED = 66,
|
||||
STANDARD = 67,
|
||||
OBJECT_GROUP = 68,
|
||||
Whitespace = 69,
|
||||
HEX_CONST = 70,
|
||||
NEG_INT_CONST = 71,
|
||||
DIGIT = 72,
|
||||
HEXDIGIT = 73,
|
||||
PIPE_CHAR = 74,
|
||||
NUMBER_SIGN = 75,
|
||||
PERCENT = 76,
|
||||
AMPERSAND = 77,
|
||||
APOSTROPHE = 78,
|
||||
OPENING_PAREN = 79,
|
||||
CLOSING_PAREN = 80,
|
||||
STAR = 81,
|
||||
PLUS = 82,
|
||||
COMMA = 83,
|
||||
MINUS = 84,
|
||||
DOT = 85,
|
||||
SLASH = 86,
|
||||
COLON = 87,
|
||||
SEMICOLON = 88,
|
||||
LESS_THAN = 89,
|
||||
EQUALS = 90,
|
||||
GREATER_THAN = 91,
|
||||
QUESTION = 92,
|
||||
COMMERCIAL_AT = 93,
|
||||
OPENING_SQUARE = 94,
|
||||
CLOSING_SQUARE = 95,
|
||||
CARET = 96,
|
||||
UNDERLINE = 97,
|
||||
OPENING_BRACE = 98,
|
||||
CLOSING_BRACE = 99,
|
||||
TILDE = 100,
|
||||
SPEED = 51,
|
||||
DUPLEX = 52,
|
||||
DDNS = 53,
|
||||
FORWARD = 54,
|
||||
DELAY = 55,
|
||||
HOLD_TIME = 56,
|
||||
IGMP = 57,
|
||||
IPV6 = 58,
|
||||
MAC_ADDRESS = 59,
|
||||
MULTICAST = 60,
|
||||
OSPF = 61,
|
||||
PIM = 62,
|
||||
PPPOE = 63,
|
||||
RIP = 64,
|
||||
SEC_LEVEL = 65,
|
||||
NAMEIF = 66,
|
||||
SHUTDOWN = 67,
|
||||
ADDRESS = 68,
|
||||
DHCP = 69,
|
||||
STANDBY = 70,
|
||||
SWITCHPORT = 71,
|
||||
ACCESS = 72,
|
||||
REMARK = 73,
|
||||
ACCESS_GROUP = 74,
|
||||
EXIT = 75,
|
||||
LINE_COMMENT = 76,
|
||||
COLON_COMMENT = 77,
|
||||
SECONDARY = 78,
|
||||
SETROUTE = 79,
|
||||
AHP = 80,
|
||||
EIGRP = 81,
|
||||
ESP = 82,
|
||||
GRE = 83,
|
||||
IGRP = 84,
|
||||
IPINIP = 85,
|
||||
NOS = 86,
|
||||
PCP = 87,
|
||||
EXTENDED = 88,
|
||||
STANDARD = 89,
|
||||
OBJECT_GROUP = 90,
|
||||
Whitespace = 91,
|
||||
HEX_CONST = 92,
|
||||
NEG_INT_CONST = 93,
|
||||
DIGIT = 94,
|
||||
HEXDIGIT = 95,
|
||||
PIPE_CHAR = 96,
|
||||
NUMBER_SIGN = 97,
|
||||
PERCENT = 98,
|
||||
AMPERSAND = 99,
|
||||
APOSTROPHE = 100,
|
||||
OPENING_PAREN = 101,
|
||||
CLOSING_PAREN = 102,
|
||||
STAR = 103,
|
||||
PLUS = 104,
|
||||
COMMA = 105,
|
||||
MINUS = 106,
|
||||
DOT = 107,
|
||||
SLASH = 108,
|
||||
COLON = 109,
|
||||
SEMICOLON = 110,
|
||||
LESS_THAN = 111,
|
||||
EQUALS = 112,
|
||||
GREATER_THAN = 113,
|
||||
QUESTION = 114,
|
||||
COMMERCIAL_AT = 115,
|
||||
OPENING_SQUARE = 116,
|
||||
CLOSING_SQUARE = 117,
|
||||
CARET = 118,
|
||||
UNDERLINE = 119,
|
||||
OPENING_BRACE = 120,
|
||||
CLOSING_BRACE = 121,
|
||||
TILDE = 122,
|
||||
NULL_TREE_LOOKAHEAD = 3
|
||||
};
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// $ANTLR 2.7.7 (20090306): pix.g -> PIXCfgParserTokenTypes.txt$
|
||||
PIXCfgParser // output token vocab name
|
||||
NEWLINE=4
|
||||
IP="ip"=5
|
||||
QUIT="quit"=6
|
||||
QUIT="quit"=5
|
||||
IP="ip"=6
|
||||
COMMUNITY_LIST="community-list"=7
|
||||
NAMES="names"=8
|
||||
NAME="name"=9
|
||||
@@ -47,53 +47,75 @@ TIME_RANGE="time-range"=47
|
||||
CONTROLLER="controller"=48
|
||||
INTRFACE="interface"=49
|
||||
VLAN="vlan"=50
|
||||
SEC_LEVEL="security-level"=51
|
||||
NAMEIF="nameif"=52
|
||||
SHUTDOWN="shutdown"=53
|
||||
ADDRESS="address"=54
|
||||
DHCP="dhcp"=55
|
||||
STANDBY="standby"=56
|
||||
SWITCHPORT="switchport"=57
|
||||
ACCESS="access"=58
|
||||
REMARK="remark"=59
|
||||
ACCESS_GROUP="access-group"=60
|
||||
EXIT="exit"=61
|
||||
LINE_COMMENT=62
|
||||
COLON_COMMENT=63
|
||||
SECONDARY="secondary"=64
|
||||
SETROUTE="setroute"=65
|
||||
EXTENDED="extended"=66
|
||||
STANDARD="standard"=67
|
||||
OBJECT_GROUP="object-group"=68
|
||||
Whitespace=69
|
||||
HEX_CONST=70
|
||||
NEG_INT_CONST=71
|
||||
DIGIT=72
|
||||
HEXDIGIT=73
|
||||
PIPE_CHAR=74
|
||||
NUMBER_SIGN=75
|
||||
PERCENT=76
|
||||
AMPERSAND=77
|
||||
APOSTROPHE=78
|
||||
OPENING_PAREN=79
|
||||
CLOSING_PAREN=80
|
||||
STAR=81
|
||||
PLUS=82
|
||||
COMMA=83
|
||||
MINUS=84
|
||||
DOT=85
|
||||
SLASH=86
|
||||
COLON=87
|
||||
SEMICOLON=88
|
||||
LESS_THAN=89
|
||||
EQUALS=90
|
||||
GREATER_THAN=91
|
||||
QUESTION=92
|
||||
COMMERCIAL_AT=93
|
||||
OPENING_SQUARE=94
|
||||
CLOSING_SQUARE=95
|
||||
CARET=96
|
||||
UNDERLINE=97
|
||||
OPENING_BRACE=98
|
||||
CLOSING_BRACE=99
|
||||
TILDE=100
|
||||
SPEED="speed"=51
|
||||
DUPLEX="duplex"=52
|
||||
DDNS="ddns"=53
|
||||
FORWARD="forward"=54
|
||||
DELAY="delay"=55
|
||||
HOLD_TIME="hold-time"=56
|
||||
IGMP="igmp"=57
|
||||
IPV6="ipv6"=58
|
||||
MAC_ADDRESS="mac-address"=59
|
||||
MULTICAST="multicast"=60
|
||||
OSPF="ospf"=61
|
||||
PIM="pim"=62
|
||||
PPPOE=63
|
||||
RIP="rip"=64
|
||||
SEC_LEVEL="security-level"=65
|
||||
NAMEIF="nameif"=66
|
||||
SHUTDOWN="shutdown"=67
|
||||
ADDRESS="address"=68
|
||||
DHCP="dhcp"=69
|
||||
STANDBY="standby"=70
|
||||
SWITCHPORT="switchport"=71
|
||||
ACCESS="access"=72
|
||||
REMARK="remark"=73
|
||||
ACCESS_GROUP="access-group"=74
|
||||
EXIT="exit"=75
|
||||
LINE_COMMENT=76
|
||||
COLON_COMMENT=77
|
||||
SECONDARY="secondary"=78
|
||||
SETROUTE="setroute"=79
|
||||
AHP="ahp"=80
|
||||
EIGRP="eigrp"=81
|
||||
ESP="esp"=82
|
||||
GRE="gre"=83
|
||||
IGRP="igrp"=84
|
||||
IPINIP="ipinip"=85
|
||||
NOS="nos"=86
|
||||
PCP="pcp"=87
|
||||
EXTENDED="extended"=88
|
||||
STANDARD="standard"=89
|
||||
OBJECT_GROUP="object-group"=90
|
||||
Whitespace=91
|
||||
HEX_CONST=92
|
||||
NEG_INT_CONST=93
|
||||
DIGIT=94
|
||||
HEXDIGIT=95
|
||||
PIPE_CHAR=96
|
||||
NUMBER_SIGN=97
|
||||
PERCENT=98
|
||||
AMPERSAND=99
|
||||
APOSTROPHE=100
|
||||
OPENING_PAREN=101
|
||||
CLOSING_PAREN=102
|
||||
STAR=103
|
||||
PLUS=104
|
||||
COMMA=105
|
||||
MINUS=106
|
||||
DOT=107
|
||||
SLASH=108
|
||||
COLON=109
|
||||
SEMICOLON=110
|
||||
LESS_THAN=111
|
||||
EQUALS=112
|
||||
GREATER_THAN=113
|
||||
QUESTION=114
|
||||
COMMERCIAL_AT=115
|
||||
OPENING_SQUARE=116
|
||||
CLOSING_SQUARE=117
|
||||
CARET=118
|
||||
UNDERLINE=119
|
||||
OPENING_BRACE=120
|
||||
CLOSING_BRACE=121
|
||||
TILDE=122
|
||||
|
||||
+100
-40
@@ -67,7 +67,7 @@ options
|
||||
class PIXCfgParser extends Parser;
|
||||
options
|
||||
{
|
||||
k = 2;
|
||||
k = 3;
|
||||
// defaultErrorHandler=false;
|
||||
}
|
||||
{
|
||||
@@ -87,19 +87,13 @@ cfgfile :
|
||||
|
|
||||
hostname
|
||||
|
|
||||
ip_commands
|
||||
ip_access_list_ext
|
||||
|
|
||||
community_list_command
|
||||
|
|
||||
unknown_ip_command
|
||||
|
|
||||
intrface
|
||||
|
|
||||
vlan_interface
|
||||
|
|
||||
switchport
|
||||
|
|
||||
shutdown
|
||||
|
|
||||
sec_level
|
||||
|
|
||||
nameif
|
||||
|
|
||||
controller
|
||||
|
|
||||
@@ -129,8 +123,8 @@ cfgfile :
|
||||
|
||||
//****************************************************************
|
||||
|
||||
ip_commands : IP ( ip_access_list_ext | community_list_command | unknown_command )
|
||||
;
|
||||
// ip_commands : IP ( ip_access_list_ext | community_list_command | unknown_ip_command )
|
||||
// ;
|
||||
|
||||
//****************************************************************
|
||||
quit : QUIT
|
||||
@@ -140,7 +134,7 @@ quit : QUIT
|
||||
;
|
||||
|
||||
//****************************************************************
|
||||
community_list_command : COMMUNITY_LIST
|
||||
community_list_command : IP COMMUNITY_LIST
|
||||
{
|
||||
consumeUntil(NEWLINE);
|
||||
}
|
||||
@@ -337,10 +331,11 @@ dst_port_spec : DESTINATION xoperator
|
||||
}
|
||||
;
|
||||
|
||||
service_other : SERVICE n:WORD
|
||||
service_other : SERVICE (ip:IP|n:WORD)
|
||||
{
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
importer->protocol = LT(0)->getText();
|
||||
if (ip) importer->protocol = "ip";
|
||||
if (n) importer->protocol = n->getText();
|
||||
importer->commitNamedIPServiceObject();
|
||||
*dbg << "NAMED OBJECT SERVICE " << LT(0)->getText() << " ";
|
||||
}
|
||||
@@ -354,6 +349,13 @@ crypto : CRYPTO
|
||||
}
|
||||
;
|
||||
|
||||
//****************************************************************
|
||||
unknown_ip_command : IP WORD
|
||||
{
|
||||
consumeUntil(NEWLINE);
|
||||
}
|
||||
;
|
||||
|
||||
//****************************************************************
|
||||
unknown_command : WORD
|
||||
{
|
||||
@@ -416,7 +418,7 @@ access_list_commands : ACCESS_LIST acl_num:INT_CONST
|
||||
|
||||
//****************************************************************
|
||||
|
||||
ip_access_list_ext : ACCESS_LIST name:WORD
|
||||
ip_access_list_ext : IP ACCESS_LIST name:WORD
|
||||
{
|
||||
importer->setCurrentLineNumber(LT(0)->getLine());
|
||||
importer->clear();
|
||||
@@ -730,7 +732,9 @@ interface_parameters :
|
||||
switchport
|
||||
|
|
||||
shutdown
|
||||
)+
|
||||
|
|
||||
unsupported_interface_commands
|
||||
)
|
||||
;
|
||||
|
||||
vlan_interface : VLAN vlan_id:INT_CONST
|
||||
@@ -738,7 +742,43 @@ vlan_interface : VLAN vlan_id:INT_CONST
|
||||
importer->setInterfaceVlanId(vlan_id->getText());
|
||||
*dbg << " VLAN: " << vlan_id->getText() << std::endl;
|
||||
}
|
||||
NEWLINE
|
||||
;
|
||||
|
||||
unsupported_interface_commands :
|
||||
(
|
||||
SPEED
|
||||
|
|
||||
DUPLEX
|
||||
|
|
||||
DDNS
|
||||
|
|
||||
FORWARD
|
||||
|
|
||||
DELAY
|
||||
|
|
||||
HOLD_TIME
|
||||
|
|
||||
IGMP
|
||||
|
|
||||
IPV6
|
||||
|
|
||||
MAC_ADDRESS
|
||||
|
|
||||
MULTICAST
|
||||
|
|
||||
OSPF
|
||||
|
|
||||
PIM
|
||||
|
|
||||
PPPOE
|
||||
|
|
||||
RIP
|
||||
)
|
||||
{
|
||||
*dbg << " UNSUPPORTED INTERFACE COMMAND: "
|
||||
<< LT(0)->getText() << std::endl;
|
||||
consumeUntil(NEWLINE);
|
||||
}
|
||||
;
|
||||
|
||||
sec_level : SEC_LEVEL sec_level:INT_CONST
|
||||
@@ -746,16 +786,31 @@ sec_level : SEC_LEVEL sec_level:INT_CONST
|
||||
importer->setInterfaceSecurityLevel(sec_level->getText());
|
||||
*dbg << "SEC_LEVEL: " << sec_level->getText() << std::endl;
|
||||
}
|
||||
NEWLINE
|
||||
;
|
||||
|
||||
nameif : NAMEIF phys_intf:WORD (NEWLINE | intf_label:WORD sec_level:WORD NEWLINE)
|
||||
//
|
||||
// If there is a word after label, then there must be sec_level
|
||||
// also. Otherwise there must be nothing.
|
||||
//
|
||||
// In case of pix6 configs, "nameif" is not really inside interface
|
||||
// context but is rather located at the top level, the same level
|
||||
// where "interface" line is found. Also, pix6 places all definitions
|
||||
// of physical interfaces ("interface") first, then all nameif lines
|
||||
// under them. Even though match for nameif is in the interface
|
||||
// context in the grammar, function setInterfaceParametes() can locate
|
||||
// right interface using its first parameter.
|
||||
//
|
||||
nameif : NAMEIF p_intf:WORD
|
||||
(
|
||||
( WORD ) => intf_label:WORD sec_level:WORD |
|
||||
( )
|
||||
)
|
||||
{
|
||||
std::string label = (intf_label) ? intf_label->getText() : "";
|
||||
std::string seclevel = (sec_level) ? sec_level->getText() : "";
|
||||
importer->setInterfaceParametes(phys_intf->getText(), label, seclevel);
|
||||
importer->setInterfaceParametes(p_intf->getText(), label, seclevel);
|
||||
*dbg << " NAMEIF: "
|
||||
<< phys_intf->getText() << label << seclevel << std::endl;
|
||||
<< p_intf->getText() << label << seclevel << std::endl;
|
||||
}
|
||||
;
|
||||
|
||||
@@ -784,11 +839,6 @@ shutdown : SHUTDOWN
|
||||
}
|
||||
;
|
||||
|
||||
interface_known_commands :
|
||||
(
|
||||
intf_address
|
||||
) NEWLINE ;
|
||||
|
||||
|
||||
// Interface IP address.
|
||||
//
|
||||
@@ -967,6 +1017,15 @@ tokens
|
||||
DESCRIPTION = "description";
|
||||
REMARK = "remark";
|
||||
SHUTDOWN = "shutdown";
|
||||
SPEED = "speed";
|
||||
DUPLEX = "duplex";
|
||||
DELAY = "delay";
|
||||
DDNS = "ddns";
|
||||
FORWARD = "forward";
|
||||
HOLD_TIME = "hold-time";
|
||||
IPV6 = "ipv6";
|
||||
MAC_ADDRESS = "mac-address";
|
||||
MULTICAST = "multicast";
|
||||
|
||||
VLAN = "vlan";
|
||||
SWITCHPORT = "switchport";
|
||||
@@ -999,17 +1058,18 @@ tokens
|
||||
DESTINATION = "destination";
|
||||
SOURCE = "source";
|
||||
|
||||
// AHP = "ahp";
|
||||
// EIGRP = "eigrp";
|
||||
// ESP = "esp";
|
||||
// GRE = "gre";
|
||||
// IGMP = "igmp";
|
||||
// IGRP = "igrp";
|
||||
// IPINIP = "ipinip";
|
||||
// NOS = "nos";
|
||||
// OSPF = "ospf";
|
||||
// PCP = "pcp";
|
||||
// PIM = "pim";
|
||||
AHP = "ahp";
|
||||
EIGRP = "eigrp";
|
||||
ESP = "esp";
|
||||
GRE = "gre";
|
||||
IGMP = "igmp";
|
||||
IGRP = "igrp";
|
||||
IPINIP = "ipinip";
|
||||
NOS = "nos";
|
||||
OSPF = "ospf";
|
||||
PCP = "pcp";
|
||||
PIM = "pim";
|
||||
RIP = "rip";
|
||||
|
||||
HOST = "host";
|
||||
ANY = "any";
|
||||
|
||||
Reference in New Issue
Block a user