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

📄 asnparser.java

📁 ASN.1工具源代码,包括编译源码生成工具和各种基本类型构造类型的编解码实现代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/* Generated By:JJTree&JavaCC: Do not edit this line. AsnParser.java *///Title:       //Version:     $Id: AsnParser.java,v 1.1.1.1 2000/12/21 06:33:06 ianibbo Exp $//Copyright:   Copyright (C) 1999,2000 Knowledge Integration Ltd (See the file LICENSE for details.)//Author:      Ian Ibbotson//Company:     Knowledge Integration Ltd//Description: //package com.k_int.codec.comp;import java.util.*;import java.io.File;import java.io.FileInputStream;public class AsnParser/*@bgen(jjtree)*/implements AsnParserTreeConstants, AsnParserConstants {/*@bgen(jjtree)*/  protected JJTAsnParserState jjtree = new JJTAsnParserState();// public static void main(String args[]) throws ParseException {  //   System.err.println("Args :"+args);  //   for ( int i=0; i<args.length; i++ )  //   {  //     System.err.println("Processing asn source file : "+args[i]);  //     File next_asn_file = new File(args[i]);  //     if ( next_asn_file.exists() )         //     {        // parser = new AsnParser(System.in);  //       try   //       {  //         AsnParser parser = new AsnParser(new FileInputStream(next_asn_file));  //         parser.Input();	  //         System.out.println("ASN.1 file parsed successfully... Calling pass1");  //         parser.jjtree.rootNode().pass1();  //         System.out.println("Calling outputJava");          // parser.jjtree.rootNode().outputJava();  //         CodecBuilderInfo.getInfo().create();  //         System.out.println("Done outputting java");  //       }  //       catch(ParseException e)  //       {  //         System.out.println(e.toString());  //         e.printStackTrace();  //       }  //       catch(java.io.FileNotFoundException fnfe)  //       {  //         System.out.println(fnfe.toString());  //         fnfe.printStackTrace();  //       }  //     }  //   }  // }  public static String usefulTypes[] = {        "GraphicString",  "NumericString", "PrintableString",        "TeletexString", "T61String", "VideotexString", "IA5String",        "VisibleString", "ISO646String", "GeneralizedTime", "UniversalString", "BMPString", "EXTERNAL" };  public static String builtinTypes[] = {        "Integer", "BitString", "SetOrSequenceType", "SetOrSequenceOfType",        "ChoiceType", "SelectionType", "TaggedType", "Any", "Enumerated",        "OctetString", "OID", "REAL", "BOOL", "NULL" };  final public void Input() throws ParseException {                /*@bgen(jjtree) Input */  ASTInput jjtn000 = new ASTInput(this, JJTINPUT);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      label_1:      while (true) {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case UCASEFIRST_IDENT_TKN:          ;          break;        default:          jj_la1[0] = jj_gen;          break label_1;        }        ModuleDefinition();      }    } 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 (Error)jjte000;}    } finally {   if (jjtc000) {     jjtree.closeNodeScope(jjtn000, true);   }    }  }  final public void ModuleDefinition() throws ParseException {                           /*@bgen(jjtree) ModuleDefinition */                            ASTModuleDefinition jjtn000 = new ASTModuleDefinition(this, JJTMODULEDEFINITION);                            boolean jjtc000 = true;                            jjtree.openNodeScope(jjtn000);Token t;    try {      ModuleIdentifier();      jj_consume_token(DEFINITIONS_TKN);      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case IMPLICIT_TKN:      case EXPLICIT_TKN:        TagDefault();        break;      default:        jj_la1[1] = jj_gen;        ;      }      jj_consume_token(GETS_TKN);      jj_consume_token(BEGIN_TKN);      ModuleBody();      jj_consume_token(END_TKN);    } 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 (Error)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void TagDefault() throws ParseException {                     /*@bgen(jjtree) TagDefault */  ASTTagDefault jjtn000 = new ASTTagDefault(this, JJTTAGDEFAULT);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case EXPLICIT_TKN:        jj_consume_token(EXPLICIT_TKN);                     jjtn000.which = 1;        break;      case IMPLICIT_TKN:        jj_consume_token(IMPLICIT_TKN);                                                              jjtn000.which = 2;        break;      default:        jj_la1[2] = jj_gen;        jj_consume_token(-1);        throw new ParseException();      }      jj_consume_token(TAGS_TKN);    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void ModuleIdentifier() throws ParseException {                           /*@bgen(jjtree) ModuleIdentifier */  ASTModuleIdentifier jjtn000 = new ASTModuleIdentifier(this, JJTMODULEIDENTIFIER);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      modulereference();      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case LEFTBRACE_TKN:        AssignedIdentifier();        break;      default:        jj_la1[3] = jj_gen;        ;      }    } 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 (Error)jjte000;}    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void AssignedIdentifier() throws ParseException {                             /*@bgen(jjtree) AssignedIdentifier */  ASTAssignedIdentifier jjtn000 = new ASTAssignedIdentifier(this, JJTASSIGNEDIDENTIFIER);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      ObjectIdentifierValue();    } 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 (Error)jjte000;}    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void ModuleBody() throws ParseException {                     /*@bgen(jjtree) ModuleBody */  ASTModuleBody jjtn000 = new ASTModuleBody(this, JJTMODULEBODY);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case EXPORTS_TKN:        Exports();        break;      default:        jj_la1[4] = jj_gen;        ;      }      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case IMPORTS_TKN:        Imports();        break;      default:        jj_la1[5] = jj_gen;        ;      }      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case OBJECTTYPE_TKN:      case TC_TKN:      case LCASEFIRST_IDENT_TKN:      case UCASEFIRST_IDENT_TKN:        AssignmentList();        break;      default:        jj_la1[6] = jj_gen;        ;      }    } 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 (Error)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void Exports() throws ParseException {                  /*@bgen(jjtree) Exports */  ASTExports jjtn000 = new ASTExports(this, JJTEXPORTS);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      jj_consume_token(EXPORTS_TKN);      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case OBJECTTYPE_TKN:      case TC_TKN:      case LCASEFIRST_IDENT_TKN:      case UCASEFIRST_IDENT_TKN:        SymbolsExported();        break;      default:        jj_la1[7] = jj_gen;        ;      }      jj_consume_token(SEMI_COLON_TKN);    } 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 (Error)jjte000;}    } finally {    if (jjtc000) {      jjtree.closeNodeScope(jjtn000, true);    }    }  }  final public void SymbolsExported() throws ParseException {                          /*@bgen(jjtree) SymbolsExported */  ASTSymbolsExported jjtn000 = new ASTSymbolsExported(this, JJTSYMBOLSEXPORTED);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      ExportSymbolList();    } 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 (Error)jjte000;}    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void ExportSymbolList() throws ParseException {                           /*@bgen(jjtree) ExportSymbolList */  ASTExportSymbolList jjtn000 = new ASTExportSymbolList(this, JJTEXPORTSYMBOLLIST);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      Symbol();      label_2:      while (true) {        switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {        case COMMA_TKN:          ;          break;        default:          jj_la1[8] = jj_gen;          break label_2;        }        jj_consume_token(COMMA_TKN);        Symbol();      }    } 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 (Error)jjte000;}    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void Imports() throws ParseException {                  /*@bgen(jjtree) Imports */  ASTImports jjtn000 = new ASTImports(this, JJTIMPORTS);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      jj_consume_token(IMPORTS_TKN);      switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {      case OBJECTTYPE_TKN:      case TC_TKN:      case LCASEFIRST_IDENT_TKN:      case UCASEFIRST_IDENT_TKN:        SymbolsImported();        break;      default:        jj_la1[9] = jj_gen;        ;      }      jj_consume_token(SEMI_COLON_TKN);    } 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 (Error)jjte000;}    } finally {     if (jjtc000) {       jjtree.closeNodeScope(jjtn000, true);     }    }  }  final public void SymbolsImported() throws ParseException {                          /*@bgen(jjtree) SymbolsImported */  ASTSymbolsImported jjtn000 = new ASTSymbolsImported(this, JJTSYMBOLSIMPORTED);  boolean jjtc000 = true;  jjtree.openNodeScope(jjtn000);    try {      SymbolsFromModuleList();    } 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;}     }

⌨️ 快捷键说明

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