⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 javaparser.java

📁 检查Java程序漏洞
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* Generated By:JJTree&JavaCC: Do not edit this line. JavaParser.java */package net.sourceforge.pmd.ast;public class JavaParser/*@bgen(jjtree)*/implements JavaParserTreeConstants, JavaParserConstants {/*@bgen(jjtree)*/  protected JJTJavaParserState jjtree = new JJTJavaParserState();  private boolean usingAssertAsIdentifier;  private boolean isJDK15;  public void setAssertAsIdentifier() {   this.usingAssertAsIdentifier = true;  }  public void setJDK15() {   this.isJDK15 = true;  }  private void checkForBadAssertUsage(String in, String usage) {    if (!usingAssertAsIdentifier && in.equals("assert")) {      throw new ParseException("Can't use 'assert' as " + usage + " when running in JDK 1.4 mode!");    }  }  private void checkForBadEnumUsage(String in, String usage) {    if (isJDK15 && in.equals("enum")) {      throw new ParseException("Can't use 'enum' as " + usage + " when running in JDK 1.5 mode!");    }  }  // This is a semantic LOOKAHEAD to determine if we're dealing with an assert  // Note that this can't be replaced with a syntactic lookahead  // since "assert" isn't a string literal token  private boolean isNextTokenAnAssert() {    return getToken(1).image.equals("assert");  }  private boolean enumLookahead() {    int x = 1;    Token tok = null;    while (true) {      tok = getToken(x);      if (tok.image.equals("static") ||          tok.image.equals("final") ||          tok.image.equals("public") ||          tok.image.equals("protected") ||          tok.image.equals("private") ) {        x++;      } else {        break;      }    }    return tok.image.equals("enum");  }/***************************************** * THE JAVA LANGUAGE GRAMMAR STARTS HERE * *****************************************//* * Program structuring syntax follows. */  final public ASTCompilationUnit CompilationUnit() throws ParseException { /*@bgen(jjtree) CompilationUnit */  ASTCompilationUnit jjtn000 = new ASTCompilationUnit(this, JJTCOMPILATIONUNIT);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case PACKAGE:        PackageDeclaration();        break;      default:        jj_la1[0] = jj_gen;        ;      }      label_1:      while (true) {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case IMPORT:          ;          break;        default:          jj_la1[1] = jj_gen;          break label_1;        }        ImportDeclaration();      }      label_2:      while (true) {        if (jj_2_1(1)) {          ;        } else {          break label_2;        }        TypeDeclaration();      }      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case 120:        jj_consume_token(120);        break;      default:        jj_la1[2] = jj_gen;        ;      }      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case 121:        jj_consume_token(121);        break;      default:        jj_la1[3] = jj_gen;        ;      }      jj_consume_token(0);          jjtree.closeNodeScope(jjtn000, true);          jjtc000 = false;                  {if (true) return jjtn000;}    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }    throw new RuntimeException("Missing return statement in function");  }  final public void PackageDeclaration() throws ParseException { /*@bgen(jjtree) PackageDeclaration */  ASTPackageDeclaration jjtn000 = new ASTPackageDeclaration(this, JJTPACKAGEDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      jj_consume_token(PACKAGE);      Name();      jj_consume_token(SEMICOLON);    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void ImportDeclaration() throws ParseException { /*@bgen(jjtree) ImportDeclaration */  ASTImportDeclaration jjtn000 = new ASTImportDeclaration(this, JJTIMPORTDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      jj_consume_token(IMPORT);      Name();      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case DOT:        jj_consume_token(DOT);        jj_consume_token(STAR);                             jjtn000.setImportOnDemand();        break;      default:        jj_la1[4] = jj_gen;        ;      }      jj_consume_token(SEMICOLON);    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void TypeDeclaration() throws ParseException { /*@bgen(jjtree) TypeDeclaration */  ASTTypeDeclaration jjtn000 = new ASTTypeDeclaration(this, JJTTYPEDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      if (jj_2_2(2147483647)) {        ClassDeclaration();      } else if (enumLookahead()) {        EnumDeclaration();      } else {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case ABSTRACT:        case INTERFACE:        case PUBLIC:        case STRICTFP:          InterfaceDeclaration();          break;        case SEMICOLON:          jj_consume_token(SEMICOLON);          break;        default:          jj_la1[5] = jj_gen;          jj_consume_token(-1);          throw new ParseException();        }      }    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }/* * Declaration syntax follows. */  final public void ClassDeclaration() throws ParseException { /*@bgen(jjtree) ClassDeclaration */  ASTClassDeclaration jjtn000 = new ASTClassDeclaration(this, JJTCLASSDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      label_3:      while (true) {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case ABSTRACT:        case FINAL:        case PUBLIC:        case STRICTFP:          ;          break;        default:          jj_la1[6] = jj_gen;          break label_3;        }        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case ABSTRACT:          jj_consume_token(ABSTRACT);                  jjtn000.setAbstract();          break;        case FINAL:          jj_consume_token(FINAL);                  jjtn000.setFinal();          break;        case PUBLIC:          jj_consume_token(PUBLIC);                  jjtn000.setPublic();          break;        case STRICTFP:          jj_consume_token(STRICTFP);                  jjtn000.setStrict();          break;        default:          jj_la1[7] = jj_gen;          jj_consume_token(-1);          throw new ParseException();        }      }      UnmodifiedClassDeclaration();    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void UnmodifiedClassDeclaration() throws ParseException { /*@bgen(jjtree) UnmodifiedClassDeclaration */  ASTUnmodifiedClassDeclaration jjtn000 = new ASTUnmodifiedClassDeclaration(this, JJTUNMODIFIEDCLASSDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);Token t = null;    try {      jj_consume_token(CLASS);      t = jj_consume_token(IDENTIFIER);    jjtn000.setImage( t.image );      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case EXTENDS:        jj_consume_token(EXTENDS);                jjtn000.setHasExplicitExtends();        Name();        break;      default:        jj_la1[8] = jj_gen;        ;      }      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case IMPLEMENTS:        jj_consume_token(IMPLEMENTS);                   jjtn000.setHasExplicitImplements();        NameList();        break;      default:        jj_la1[9] = jj_gen;        ;      }      ClassBody();    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void ClassBody() throws ParseException { /*@bgen(jjtree) ClassBody */  ASTClassBody jjtn000 = new ASTClassBody(this, JJTCLASSBODY);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      jj_consume_token(LBRACE);      label_4:      while (true) {        if (jj_2_3(1)) {          ;        } else {          break label_4;        }        ClassBodyDeclaration();      }      jj_consume_token(RBRACE);    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void NestedClassDeclaration() throws ParseException { /*@bgen(jjtree) NestedClassDeclaration */  ASTNestedClassDeclaration jjtn000 = new ASTNestedClassDeclaration(this, JJTNESTEDCLASSDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      label_5:      while (true) {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case ABSTRACT:        case FINAL:        case PRIVATE:        case PROTECTED:        case PUBLIC:        case STATIC:        case STRICTFP:          ;          break;        default:          jj_la1[10] = jj_gen;          break label_5;        }        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case STATIC:          jj_consume_token(STATIC);                     jjtn000.setStatic();          break;        case ABSTRACT:          jj_consume_token(ABSTRACT);                    jjtn000.setAbstract();          break;        case FINAL:          jj_consume_token(FINAL);                    jjtn000.setFinal();          break;        case PUBLIC:          jj_consume_token(PUBLIC);                    jjtn000.setPublic();          break;        case PROTECTED:          jj_consume_token(PROTECTED);                    jjtn000.setProtected();          break;        case PRIVATE:          jj_consume_token(PRIVATE);                    jjtn000.setPrivate();          break;        case STRICTFP:          jj_consume_token(STRICTFP);                    jjtn000.setStrict();          break;        default:          jj_la1[11] = jj_gen;          jj_consume_token(-1);          throw new ParseException();        }      }      UnmodifiedClassDeclaration();    } catch (Throwable jjte000) {    if (jjtc000) {      jjtree.clearNodeScope(jjtn000);      jjtc000 = false;    } else {      jjtree.popNode();    }    if (jjte000 instanceof RuntimeException) {      {if (true) throw (RuntimeException)jjte000;}    }    if (jjte000 instanceof ParseException) {      {if (true) throw (ParseException)jjte000;}    }    {if (true) throw (RuntimeException)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void ClassBodyDeclaration() throws ParseException { /*@bgen(jjtree) ClassBodyDeclaration */  ASTClassBodyDeclaration jjtn000 = new ASTClassBodyDeclaration(this, JJTCLASSBODYDECLARATION);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -