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

📄 configurationparser.java

📁 j2me 混淆包,用于混淆j2me的原代码用的
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
        // Didn't the user specify a file name?        if (configurationEnd())        {            return "";        }        String fileName = nextWord;        readNextWord();        return fileName;    }    private boolean parseNoArgument(boolean value)    throws IOException    {        readNextWord();        return value;    }    private List parseClassSpecificationArguments(List    classSpecifications,                                                  boolean markClassFiles,                                                  boolean markConditionally)    throws ParseException, IOException    {        // Create a new List if necessary.        if (classSpecifications == null)        {            classSpecifications = new ArrayList();        }        // Read and add the keep configuration.        classSpecifications.add(parseClassSpecificationArguments(markClassFiles,                                                                 markConditionally));        return classSpecifications;    }    private ClassSpecification parseClassSpecificationArguments(boolean markClassFiles,                                                                boolean markConditionally)    throws ParseException, IOException    {        // Remember the comments preceeding this option.        String comments = lastComments;        // Parse the class access modifiers, if any.        int requiredSetClassAccessFlags   = 0;        int requiredUnsetClassAccessFlags = 0;        while (true)        {            readNextWord("keyword '" + ConfigurationConstants.CLASS_KEYWORD + "'" +                         " or '" + ClassConstants.EXTERNAL_ACC_INTERFACE + "'");            if (ConfigurationConstants.CLASS_KEYWORD.equals(nextWord))            {                // The class keyword. Stop parsing the class access modifiers.                break;            }            // Strip the negating sign, if any.            String strippedWord = nextWord.startsWith(ConfigurationConstants.NEGATOR_KEYWORD) ?                nextWord.substring(1) :                nextWord;            int accessFlag =                strippedWord.equals(ClassConstants.EXTERNAL_ACC_PUBLIC)    ? ClassConstants.INTERNAL_ACC_PUBLIC    :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_FINAL)     ? ClassConstants.INTERNAL_ACC_FINAL     :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_INTERFACE) ? ClassConstants.INTERNAL_ACC_INTERFACE :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_ABSTRACT)  ? ClassConstants.INTERNAL_ACC_ABSTRACT  :                                                                             unknownAccessFlag();            if (strippedWord == nextWord)            {                requiredSetClassAccessFlags   |= accessFlag;            }            else            {                requiredUnsetClassAccessFlags |= accessFlag;            }            if ((requiredSetClassAccessFlags &                 requiredUnsetClassAccessFlags) != 0)            {                throw new ParseException("Conflicting class access modifiers for '" + strippedWord +                                         "' before " + reader.locationDescription());            }            if (ClassConstants.EXTERNAL_ACC_INTERFACE.equals(strippedWord))            {                // The interface keyword. Stop parsing the class flags.                break;            }        }        readNextWord("class name or interface name");        checkJavaIdentifier("class name or interface name");        // Parse the class name part. For backward compatibility, allow a        // single "*" wildcard to match any class.        String externalClassName = nextWord;        String className = ConfigurationConstants.ANY_CLASS_KEYWORD.equals(externalClassName) ?            null :            ClassUtil.internalClassName(externalClassName);        readNextWord();        String extendsClassName = null;        if (!configurationEnd())        {            // Parse 'implements ...' or 'extends ...' part, if any.            if (ConfigurationConstants.IMPLEMENTS_KEYWORD.equals(nextWord) ||                ConfigurationConstants.EXTENDS_KEYWORD.equals(nextWord))            {                readNextWord("class name or interface name");                checkJavaIdentifier("class name or interface name");                extendsClassName = ClassUtil.internalClassName(nextWord);                readNextWord();            }        }        // Create the basic class specification.        ClassSpecification classSpecification =            new ClassSpecification(requiredSetClassAccessFlags,                                   requiredUnsetClassAccessFlags,                                   className,                                   extendsClassName,                                   markClassFiles,                                   markConditionally,                                   comments);        // Now modify this ClassSpecification, adding any class members.        if (!configurationEnd())        {            // Check the class member opening part.            if (!ConfigurationConstants.OPEN_KEYWORD.equals(nextWord))            {                throw new ParseException("Expecting opening '" + ConfigurationConstants.OPEN_KEYWORD +                                         "' at " + reader.locationDescription());            }            // Parse all class members.            while (parseClassMemberSpecificationArguments(externalClassName,                                                          classSpecification));        }        return classSpecification;    }    private boolean parseClassMemberSpecificationArguments(String             externalClassName,                                                           ClassSpecification classSpecification) throws ParseException, IOException    {        // Parse the class member access modifiers, if any.        int requiredSetMemberAccessFlags   = 0;        int requiredUnsetMemberAccessFlags = 0;        while (true)        {            readNextWord("class member description" +                         " or closing '" + ConfigurationConstants.CLOSE_KEYWORD + "'");            if (requiredSetMemberAccessFlags   == 0 &&                requiredUnsetMemberAccessFlags == 0 &&                ConfigurationConstants.CLOSE_KEYWORD.equals(nextWord))            {                // The closing brace. Stop parsing the class members.                readNextWord();                return false;            }            String strippedWord = nextWord.startsWith("!") ?                nextWord.substring(1) :                nextWord;            int accessFlag =                strippedWord.equals(ClassConstants.EXTERNAL_ACC_PUBLIC)       ? ClassConstants.INTERNAL_ACC_PUBLIC       :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_PRIVATE)      ? ClassConstants.INTERNAL_ACC_PRIVATE      :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_PROTECTED)    ? ClassConstants.INTERNAL_ACC_PROTECTED    :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_STATIC)       ? ClassConstants.INTERNAL_ACC_STATIC       :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_FINAL)        ? ClassConstants.INTERNAL_ACC_FINAL        :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_SYNCHRONIZED) ? ClassConstants.INTERNAL_ACC_SYNCHRONIZED :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_VOLATILE)     ? ClassConstants.INTERNAL_ACC_VOLATILE     :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_TRANSIENT)    ? ClassConstants.INTERNAL_ACC_TRANSIENT    :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_NATIVE)       ? ClassConstants.INTERNAL_ACC_NATIVE       :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_ABSTRACT)     ? ClassConstants.INTERNAL_ACC_ABSTRACT     :                strippedWord.equals(ClassConstants.EXTERNAL_ACC_STRICT)       ? ClassConstants.INTERNAL_ACC_STRICT       :                                                                                0;            if (accessFlag == 0)            {                // Not a class member access modifier. Stop parsing them.                break;            }            if (strippedWord == nextWord)            {                requiredSetMemberAccessFlags   |= accessFlag;            }            else            {                requiredUnsetMemberAccessFlags |= accessFlag;            }            // Make sure the user doesn't try to set and unset the same            // access flags simultaneously.            if ((requiredSetMemberAccessFlags &                 requiredUnsetMemberAccessFlags) != 0)            {                throw new ParseException("Conflicting class member access modifiers for " +                                         reader.locationDescription());            }        }        // Parse the class member type and name part.        // Did we get a special wildcard?        if (ConfigurationConstants.ANY_CLASS_MEMBER_KEYWORD.equals(nextWord) ||            ConfigurationConstants.ANY_FIELD_KEYWORD       .equals(nextWord) ||            ConfigurationConstants.ANY_METHOD_KEYWORD      .equals(nextWord))        {            // Act according to the type of wildcard..            if (ConfigurationConstants.ANY_CLASS_MEMBER_KEYWORD.equals(nextWord))            {                checkFieldAccessFlags(requiredSetMemberAccessFlags,                                      requiredUnsetMemberAccessFlags);                checkMethodAccessFlags(requiredSetMemberAccessFlags,                                       requiredUnsetMemberAccessFlags);                classSpecification.addField(                    new ClassMemberSpecification(requiredSetMemberAccessFlags,                                                 requiredUnsetMemberAccessFlags,                                                 null,                                                 null));                classSpecification.addMethod(                    new ClassMemberSpecification(requiredSetMemberAccessFlags,                                                 requiredUnsetMemberAccessFlags,                                                 null,                                                 null));            }            else if (ConfigurationConstants.ANY_FIELD_KEYWORD.equals(nextWord))            {                checkFieldAccessFlags(requiredSetMemberAccessFlags,                                      requiredUnsetMemberAccessFlags);                classSpecification.addField(                    new ClassMemberSpecification(requiredSetMemberAccessFlags,                                                 requiredUnsetMemberAccessFlags,                                                 null,                                                 null));            }            else if (ConfigurationConstants.ANY_METHOD_KEYWORD.equals(nextWord))            {                checkMethodAccessFlags(requiredSetMemberAccessFlags,                                       requiredUnsetMemberAccessFlags);                classSpecification.addMethod(                    new ClassMemberSpecification(requiredSetMemberAccessFlags,                                                 requiredUnsetMemberAccessFlags,                                                 null,                                                 null));            }            // We still have to read the closing separator.            readNextWord("separator '" + ConfigurationConstants.SEPARATOR_KEYWORD + "'");            if (!ConfigurationConstants.SEPARATOR_KEYWORD.equals(nextWord))            {                throw new ParseException("Expecting separator '" + ConfigurationConstants.SEPARATOR_KEYWORD +                                         "' before " + reader.locationDescription());            }        }        else        {            // Make sure we have a proper type.            checkJavaIdentifier("class member type");            String type = nextWord;            readNextWord("class member name");            String name = nextWord;            // Did we get just one word before the opening parenthesis?            if (ConfigurationConstants.OPEN_ARGUMENTS_KEYWORD.equals(name))            {                // This must be a constructor then.                // Make sure the type is a proper constructor name.                if (!(type.equals(ClassConstants.INTERNAL_METHOD_NAME_INIT) ||                      type.equals(externalClassName) ||                      type.equals(ClassUtil.externalShortClassName(externalClassName))))                {                    throw new ParseException("Expecting type and name " +                                             "instead of just '" + type +                                             "' before " + reader.locationDescription());                }                // Assign the fixed constructor type and name.                type = ClassConstants.EXTERNAL_TYPE_VOID;                name = ClassConstants.INTERNAL_METHOD_NAME_INIT;            }            else

⌨️ 快捷键说明

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