/*@bgen(jjtree) Generated By:JJTree: Do not edit this line. Parser.jj */ /*@egen*//* * @(#)file Parser.jjt * @(#)author Sun Microsystems, Inc. * * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. * */ options { STATIC=false; } PARSER_BEGIN(Parser) package com.sun.jmx.snmp.IPAcl; import java.io.*; public class Parser/*@bgen(jjtree)*/implements ParserTreeConstants/*@egen*/ {/*@bgen(jjtree)*/ protected JJTParserState jjtree = new JJTParserState(); /*@egen*/ } PARSER_END(Parser) SKIP : { " " | "\t" | "\n" | "\r" | <"--" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> | <"#" (~["\n","\r"])* ("\n"|"\r"|"\r\n")> } /* RESERVED WORDS AND LITERALS */ TOKEN : { | | | | | | | | | | | | | | | } TOKEN : /* LITERALS */ { < INTEGER_LITERAL: (["l","L"])? | (["l","L"])? | (["l","L"])? > | < #DECIMAL_LITERAL: ["1"-"9"] (["0"-"9"])* > | < #HEX_LITERAL: "0" ["x","X"] (["0"-"9","a"-"f","A"-"F"])+ > | < #OCTAL_LITERAL: "0" (["0"-"7"])* > } TOKEN : /* V6 LITERALS */ { < V6_ADDRESS: ((( ( ( ":")+ (":")?) | "::" ) ( ":")* ( | ( "." "." "." ))) | ("::")) | ( ( ":")+ ":") > | <#H: (["0"-"9","a"-"f","A"-"F"])+ > | <#D: (["0"-"9"])+ > } TOKEN : /* IDENTIFIERS */ { < IDENTIFIER: ( (|)+ (||)* (|)+ ) | (|)+ > | < #LETTER: ["a"-"z","A"-"Z"] > | < #SEPARATOR: ["-", "_"] > | < #DIGIT: ["0"-"9"] > | } TOKEN: /* SEPARATOR */ { < COMMA: "," > | < DOT: "." > | < MARK: "!" > | < MASK: "/"> } // A file can contain several acl definitions // JDMSecurityDefs SecurityDefs() : {/*@bgen(jjtree) SecurityDefs */ JDMSecurityDefs jjtn000 = new JDMSecurityDefs(JJTSECURITYDEFS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) SecurityDefs */ try { /*@egen*/ [AclBlock()] [TrapBlock()] [InformBlock()] /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { return jjtn000;}/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void AclBlock(): {/*@bgen(jjtree) AclBlock */ JDMAclBlock jjtn000 = new JDMAclBlock(JJTACLBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) AclBlock */ try { /*@egen*/ "acl" "=" "{" (AclItem())+ "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void AclItem(): {/*@bgen(jjtree) AclItem */ JDMAclItem jjtn000 = new JDMAclItem(JJTACLITEM); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) AclItem */ try { /*@egen*/ "{" jjtn000.com= Communities() jjtn000.access= Access() Managers() "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } JDMCommunities Communities(): {/*@bgen(jjtree) Communities */ JDMCommunities jjtn000 = new JDMCommunities(JJTCOMMUNITIES); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Communities */ try { /*@egen*/ "communities" "=" Community() ( "," Community())*/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {return jjtn000;}/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Community(): {/*@bgen(jjtree) Community */ JDMCommunity jjtn000 = new JDMCommunity(JJTCOMMUNITY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) Community */ try { /*@egen*/ t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {jjtn000.communityString= t.image;}/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } JDMAccess Access(): {/*@bgen(jjtree) Access */ JDMAccess jjtn000 = new JDMAccess(JJTACCESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/} {/*@bgen(jjtree) Access */ try { /*@egen*/ "access" "=" ( {jjtn000.access= RO;} | {jjtn000.access= RW;} )/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {return jjtn000;}/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Managers() : {/*@bgen(jjtree) Managers */ JDMManagers jjtn000 = new JDMManagers(JJTMANAGERS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) Managers */ try { /*@egen*/ "managers" "=" Host() ( "," Host())*/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Host() : {/*@bgen(jjtree) Host */ JDMHost jjtn000 = new JDMHost(JJTHOST); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) Host */ try { /*@egen*/ HostName() | LOOKAHEAD( ( "." )* "/" ) NetMask() | LOOKAHEAD( "/" ) NetMaskV6() | LOOKAHEAD( ".") IpAddress() | IpV6Address() | IpMask()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void HostName(): {/*@bgen(jjtree) HostName */ JDMHostName jjtn000 = new JDMHostName(JJTHOSTNAME); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) HostName */ try { /*@egen*/ t= { jjtn000.name.append(t.image); } ( "." t= {jjtn000.name.append( '.').append(t.image); } )*/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void IpAddress(): {/*@bgen(jjtree) IpAddress */ JDMIpAddress jjtn000 = new JDMIpAddress(JJTIPADDRESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) IpAddress */ try { /*@egen*/ t= {jjtn000.address.append(t.image); } ( "." t= {jjtn000.address.append( '.').append(t.image); } )*/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void IpV6Address(): {/*@bgen(jjtree) IpV6Address */ JDMIpV6Address jjtn000 = new JDMIpV6Address(JJTIPV6ADDRESS); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) IpV6Address */ try { /*@egen*/ t= /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {jjtn000.address.append(t.image); }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void IpMask(): {/*@bgen(jjtree) IpMask */ JDMIpMask jjtn000 = new JDMIpMask(JJTIPMASK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) IpMask */ try { /*@egen*/ t= {jjtn000.address.append(t.image); } ( "!" t= {jjtn000.address.append( '.').append(t.image); } )*/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void NetMask(): {/*@bgen(jjtree) NetMask */ JDMNetMask jjtn000 = new JDMNetMask(JJTNETMASK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) NetMask */ try { /*@egen*/ t= {jjtn000.address.append(t.image); } ( "." t= {jjtn000.address.append( '.').append(t.image); } )* "/" t= /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {jjtn000.mask = t.image; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void NetMaskV6(): {/*@bgen(jjtree) NetMaskV6 */ JDMNetMaskV6 jjtn000 = new JDMNetMaskV6(JJTNETMASKV6); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) NetMaskV6 */ try { /*@egen*/ t= {jjtn000.address.append(t.image); } "/" t= /*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ {jjtn000.mask = t.image; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void TrapBlock(): {/*@bgen(jjtree) TrapBlock */ JDMTrapBlock jjtn000 = new JDMTrapBlock(JJTTRAPBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) TrapBlock */ try { /*@egen*/ "trap" "=" "{" (TrapItem())* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void TrapItem(): {/*@bgen(jjtree) TrapItem */ JDMTrapItem jjtn000 = new JDMTrapItem(JJTTRAPITEM); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) TrapItem */ try { /*@egen*/ "{" jjtn000.comm= TrapCommunity() TrapInterestedHost() (Enterprise())* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } JDMTrapCommunity TrapCommunity(): {/*@bgen(jjtree) TrapCommunity */ JDMTrapCommunity jjtn000 = new JDMTrapCommunity(JJTTRAPCOMMUNITY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) TrapCommunity */ try { /*@egen*/ "trap-community" "=" t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.community= t.image; return jjtn000; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void TrapInterestedHost(): {/*@bgen(jjtree) TrapInterestedHost */ JDMTrapInterestedHost jjtn000 = new JDMTrapInterestedHost(JJTTRAPINTERESTEDHOST); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) TrapInterestedHost */ try { /*@egen*/ "hosts" "=" HostTrap() ("," HostTrap())*/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void HostTrap() : {/*@bgen(jjtree) HostTrap */ JDMHostTrap jjtn000 = new JDMHostTrap(JJTHOSTTRAP); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) HostTrap */ try { /*@egen*/ HostName() | IpAddress() | IpV6Address()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void Enterprise(): {/*@bgen(jjtree) Enterprise */ JDMEnterprise jjtn000 = new JDMEnterprise(JJTENTERPRISE); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) Enterprise */ try { /*@egen*/ "{" "enterprise" "=" t= {jjtn000.enterprise= t.image;} "trap-num" "=" TrapNum() ("," TrapNum())* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void TrapNum(): {/*@bgen(jjtree) TrapNum */ JDMTrapNum jjtn000 = new JDMTrapNum(JJTTRAPNUM); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) TrapNum */ try { /*@egen*/ t= {jjtn000.low= Integer.parseInt(t.image);} [ "-" t= {jjtn000.high= Integer.parseInt(t.image);} ]/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void InformBlock(): {/*@bgen(jjtree) InformBlock */ JDMInformBlock jjtn000 = new JDMInformBlock(JJTINFORMBLOCK); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) InformBlock */ try { /*@egen*/ "inform" "=" "{" (InformItem())* "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void InformItem(): {/*@bgen(jjtree) InformItem */ JDMInformItem jjtn000 = new JDMInformItem(JJTINFORMITEM); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) InformItem */ try { /*@egen*/ "{" jjtn000.comm= InformCommunity() InformInterestedHost() "}"/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } JDMInformCommunity InformCommunity(): {/*@bgen(jjtree) InformCommunity */ JDMInformCommunity jjtn000 = new JDMInformCommunity(JJTINFORMCOMMUNITY); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) InformCommunity */ try { /*@egen*/ "inform-community" "=" t=/*@bgen(jjtree)*/ { jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; } /*@egen*/ { jjtn000.community= t.image; return jjtn000; }/*@bgen(jjtree)*/ } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void InformInterestedHost(): {/*@bgen(jjtree) InformInterestedHost */ JDMInformInterestedHost jjtn000 = new JDMInformInterestedHost(JJTINFORMINTERESTEDHOST); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ } {/*@bgen(jjtree) InformInterestedHost */ try { /*@egen*/ "hosts" "=" HostInform() ("," HostInform())*/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ } void HostInform() : {/*@bgen(jjtree) HostInform */ JDMHostInform jjtn000 = new JDMHostInform(JJTHOSTINFORM); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); /*@egen*/ Token t; } {/*@bgen(jjtree) HostInform */ try { /*@egen*/ HostName() | IpAddress() | IpV6Address()/*@bgen(jjtree)*/ } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { throw (RuntimeException)jjte000; } if (jjte000 instanceof ParseException) { throw (ParseException)jjte000; } throw (Error)jjte000; } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } /*@egen*/ }