diff --git a/src/parsers/PIXCfgLexer.cpp b/src/parsers/PIXCfgLexer.cpp index 4745ba2e1..8761f0adf 100644 --- a/src/parsers/PIXCfgLexer.cpp +++ b/src/parsers/PIXCfgLexer.cpp @@ -92,6 +92,7 @@ void PIXCfgLexer::initLiterals() literals["security-level"] = 140; literals["mobile-redirect"] = 90; literals["ospf"] = 23; + literals["name"] = 10; literals["errors"] = 109; literals["mask-request"] = 89; literals["PIX"] = 65; @@ -127,6 +128,7 @@ void PIXCfgLexer::initLiterals() literals["tcp"] = 41; literals["tcp-udp"] = 52; literals["source"] = 43; + literals["names"] = 9; literals["icmp"] = 38; literals["http"] = 35; literals["call-home"] = 57; @@ -162,6 +164,7 @@ void PIXCfgLexer::initLiterals() literals["conversion-error"] = 84; literals["host"] = 31; literals["echo-reply"] = 85; + literals["nameif"] = 128; literals["pcp"] = 24; literals["service-object"] = 53; literals["nat"] = 154; @@ -535,9 +538,9 @@ void PIXCfgLexer::mNEWLINE(bool _createToken) { } if ( inputState->guessing==0 ) { -#line 2415 "pix.g" +#line 2419 "pix.g" newline(); -#line 541 "PIXCfgLexer.cpp" +#line 544 "PIXCfgLexer.cpp" } if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { _token = makeToken(_ttype); @@ -659,9 +662,9 @@ void PIXCfgLexer::mWhitespace(bool _createToken) { } } if ( inputState->guessing==0 ) { -#line 2410 "pix.g" +#line 2414 "pix.g" _ttype = ANTLR_USE_NAMESPACE(antlr)Token::SKIP; -#line 665 "PIXCfgLexer.cpp" +#line 668 "PIXCfgLexer.cpp" } if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { _token = makeToken(_ttype); @@ -777,55 +780,16 @@ void PIXCfgLexer::mOBJECT_GROUP(bool _createToken) { _saveIndex=0; } -void PIXCfgLexer::mNAME(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NAME; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void PIXCfgLexer::mNAMES(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NAMES; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - -void PIXCfgLexer::mNAMEIF(bool _createToken) { - int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); - _ttype = NAMEIF; - ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; - - if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { - _token = makeToken(_ttype); - _token->setText(text.substr(_begin, text.length()-_begin)); - } - _returnToken = _token; - _saveIndex=0; -} - void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { int _ttype; ANTLR_USE_NAMESPACE(antlr)RefToken _token; ANTLR_USE_NAMESPACE(std)string::size_type _begin = text.length(); _ttype = NUMBER_ADDRESS_OR_WORD; ANTLR_USE_NAMESPACE(std)string::size_type _saveIndex; { - bool synPredMatched352 = false; + bool synPredMatched349 = false; if (((LA(1) == 0x6f /* 'o' */ ) && (LA(2) == 0x62 /* 'b' */ ) && (LA(3) == 0x6a /* 'j' */ ))) { - int _m352 = mark(); - synPredMatched352 = true; + int _m349 = mark(); + synPredMatched349 = true; inputState->guessing++; try { { @@ -834,12 +798,12 @@ void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched352 = false; + synPredMatched349 = false; } - rewind(_m352); + rewind(_m349); inputState->guessing--; } - if ( synPredMatched352 ) { + if ( synPredMatched349 ) { { match("object"); { @@ -849,17 +813,17 @@ void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { match("oup"); } if ( inputState->guessing==0 ) { -#line 2476 "pix.g" +#line 2472 "pix.g" _ttype = OBJECT_GROUP; -#line 855 "PIXCfgLexer.cpp" +#line 819 "PIXCfgLexer.cpp" } } else { match(""); if ( inputState->guessing==0 ) { -#line 2478 "pix.g" +#line 2474 "pix.g" _ttype = OBJECT; -#line 863 "PIXCfgLexer.cpp" +#line 827 "PIXCfgLexer.cpp" } } @@ -867,125 +831,15 @@ void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { } } else { - bool synPredMatched357 = false; - if (((LA(1) == 0x6e /* 'n' */ ) && (LA(2) == 0x61 /* 'a' */ ) && (LA(3) == 0x6d /* 'm' */ ))) { - int _m357 = mark(); - synPredMatched357 = true; + bool synPredMatched339 = false; + if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))) && (true))) { + int _m339 = mark(); + synPredMatched339 = true; inputState->guessing++; try { - { - match("nam"); - match("e"); - } - } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched357 = false; - } - rewind(_m357); - inputState->guessing--; - } - if ( synPredMatched357 ) { - { - match("name"); - { - switch ( LA(1)) { - case 0x73 /* 's' */ : - { - match("s"); - if ( inputState->guessing==0 ) { -#line 2486 "pix.g" - _ttype = NAMES; -#line 899 "PIXCfgLexer.cpp" - } - break; - } - case 0x69 /* 'i' */ : - { - match("if"); - if ( inputState->guessing==0 ) { -#line 2488 "pix.g" - _ttype = NAMEIF; -#line 909 "PIXCfgLexer.cpp" - } - break; - } - case 0x20 /* ' ' */ : - { - match(" "); - if ( inputState->guessing==0 ) { -#line 2490 "pix.g" - _ttype = NAME; -#line 919 "PIXCfgLexer.cpp" - } - break; - } - default: - { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } - } - } - } - else { - bool synPredMatched342 = false; - if (((_tokenSet_2.member(LA(1))) && (_tokenSet_3.member(LA(2))) && (true))) { - int _m342 = mark(); - synPredMatched342 = true; - inputState->guessing++; - try { - { - { // ( ... )+ - int _cnt341=0; - for (;;) { - switch ( LA(1)) { - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - { - matchRange('a','f'); - break; - } - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - matchRange('0','9'); - break; - } - default: - { - if ( _cnt341>=1 ) { goto _loop341; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - } - _cnt341++; - } - _loop341:; - } // ( ... )+ - mCOLON(false); - } - } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched342 = false; - } - rewind(_m342); - inputState->guessing--; - } - if ( synPredMatched342 ) { - { { { // ( ... )+ - int _cnt346=0; + int _cnt338=0; for (;;) { switch ( LA(1)) { case 0x61 /* 'a' */ : @@ -1014,357 +868,535 @@ void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { } default: { - if ( _cnt346>=1 ) { goto _loop346; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt338>=1 ) { goto _loop338; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } } - _cnt346++; + _cnt338++; } - _loop346:; + _loop338:; } // ( ... )+ - { // ( ... )+ - int _cnt350=0; - for (;;) { - if ((LA(1) == 0x3a /* ':' */ )) { - mCOLON(false); - { // ( ... )* - for (;;) { - switch ( LA(1)) { - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - { - matchRange('a','f'); - break; - } - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - matchRange('0','9'); - break; - } - default: - { - goto _loop349; - } - } - } - _loop349:; - } // ( ... )* - } - else { - if ( _cnt350>=1 ) { goto _loop350; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt350++; - } - _loop350:; - } // ( ... )+ - } - if ( inputState->guessing==0 ) { -#line 2469 "pix.g" - _ttype = IPV6; -#line 1078 "PIXCfgLexer.cpp" - } + mCOLON(false); } } - else { - bool synPredMatched307 = false; - if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true))) { - int _m307 = mark(); - synPredMatched307 = true; + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched339 = false; + } + rewind(_m339); + inputState->guessing--; + } + if ( synPredMatched339 ) { + { + { + { // ( ... )+ + int _cnt343=0; + for (;;) { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + { + matchRange('a','f'); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + default: + { + if ( _cnt343>=1 ) { goto _loop343; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + } + _cnt343++; + } + _loop343:; + } // ( ... )+ + { // ( ... )+ + int _cnt347=0; + for (;;) { + if ((LA(1) == 0x3a /* ':' */ )) { + mCOLON(false); + { // ( ... )* + for (;;) { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + { + matchRange('a','f'); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + default: + { + goto _loop346; + } + } + } + _loop346:; + } // ( ... )* + } + else { + if ( _cnt347>=1 ) { goto _loop347; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt347++; + } + _loop347:; + } // ( ... )+ + } + if ( inputState->guessing==0 ) { +#line 2465 "pix.g" + _ttype = IPV6; +#line 981 "PIXCfgLexer.cpp" + } + } + } + else { + bool synPredMatched304 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true))) { + int _m304 = mark(); + synPredMatched304 = true; + inputState->guessing++; + try { + { + mDIGIT(false); + } + } + catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { + synPredMatched304 = false; + } + rewind(_m304); + inputState->guessing--; + } + if ( synPredMatched304 ) { + { + bool synPredMatched313 = false; + if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_4.member(LA(2))) && (_tokenSet_4.member(LA(3))))) { + int _m313 = mark(); + synPredMatched313 = true; inputState->guessing++; try { { - mDIGIT(false); + { // ( ... )+ + int _cnt308=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt308>=1 ) { goto _loop308; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt308++; + } + _loop308:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt310=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt310>=1 ) { goto _loop310; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt310++; + } + _loop310:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt312=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt312>=1 ) { goto _loop312; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt312++; + } + _loop312:; + } // ( ... )+ } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched307 = false; + synPredMatched313 = false; } - rewind(_m307); + rewind(_m313); inputState->guessing--; } - if ( synPredMatched307 ) { + if ( synPredMatched313 ) { { - bool synPredMatched316 = false; + { // ( ... )+ + int _cnt316=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt316>=1 ) { goto _loop316; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt316++; + } + _loop316:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt318=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt318>=1 ) { goto _loop318; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt318++; + } + _loop318:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt320=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt320>=1 ) { goto _loop320; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt320++; + } + _loop320:; + } // ( ... )+ + mDOT(false); + { // ( ... )+ + int _cnt322=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); + } + else { + if ( _cnt322>=1 ) { goto _loop322; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + } + + _cnt322++; + } + _loop322:; + } // ( ... )+ + } + if ( inputState->guessing==0 ) { +#line 2453 "pix.g" + _ttype = IPV4; +#line 1128 "PIXCfgLexer.cpp" + } + } + else { + bool synPredMatched328 = false; if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_4.member(LA(2))) && (_tokenSet_4.member(LA(3))))) { - int _m316 = mark(); - synPredMatched316 = true; + int _m328 = mark(); + synPredMatched328 = true; inputState->guessing++; try { { { // ( ... )+ - int _cnt311=0; + int _cnt325=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { mDIGIT(false); } else { - if ( _cnt311>=1 ) { goto _loop311; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt325>=1 ) { goto _loop325; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt311++; + _cnt325++; } - _loop311:; + _loop325:; } // ( ... )+ mDOT(false); { // ( ... )+ - int _cnt313=0; + int _cnt327=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { mDIGIT(false); } else { - if ( _cnt313>=1 ) { goto _loop313; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt327>=1 ) { goto _loop327; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt313++; + _cnt327++; } - _loop313:; - } // ( ... )+ - mDOT(false); - { // ( ... )+ - int _cnt315=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt315>=1 ) { goto _loop315; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt315++; - } - _loop315:; + _loop327:; } // ( ... )+ } } catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched316 = false; + synPredMatched328 = false; } - rewind(_m316); + rewind(_m328); inputState->guessing--; } - if ( synPredMatched316 ) { + if ( synPredMatched328 ) { { { // ( ... )+ - int _cnt319=0; + int _cnt331=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { mDIGIT(false); } else { - if ( _cnt319>=1 ) { goto _loop319; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt331>=1 ) { goto _loop331; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt319++; + _cnt331++; } - _loop319:; + _loop331:; } // ( ... )+ mDOT(false); { // ( ... )+ - int _cnt321=0; + int _cnt333=0; for (;;) { if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { mDIGIT(false); } else { - if ( _cnt321>=1 ) { goto _loop321; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} + if ( _cnt333>=1 ) { goto _loop333; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - _cnt321++; + _cnt333++; } - _loop321:; - } // ( ... )+ - mDOT(false); - { // ( ... )+ - int _cnt323=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt323>=1 ) { goto _loop323; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt323++; - } - _loop323:; - } // ( ... )+ - mDOT(false); - { // ( ... )+ - int _cnt325=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt325>=1 ) { goto _loop325; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt325++; - } - _loop325:; + _loop333:; } // ( ... )+ } if ( inputState->guessing==0 ) { -#line 2457 "pix.g" - _ttype = IPV4; -#line 1225 "PIXCfgLexer.cpp" +#line 2456 "pix.g" + _ttype = NUMBER; +#line 1211 "PIXCfgLexer.cpp" } } - else { - bool synPredMatched331 = false; - if ((((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (_tokenSet_4.member(LA(2))) && (_tokenSet_4.member(LA(3))))) { - int _m331 = mark(); - synPredMatched331 = true; - inputState->guessing++; - try { - { - { // ( ... )+ - int _cnt328=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt328>=1 ) { goto _loop328; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt328++; - } - _loop328:; - } // ( ... )+ - mDOT(false); - { // ( ... )+ - int _cnt330=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt330>=1 ) { goto _loop330; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt330++; - } - _loop330:; - } // ( ... )+ - } + else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true)) { + { // ( ... )+ + int _cnt335=0; + for (;;) { + if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { + mDIGIT(false); } - catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& pe) { - synPredMatched331 = false; + else { + if ( _cnt335>=1 ) { goto _loop335; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} } - rewind(_m331); - inputState->guessing--; + + _cnt335++; } - if ( synPredMatched331 ) { - { - { // ( ... )+ - int _cnt334=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt334>=1 ) { goto _loop334; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt334++; - } - _loop334:; - } // ( ... )+ - mDOT(false); - { // ( ... )+ - int _cnt336=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt336>=1 ) { goto _loop336; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt336++; - } - _loop336:; - } // ( ... )+ - } - if ( inputState->guessing==0 ) { -#line 2460 "pix.g" - _ttype = NUMBER; -#line 1308 "PIXCfgLexer.cpp" - } + _loop335:; + } // ( ... )+ + if ( inputState->guessing==0 ) { +#line 2458 "pix.g" + _ttype = INT_CONST; +#line 1232 "PIXCfgLexer.cpp" } - else if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ )) && (true) && (true)) { - { // ( ... )+ - int _cnt338=0; - for (;;) { - if (((LA(1) >= 0x30 /* '0' */ && LA(1) <= 0x39 /* '9' */ ))) { - mDIGIT(false); - } - else { - if ( _cnt338>=1 ) { goto _loop338; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn());} - } - - _cnt338++; - } - _loop338:; - } // ( ... )+ - if ( inputState->guessing==0 ) { -#line 2462 "pix.g" - _ttype = INT_CONST; -#line 1329 "PIXCfgLexer.cpp" - } - } - else { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); - } - } } + else { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } - else if ((_tokenSet_5.member(LA(1))) && (true) && (true)) { - { + } + } + } + else if ((_tokenSet_5.member(LA(1))) && (true) && (true)) { + { + switch ( LA(1)) { + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); + break; + } + case 0x41 /* 'A' */ : + case 0x42 /* 'B' */ : + case 0x43 /* 'C' */ : + case 0x44 /* 'D' */ : + case 0x45 /* 'E' */ : + case 0x46 /* 'F' */ : + case 0x47 /* 'G' */ : + case 0x48 /* 'H' */ : + case 0x49 /* 'I' */ : + case 0x4a /* 'J' */ : + case 0x4b /* 'K' */ : + case 0x4c /* 'L' */ : + case 0x4d /* 'M' */ : + case 0x4e /* 'N' */ : + case 0x4f /* 'O' */ : + case 0x50 /* 'P' */ : + case 0x51 /* 'Q' */ : + case 0x52 /* 'R' */ : + case 0x53 /* 'S' */ : + case 0x54 /* 'T' */ : + case 0x55 /* 'U' */ : + case 0x56 /* 'V' */ : + case 0x57 /* 'W' */ : + case 0x58 /* 'X' */ : + case 0x59 /* 'Y' */ : + case 0x5a /* 'Z' */ : + { + matchRange('A','Z'); + break; + } + case 0x24 /* '$' */ : + { + match('$' /* charlit */ ); + break; + } + default: + { + throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + } + } + } + { // ( ... )* + for (;;) { switch ( LA(1)) { - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - case 0x67 /* 'g' */ : - case 0x68 /* 'h' */ : - case 0x69 /* 'i' */ : - case 0x6a /* 'j' */ : - case 0x6b /* 'k' */ : - case 0x6c /* 'l' */ : - case 0x6d /* 'm' */ : - case 0x6e /* 'n' */ : - case 0x6f /* 'o' */ : - case 0x70 /* 'p' */ : - case 0x71 /* 'q' */ : - case 0x72 /* 'r' */ : - case 0x73 /* 's' */ : - case 0x74 /* 't' */ : - case 0x75 /* 'u' */ : - case 0x76 /* 'v' */ : - case 0x77 /* 'w' */ : - case 0x78 /* 'x' */ : - case 0x79 /* 'y' */ : - case 0x7a /* 'z' */ : + case 0x21 /* '!' */ : + case 0x22 /* '\"' */ : + case 0x23 /* '#' */ : + case 0x24 /* '$' */ : + case 0x25 /* '%' */ : + case 0x26 /* '&' */ : + case 0x27 /* '\'' */ : { - matchRange('a','z'); + matchRange('!','\''); + break; + } + case 0x2a /* '*' */ : + { + match('*' /* charlit */ ); + break; + } + case 0x2b /* '+' */ : + { + match('+' /* charlit */ ); + break; + } + case 0x2d /* '-' */ : + { + match('-' /* charlit */ ); + break; + } + case 0x2e /* '.' */ : + { + match('.' /* charlit */ ); + break; + } + case 0x2f /* '/' */ : + { + match('/' /* charlit */ ); + break; + } + case 0x30 /* '0' */ : + case 0x31 /* '1' */ : + case 0x32 /* '2' */ : + case 0x33 /* '3' */ : + case 0x34 /* '4' */ : + case 0x35 /* '5' */ : + case 0x36 /* '6' */ : + case 0x37 /* '7' */ : + case 0x38 /* '8' */ : + case 0x39 /* '9' */ : + { + matchRange('0','9'); + break; + } + case 0x3a /* ':' */ : + { + match(':' /* charlit */ ); + break; + } + case 0x3b /* ';' */ : + { + match(';' /* charlit */ ); + break; + } + case 0x3c /* '<' */ : + { + match('<' /* charlit */ ); + break; + } + case 0x3d /* '=' */ : + { + match('=' /* charlit */ ); + break; + } + case 0x3e /* '>' */ : + { + match('>' /* charlit */ ); + break; + } + case 0x3f /* '?' */ : + { + match('?' /* charlit */ ); + break; + } + case 0x40 /* '@' */ : + { + match('@' /* charlit */ ); break; } case 0x41 /* 'A' */ : @@ -1397,203 +1429,74 @@ void PIXCfgLexer::mNUMBER_ADDRESS_OR_WORD(bool _createToken) { matchRange('A','Z'); break; } - case 0x24 /* '$' */ : + case 0x5c /* '\\' */ : { - match('$' /* charlit */ ); + match('\\' /* charlit */ ); + break; + } + case 0x5e /* '^' */ : + { + match('^' /* charlit */ ); + break; + } + case 0x5f /* '_' */ : + { + match('_' /* charlit */ ); + break; + } + case 0x60 /* '`' */ : + { + match('`' /* charlit */ ); + break; + } + case 0x61 /* 'a' */ : + case 0x62 /* 'b' */ : + case 0x63 /* 'c' */ : + case 0x64 /* 'd' */ : + case 0x65 /* 'e' */ : + case 0x66 /* 'f' */ : + case 0x67 /* 'g' */ : + case 0x68 /* 'h' */ : + case 0x69 /* 'i' */ : + case 0x6a /* 'j' */ : + case 0x6b /* 'k' */ : + case 0x6c /* 'l' */ : + case 0x6d /* 'm' */ : + case 0x6e /* 'n' */ : + case 0x6f /* 'o' */ : + case 0x70 /* 'p' */ : + case 0x71 /* 'q' */ : + case 0x72 /* 'r' */ : + case 0x73 /* 's' */ : + case 0x74 /* 't' */ : + case 0x75 /* 'u' */ : + case 0x76 /* 'v' */ : + case 0x77 /* 'w' */ : + case 0x78 /* 'x' */ : + case 0x79 /* 'y' */ : + case 0x7a /* 'z' */ : + { + matchRange('a','z'); break; } default: { - throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); + goto _loop355; } } - } - { // ( ... )* - for (;;) { - switch ( LA(1)) { - case 0x21 /* '!' */ : - case 0x22 /* '\"' */ : - case 0x23 /* '#' */ : - case 0x24 /* '$' */ : - case 0x25 /* '%' */ : - case 0x26 /* '&' */ : - case 0x27 /* '\'' */ : - { - matchRange('!','\''); - break; - } - case 0x2a /* '*' */ : - { - match('*' /* charlit */ ); - break; - } - case 0x2b /* '+' */ : - { - match('+' /* charlit */ ); - break; - } - case 0x2d /* '-' */ : - { - match('-' /* charlit */ ); - break; - } - case 0x2e /* '.' */ : - { - match('.' /* charlit */ ); - break; - } - case 0x2f /* '/' */ : - { - match('/' /* charlit */ ); - break; - } - case 0x30 /* '0' */ : - case 0x31 /* '1' */ : - case 0x32 /* '2' */ : - case 0x33 /* '3' */ : - case 0x34 /* '4' */ : - case 0x35 /* '5' */ : - case 0x36 /* '6' */ : - case 0x37 /* '7' */ : - case 0x38 /* '8' */ : - case 0x39 /* '9' */ : - { - matchRange('0','9'); - break; - } - case 0x3a /* ':' */ : - { - match(':' /* charlit */ ); - break; - } - case 0x3b /* ';' */ : - { - match(';' /* charlit */ ); - break; - } - case 0x3c /* '<' */ : - { - match('<' /* charlit */ ); - break; - } - case 0x3d /* '=' */ : - { - match('=' /* charlit */ ); - break; - } - case 0x3e /* '>' */ : - { - match('>' /* charlit */ ); - break; - } - case 0x3f /* '?' */ : - { - match('?' /* charlit */ ); - break; - } - case 0x40 /* '@' */ : - { - match('@' /* charlit */ ); - break; - } - case 0x41 /* 'A' */ : - case 0x42 /* 'B' */ : - case 0x43 /* 'C' */ : - case 0x44 /* 'D' */ : - case 0x45 /* 'E' */ : - case 0x46 /* 'F' */ : - case 0x47 /* 'G' */ : - case 0x48 /* 'H' */ : - case 0x49 /* 'I' */ : - case 0x4a /* 'J' */ : - case 0x4b /* 'K' */ : - case 0x4c /* 'L' */ : - case 0x4d /* 'M' */ : - case 0x4e /* 'N' */ : - case 0x4f /* 'O' */ : - case 0x50 /* 'P' */ : - case 0x51 /* 'Q' */ : - case 0x52 /* 'R' */ : - case 0x53 /* 'S' */ : - case 0x54 /* 'T' */ : - case 0x55 /* 'U' */ : - case 0x56 /* 'V' */ : - case 0x57 /* 'W' */ : - case 0x58 /* 'X' */ : - case 0x59 /* 'Y' */ : - case 0x5a /* 'Z' */ : - { - matchRange('A','Z'); - break; - } - case 0x5c /* '\\' */ : - { - match('\\' /* charlit */ ); - break; - } - case 0x5e /* '^' */ : - { - match('^' /* charlit */ ); - break; - } - case 0x5f /* '_' */ : - { - match('_' /* charlit */ ); - break; - } - case 0x60 /* '`' */ : - { - match('`' /* charlit */ ); - break; - } - case 0x61 /* 'a' */ : - case 0x62 /* 'b' */ : - case 0x63 /* 'c' */ : - case 0x64 /* 'd' */ : - case 0x65 /* 'e' */ : - case 0x66 /* 'f' */ : - case 0x67 /* 'g' */ : - case 0x68 /* 'h' */ : - case 0x69 /* 'i' */ : - case 0x6a /* 'j' */ : - case 0x6b /* 'k' */ : - case 0x6c /* 'l' */ : - case 0x6d /* 'm' */ : - case 0x6e /* 'n' */ : - case 0x6f /* 'o' */ : - case 0x70 /* 'p' */ : - case 0x71 /* 'q' */ : - case 0x72 /* 'r' */ : - case 0x73 /* 's' */ : - case 0x74 /* 't' */ : - case 0x75 /* 'u' */ : - case 0x76 /* 'v' */ : - case 0x77 /* 'w' */ : - case 0x78 /* 'x' */ : - case 0x79 /* 'y' */ : - case 0x7a /* 'z' */ : - { - matchRange('a','z'); - break; - } - default: - { - goto _loop362; - } - } - } - _loop362:; - } // ( ... )* - if ( inputState->guessing==0 ) { -#line 2499 "pix.g" - _ttype = WORD; -#line 1591 "PIXCfgLexer.cpp" - } } + _loop355:; + } // ( ... )* + if ( inputState->guessing==0 ) { +#line 2483 "pix.g" + _ttype = WORD; +#line 1494 "PIXCfgLexer.cpp" + } + } else { throw ANTLR_USE_NAMESPACE(antlr)NoViableAltForCharException(LA(1), getFilename(), getLine(), getColumn()); } - }}} + }} } if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { _token = makeToken(_ttype); @@ -1629,11 +1532,11 @@ void PIXCfgLexer::mSTRING(bool _createToken) { matchNot('\"' /* charlit */ ); } else { - goto _loop365; + goto _loop358; } } - _loop365:; + _loop358:; } // ( ... )* match('\"' /* charlit */ ); if ( _createToken && _token==ANTLR_USE_NAMESPACE(antlr)nullToken && _ttype!=ANTLR_USE_NAMESPACE(antlr)Token::SKIP ) { diff --git a/src/parsers/PIXCfgLexer.hpp b/src/parsers/PIXCfgLexer.hpp index 109d6f9e0..1769f0b36 100644 --- a/src/parsers/PIXCfgLexer.hpp +++ b/src/parsers/PIXCfgLexer.hpp @@ -60,9 +60,6 @@ public: protected: void mHEXDIGIT(bool _createToken); protected: void mOBJECT(bool _createToken); protected: void mOBJECT_GROUP(bool _createToken); - protected: void mNAME(bool _createToken); - protected: void mNAMES(bool _createToken); - protected: void mNAMEIF(bool _createToken); public: void mNUMBER_ADDRESS_OR_WORD(bool _createToken); public: void mDOT(bool _createToken); public: void mSTRING(bool _createToken); diff --git a/src/parsers/PIXCfgParser.cpp b/src/parsers/PIXCfgParser.cpp index 34c1f12dd..fac2890fd 100644 --- a/src/parsers/PIXCfgParser.cpp +++ b/src/parsers/PIXCfgParser.cpp @@ -7136,8 +7136,8 @@ const char* PIXCfgParser::tokenNames[] = { "\"ip\"", "\"community-list\"", "\"timeout\"", - "NAMES", - "NAME", + "\"names\"", + "\"name\"", "IPV4", "WORD", "IPV6", @@ -7255,7 +7255,7 @@ const char* PIXCfgParser::tokenNames[] = { "\"full\"", "\"baseT\"", "\"baseTX\"", - "NAMEIF", + "\"nameif\"", "\"vlan\"", "\"speed\"", "\"duplex\"", @@ -7329,10 +7329,10 @@ const unsigned long PIXCfgParser::_tokenSet_0_data_[] = { 2UL, 0UL, 0UL, 0UL, 0U // EOF const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_0(_tokenSet_0_data_,8); const unsigned long PIXCfgParser::_tokenSet_1_data_[] = { 268441458UL, 2172657788UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "service" "http" -// "ssh" "telnet" "icmp" OBJECT_GROUP "crypto" "dns" "no" "certificate" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "service" +// "http" "ssh" "telnet" "icmp" OBJECT_GROUP "crypto" "dns" "no" "certificate" // "PIX" "ASA" "hostname" "access-list" "interface" "controller" LINE_COMMENT -// "exit" NAMEIF "access-group" COLON_COMMENT "nat" "global" "static" +// "exit" "nameif" "access-group" COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_1(_tokenSet_1_data_,12); const unsigned long PIXCfgParser::_tokenSet_2_data_[] = { 0UL, 128UL, 0UL, 469762048UL, 0UL, 0UL, 0UL, 0UL }; // INT_CONST "aui" "auto" "bnc" @@ -7348,11 +7348,11 @@ const unsigned long PIXCfgParser::_tokenSet_4_data_[] = { 536854592UL, 10048UL, // "deny" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_4(_tokenSet_4_data_,8); const unsigned long PIXCfgParser::_tokenSet_5_data_[] = { 3489666930UL, 2172657791UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "host" "range" "subnet" "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP // "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" -// "interface" "controller" LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT -// "nat" "global" "static" +// "interface" "controller" LINE_COMMENT "exit" "nameif" "access-group" +// COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_5(_tokenSet_5_data_,12); const unsigned long PIXCfgParser::_tokenSet_6_data_[] = { 268423232UL, 1984UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // "ip" WORD "ah" "eigrp" "esp" "gre" "igmp" "igrp" "ipinip" "ipsec" "nos" @@ -7376,10 +7376,10 @@ const unsigned long PIXCfgParser::_tokenSet_11_data_[] = { 268419136UL, 128UL, 0 // "pcp" "pim" "pptp" "snp" INT_CONST const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_11(_tokenSet_11_data_,8); const unsigned long PIXCfgParser::_tokenSet_12_data_[] = { 1342183282UL, 2172657788UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP "crypto" "dns" "no" // "certificate" "PIX" "ASA" "hostname" "access-list" "interface" "controller" -// LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT "nat" "global" +// LINE_COMMENT "exit" "nameif" "access-group" COLON_COMMENT "nat" "global" // "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_12(_tokenSet_12_data_,12); const unsigned long PIXCfgParser::_tokenSet_13_data_[] = { 16UL, 0UL, 0UL, 3146112UL, 0UL, 0UL, 0UL, 0UL }; @@ -7394,32 +7394,32 @@ const unsigned long PIXCfgParser::_tokenSet_15_data_[] = { 2415921168UL, 12289UL // "time-range" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_15(_tokenSet_15_data_,8); const unsigned long PIXCfgParser::_tokenSet_16_data_[] = { 1342183282UL, 2172706940UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP "group-object" "network-object" // "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" -// "interface" "controller" LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT -// "nat" "global" "static" +// "interface" "controller" LINE_COMMENT "exit" "nameif" "access-group" +// COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_16(_tokenSet_16_data_,12); const unsigned long PIXCfgParser::_tokenSet_17_data_[] = { 1342183282UL, 2172805244UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP "group-object" "protocol-object" // "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" -// "interface" "controller" LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT -// "nat" "global" "static" +// "interface" "controller" LINE_COMMENT "exit" "nameif" "access-group" +// COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_17(_tokenSet_17_data_,12); const unsigned long PIXCfgParser::_tokenSet_18_data_[] = { 1342183282UL, 2172936316UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP "group-object" "icmp-object" // "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" -// "interface" "controller" LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT -// "nat" "global" "static" +// "interface" "controller" LINE_COMMENT "exit" "nameif" "access-group" +// COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_18(_tokenSet_18_data_,12); const unsigned long PIXCfgParser::_tokenSet_19_data_[] = { 1342183282UL, 2178965628UL, 167UL, 54525984UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "service" "http" "ssh" "telnet" "icmp" OBJECT_GROUP "group-object" "service-object" // "port-object" "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" -// "access-list" "interface" "controller" LINE_COMMENT "exit" NAMEIF "access-group" -// COLON_COMMENT "nat" "global" "static" +// "access-list" "interface" "controller" LINE_COMMENT "exit" "nameif" +// "access-group" COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_19(_tokenSet_19_data_,12); const unsigned long PIXCfgParser::_tokenSet_20_data_[] = { 2415925264UL, 8321UL, 4294832128UL, 11534847UL, 0UL, 0UL, 0UL, 0UL }; // NEWLINE IPV4 WORD OBJECT "host" "range" INT_CONST OBJECT_GROUP "eq" @@ -7454,23 +7454,23 @@ const unsigned long PIXCfgParser::_tokenSet_27_data_[] = { 268435472UL, 8193UL, // "log" "log-input" "fragments" "time-range" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_27(_tokenSet_27_data_,8); const unsigned long PIXCfgParser::_tokenSet_28_data_[] = { 335550322UL, 2172657917UL, 520359UL, 58720160UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD "pptp" OBJECT "range" -// "service" "http" "ssh" "telnet" "icmp" INT_CONST OBJECT_GROUP "crypto" -// "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" "eq" "gt" -// "lt" "neq" "echo" "rip" "established" "interface" "log" "log-input" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD "pptp" OBJECT +// "range" "service" "http" "ssh" "telnet" "icmp" INT_CONST OBJECT_GROUP +// "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" +// "eq" "gt" "lt" "neq" "echo" "rip" "established" "interface" "log" "log-input" // "alerts" "critical" "debugging" "emergencies" "errors" "informational" // "notifications" "warnings" "disable" "inactive" "interval" "fragments" -// "time-range" "controller" LINE_COMMENT "exit" NAMEIF "access-group" +// "time-range" "controller" LINE_COMMENT "exit" "nameif" "access-group" // COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_28(_tokenSet_28_data_,12); const unsigned long PIXCfgParser::_tokenSet_29_data_[] = { 335550322UL, 2172657916UL, 196775UL, 58720160UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD "pptp" OBJECT "service" -// "http" "ssh" "telnet" "icmp" INT_CONST OBJECT_GROUP "crypto" "dns" "no" -// "certificate" "PIX" "ASA" "hostname" "access-list" "echo" "rip" "interface" -// "log" "log-input" "alerts" "critical" "debugging" "emergencies" "errors" -// "informational" "notifications" "warnings" "disable" "inactive" "interval" -// "fragments" "time-range" "controller" LINE_COMMENT "exit" NAMEIF "access-group" -// COLON_COMMENT "nat" "global" "static" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD "pptp" OBJECT +// "service" "http" "ssh" "telnet" "icmp" INT_CONST OBJECT_GROUP "crypto" +// "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" "echo" +// "rip" "interface" "log" "log-input" "alerts" "critical" "debugging" +// "emergencies" "errors" "informational" "notifications" "warnings" "disable" +// "inactive" "interval" "fragments" "time-range" "controller" LINE_COMMENT +// "exit" "nameif" "access-group" COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_29(_tokenSet_29_data_,12); const unsigned long PIXCfgParser::_tokenSet_30_data_[] = { 2415921152UL, 8193UL, 61440UL, 96UL, 0UL, 0UL, 0UL, 0UL }; // IPV4 OBJECT "host" "range" OBJECT_GROUP "eq" "gt" "lt" "neq" "interface" @@ -7488,7 +7488,7 @@ const unsigned long PIXCfgParser::_tokenSet_32_data_[] = { 2483042320UL, 1679121 // "log-input" "fragments" "time-range" "netmask" "norandomseq" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_32(_tokenSet_32_data_,12); const unsigned long PIXCfgParser::_tokenSet_33_data_[] = { 2415927154UL, 2172657917UL, 4294832295UL, 66060799UL, 1996488705UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME IPV4 WORD OBJECT "host" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" IPV4 WORD OBJECT "host" // "range" "service" "http" "ssh" "telnet" "icmp" INT_CONST OBJECT_GROUP // "crypto" "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" // "eq" "gt" "lt" "neq" "echo" "established" "alternate-address" "conversion-error" @@ -7497,17 +7497,17 @@ const unsigned long PIXCfgParser::_tokenSet_33_data_[] = { 2415927154UL, 2172657 // "router-solicitation" "source-quench" "time-exceeded" "timestamp-reply" // "timestamp-request" "traceroute" "unreachable" "interface" "any" "log" // "log-input" "fragments" "time-range" "controller" "outside" LINE_COMMENT -// "exit" NAMEIF "access-group" COLON_COMMENT "nat" CLOSING_PAREN COMMA +// "exit" "nameif" "access-group" COLON_COMMENT "nat" CLOSING_PAREN COMMA // "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_33(_tokenSet_33_data_,12); const unsigned long PIXCfgParser::_tokenSet_34_data_[] = { 1115947072UL, 2147483648UL, 131072UL, 0UL, 147455UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// "ip" "igmp" "ospf" "pim" "description" "no" "rip" NAMEIF "vlan" "speed" +// "ip" "igmp" "ospf" "pim" "description" "no" "rip" "nameif" "vlan" "speed" // "duplex" "ddns" "forward" "delay" "hold-time" "ipv6" "mac-address" "multicast" // PPPOE "security-level" "shutdown" "switchport" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_34(_tokenSet_34_data_,12); const unsigned long PIXCfgParser::_tokenSet_35_data_[] = { 1115947072UL, 2147483648UL, 131072UL, 50331648UL, 147455UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // "ip" "igmp" "ospf" "pim" "description" "no" "rip" LINE_COMMENT "exit" -// NAMEIF "vlan" "speed" "duplex" "ddns" "forward" "delay" "hold-time" +// "nameif" "vlan" "speed" "duplex" "ddns" "forward" "delay" "hold-time" // "ipv6" "mac-address" "multicast" PPPOE "security-level" "shutdown" "switchport" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_35(_tokenSet_35_data_,12); const unsigned long PIXCfgParser::_tokenSet_36_data_[] = { 4096UL, 0UL, 0UL, 8388608UL, 0UL, 0UL, 0UL, 0UL }; @@ -7520,11 +7520,11 @@ const unsigned long PIXCfgParser::_tokenSet_38_data_[] = { 16UL, 16778880UL, 0UL // NEWLINE INT_CONST "tcp" "udp" "dns" "outside" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_38(_tokenSet_38_data_,8); const unsigned long PIXCfgParser::_tokenSet_39_data_[] = { 3489666930UL, 2172659455UL, 167UL, 62914592UL, 1191182337UL, 2UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME WORD OBJECT "description" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" WORD OBJECT "description" // "host" "range" "subnet" "service" "http" "ssh" "telnet" "icmp" INT_CONST // "tcp" "udp" OBJECT_GROUP "crypto" "dns" "no" "certificate" "PIX" "ASA" // "hostname" "access-list" "interface" "controller" "outside" LINE_COMMENT -// "exit" NAMEIF "access-group" COLON_COMMENT "nat" "global" "static" +// "exit" "nameif" "access-group" COLON_COMMENT "nat" "global" "static" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_39(_tokenSet_39_data_,12); const unsigned long PIXCfgParser::_tokenSet_40_data_[] = { 0UL, 16778880UL, 0UL, 0UL, 0UL, 5UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; // INT_CONST "tcp" "udp" "dns" "netmask" "norandomseq" @@ -7541,10 +7541,10 @@ const unsigned long PIXCfgParser::_tokenSet_43_data_[] = { 16UL, 16778880UL, 0UL // NEWLINE INT_CONST "tcp" "udp" "dns" "netmask" "norandomseq" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_43(_tokenSet_43_data_,12); const unsigned long PIXCfgParser::_tokenSet_44_data_[] = { 268443506UL, 2172659452UL, 167UL, 54525984UL, 1191182337UL, 7UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL }; -// EOF NEWLINE "quit" "ip" "timeout" NAMES NAME IPV4 WORD OBJECT "service" +// EOF NEWLINE "quit" "ip" "timeout" "names" "name" IPV4 WORD OBJECT "service" // "http" "ssh" "telnet" "icmp" INT_CONST "tcp" "udp" OBJECT_GROUP "crypto" // "dns" "no" "certificate" "PIX" "ASA" "hostname" "access-list" "interface" -// "controller" LINE_COMMENT "exit" NAMEIF "access-group" COLON_COMMENT +// "controller" LINE_COMMENT "exit" "nameif" "access-group" COLON_COMMENT // "nat" "global" "netmask" "static" "norandomseq" const ANTLR_USE_NAMESPACE(antlr)BitSet PIXCfgParser::_tokenSet_44(_tokenSet_44_data_,12); diff --git a/src/parsers/PIXCfgParserTokenTypes.txt b/src/parsers/PIXCfgParserTokenTypes.txt index 723d9bfd8..3bf326fd9 100644 --- a/src/parsers/PIXCfgParserTokenTypes.txt +++ b/src/parsers/PIXCfgParserTokenTypes.txt @@ -5,8 +5,8 @@ QUIT="quit"=5 IP="ip"=6 COMMUNITY_LIST="community-list"=7 TIMEOUT="timeout"=8 -NAMES=9 -NAME=10 +NAMES="names"=9 +NAME="name"=10 IPV4=11 WORD=12 IPV6=13 @@ -124,7 +124,7 @@ BNC="bnc"=124 FULL="full"=125 BASET="baseT"=126 BASETX="baseTX"=127 -NAMEIF=128 +NAMEIF="nameif"=128 VLAN="vlan"=129 SPEED="speed"=130 DUPLEX="duplex"=131 diff --git a/src/parsers/pix.g b/src/parsers/pix.g index 4f6e896da..e759daae1 100644 --- a/src/parsers/pix.g +++ b/src/parsers/pix.g @@ -2396,6 +2396,10 @@ tokens HTTP = "http"; AUTHENTICATION_CERTIFICATE = "authentication-certificate"; SERVER = "server"; + + NAME = "name"; + NAMES = "names"; + NAMEIF = "nameif"; } LINE_COMMENT : "!" (~('\r' | '\n'))* NEWLINE ; @@ -2438,14 +2442,6 @@ OBJECT :; protected OBJECT_GROUP :; -protected -NAME :; - -protected -NAMES :; - -protected -NAMEIF :; NUMBER_ADDRESS_OR_WORD : @@ -2479,18 +2475,6 @@ NUMBER_ADDRESS_OR_WORD : ) ) | - ("nam" "e") => - ( - "name" - ( - "s" { _ttype = NAMES; } - | - "if" { _ttype = NAMEIF; } - | - " " { _ttype = NAME; } - ) - ) - | // making sure ',' '(' ')' are not part of WORD ( 'a'..'z' | 'A'..'Z' | '$' ) ( '!'..'\'' | '*' | '+' | '-' | '.' | '/' | '0'..'9' | ':' | diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.fwb b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.fwb index 85e7647d3..9647d58ab 100644 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.fwb +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.fwb @@ -1,6 +1,6 @@ - + @@ -432,30 +432,30 @@ - - + + - + - + - + - + - + - + @@ -463,30 +463,30 @@ - - - - - + + + + + - - - - - - + + + + + + - + - - + + @@ -499,7 +499,7 @@ - + @@ -519,7 +519,7 @@ - + @@ -539,7 +539,7 @@ - + @@ -559,7 +559,7 @@ - + @@ -579,7 +579,7 @@ - + @@ -599,7 +599,7 @@ - + @@ -619,7 +619,7 @@ - + @@ -639,7 +639,7 @@ - + @@ -659,7 +659,7 @@ - + @@ -679,7 +679,7 @@ - + @@ -699,7 +699,7 @@ - + @@ -719,7 +719,7 @@ - + @@ -739,7 +739,7 @@ - + @@ -759,7 +759,7 @@ - + @@ -779,7 +779,7 @@ - + @@ -799,7 +799,7 @@ - + @@ -819,7 +819,7 @@ - + @@ -839,7 +839,7 @@ - + @@ -859,7 +859,7 @@ - + @@ -885,12 +885,12 @@ - - + + - - + + diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.output b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.output index dabcc2df0..07cfda1eb 100644 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.output +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.output @@ -1,30 +1,28 @@ 3: Version: 8.0 5: Host name: pixfirewall -12: New interface: Ethernet0 -12: Interface parameters: inside -12: Interface label: inside -14: Interface address: 192.168.2.221/255.255.255.0 -17: New interface: Ethernet1 -17: Interface parameters: outside -17: Interface label: outside -19: Interface address: 192.0.2.221/255.255.255.0 -22: New interface: Ethernet2 +13: New interface: Ethernet0 +13: Interface parameters: inside +13: Interface label: inside +15: Interface address: 192.168.2.221/255.255.255.0 +18: New interface: Ethernet1 +18: Interface parameters: outside +18: Interface label: outside +20: Interface address: 192.0.2.221/255.255.255.0 +23: New interface: Ethernet2 Warning: interface Ethernet2 was not imported because it is in "shutdown" mode -28: New interface: Ethernet3 +29: New interface: Ethernet3 Warning: interface Ethernet3 was not imported because it is in "shutdown" mode -34: New interface: Ethernet4 +35: New interface: Ethernet4 Warning: interface Ethernet4 was not imported because it is in "shutdown" mode -42: Object Group (network) net_1_group -45: Object Group (network) another_group_net_1 -48: Object Group (network) host_net_1 -51: Object Group (network) host_net_2 -54: Object Group (network) net-1 -57: Object Group (network) net-2 -63: filtering rule: access list inside_in, action permit -64: filtering rule: access list inside_in, action deny -66: Interface Ethernet0 ruleset inside_in direction 'in' -72: Interface Ethernet1 ruleset icmp_commands_outside direction 'in' -72: filtering rule: access list icmp_commands_outside, action permit +43: Object Group (network) net_1_group +46: Object Group (network) another_group_net_1 +49: Object Group (network) host_net_1 +52: Object Group (network) host_net_2 +55: Object Group (network) net-1 +58: Object Group (network) net-2 +64: filtering rule: access list inside_in, action permit +65: filtering rule: access list inside_in, action deny +67: Interface Ethernet0 ruleset inside_in direction 'in' 73: Interface Ethernet1 ruleset icmp_commands_outside direction 'in' 73: filtering rule: access list icmp_commands_outside, action permit 74: Interface Ethernet1 ruleset icmp_commands_outside direction 'in' @@ -35,8 +33,8 @@ Warning: interface Ethernet4 was not imported because it is in "shutdown" mode 76: filtering rule: access list icmp_commands_outside, action permit 77: Interface Ethernet1 ruleset icmp_commands_outside direction 'in' 77: filtering rule: access list icmp_commands_outside, action permit -78: Interface Ethernet0 ruleset icmp_commands_inside direction 'in' -78: filtering rule: access list icmp_commands_inside, action permit +78: Interface Ethernet1 ruleset icmp_commands_outside direction 'in' +78: filtering rule: access list icmp_commands_outside, action permit 79: Interface Ethernet0 ruleset icmp_commands_inside direction 'in' 79: filtering rule: access list icmp_commands_inside, action permit 80: Interface Ethernet0 ruleset icmp_commands_inside direction 'in' @@ -53,7 +51,9 @@ Warning: interface Ethernet4 was not imported because it is in "shutdown" mode 85: filtering rule: access list icmp_commands_inside, action permit 86: Interface Ethernet0 ruleset icmp_commands_inside direction 'in' 86: filtering rule: access list icmp_commands_inside, action permit -99: Interface Ethernet0 ruleset telnet_commands_inside direction 'in' -99: filtering rule: access list telnet_commands_inside, action permit -101: Interface Ethernet0 ruleset ssh_commands_inside direction 'in' -101: filtering rule: access list ssh_commands_inside, action permit +87: Interface Ethernet0 ruleset icmp_commands_inside direction 'in' +87: filtering rule: access list icmp_commands_inside, action permit +100: Interface Ethernet0 ruleset telnet_commands_inside direction 'in' +100: filtering rule: access list telnet_commands_inside, action permit +102: Interface Ethernet0 ruleset ssh_commands_inside direction 'in' +102: filtering rule: access list ssh_commands_inside, action permit diff --git a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.test b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.test index 4d8656698..8a033fb21 100644 --- a/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.test +++ b/src/unit_tests/PIXImporterTest/test_data/asa8.0-names.test @@ -8,6 +8,7 @@ names name 192.168.2.0 inside_network name 192.168.2.221 inside_ip name 192.168.2.240 net_1 +name 1.1.1.1 named-host-1 ! interface Ethernet0 nameif inside