948 lines · 20.3 KB · Text
RawDownload
/*@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 : {  <ACCESS: "access">| <ACL: "acl">| <ASSIGN: "=">| <COMMUNITIES: "communities">| <ENTERPRISE: "enterprise">| <HOSTS: "hosts">| <LBRACE: "{">| <MANAGERS: "managers">| <RANGE: "-">| <RBRACE: "}">| <RO: "read-only">| <RW: "read-write">| <TRAP: "trap">| <INFORM: "inform">| <TRAPCOMMUNITY: "trap-community">| <INFORMCOMMUNITY: "inform-community">| <TRAPNUM: "trap-num">}   TOKEN : /* LITERALS */{  < INTEGER_LITERAL:        <DECIMAL_LITERAL> (["l","L"])?      | <HEX_LITERAL> (["l","L"])?      | <OCTAL_LITERAL> (["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> ":")+ (":")?) | "::" ) (<H> ":")* (<H> | (<D> "." <D> "." <D> "." <D>))) | ("::")) | ( (<H> ":")+ ":") >|  <#H: (["0"-"9","a"-"f","A"-"F"])+ >|   <#D: (["0"-"9"])+ >} TOKEN : /* IDENTIFIERS */{  < IDENTIFIER: ( (<DIGIT>|<LETTER>)+ (<SEPARATOR>|<LETTER>|<DIGIT>)* (<DIGIT>|<LETTER>)+ ) | (<DIGIT>|<LETTER>)+ >|  < #LETTER: ["a"-"z","A"-"Z"] >|  < #SEPARATOR: ["-", "_"] >|  < #DIGIT: ["0"-"9"] >| <CSTRING: "\"" (~["\""])* "\"">}   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()]  <EOF>/*@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=<IDENTIFIER>/*@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" "=" ( <RO> {jjtn000.access= RO;}              |               <RW> {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(<INTEGER_LITERAL> ( "." <INTEGER_LITERAL> )* "/" <INTEGER_LITERAL>)NetMask()|LOOKAHEAD(<V6_ADDRESS> "/" <INTEGER_LITERAL>)NetMaskV6()|LOOKAHEAD(<INTEGER_LITERAL> ".")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=<IDENTIFIER> { jjtn000.name.append(t.image); }("." t=<IDENTIFIER>   {jjtn000.name.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= <INTEGER_LITERAL>   {jjtn000.address.append(t.image); }("." t= <INTEGER_LITERAL>   {jjtn000.address.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= <V6_ADDRESS>/*@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= <INTEGER_LITERAL> 

Lines 1–500 of 948.