mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-05 17:45:52 +01:00
updating JesusFreke's smali/baksmali. Fixed SmaliMod to handle removal of smaliLexer.
This commit is contained in:
parent
008e1004c2
commit
689e0e59a6
@ -262,7 +262,7 @@ public class ClassDefinition {
|
||||
classDefItem.getClassType().getTypeDescriptor(), field.field.getShortFieldString()));
|
||||
}
|
||||
|
||||
FieldDefinition.writeTo(fieldWriter, field, null, fieldAnnotations, false);
|
||||
FieldDefinition.writeTo(fieldWriter, field, null, fieldAnnotations, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,11 @@ public class InstructionMethodItemFactory {
|
||||
private InstructionMethodItemFactory() {
|
||||
}
|
||||
|
||||
public static InstructionMethodItem makeInstructionFormatMethodItem(MethodDefinition methodDefinition,
|
||||
CodeItem codeItem,
|
||||
int codeAddress,
|
||||
Instruction instruction) {
|
||||
public static InstructionMethodItem makeInstructionFormatMethodItem(
|
||||
MethodDefinition methodDefinition, CodeItem codeItem, int codeAddress, Instruction instruction) {
|
||||
if (instruction instanceof OffsetInstruction) {
|
||||
return new OffsetInstructionFormatMethodItem(methodDefinition.getLabelCache(), codeItem, codeAddress,
|
||||
instruction);
|
||||
return new OffsetInstructionFormatMethodItem(methodDefinition.getLabelCache(), codeItem,
|
||||
codeAddress, (OffsetInstruction)instruction);
|
||||
}
|
||||
|
||||
switch (instruction.getFormat()) {
|
||||
@ -61,7 +59,7 @@ public class InstructionMethodItemFactory {
|
||||
return new UnresolvedOdexInstructionMethodItem(codeItem, codeAddress,
|
||||
(UnresolvedOdexInstruction)instruction);
|
||||
default:
|
||||
return new InstructionMethodItem(codeItem, codeAddress, instruction);
|
||||
return new InstructionMethodItem<Instruction>(codeItem, codeAddress, instruction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,19 +31,17 @@ package org.jf.baksmali.Adaptors.Format;
|
||||
import org.jf.baksmali.Adaptors.LabelMethodItem;
|
||||
import org.jf.baksmali.Adaptors.MethodDefinition;
|
||||
import org.jf.util.IndentingWriter;
|
||||
import org.jf.dexlib.Code.Instruction;
|
||||
import org.jf.dexlib.Code.OffsetInstruction;
|
||||
import org.jf.dexlib.Code.Opcode;
|
||||
import org.jf.dexlib.CodeItem;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class OffsetInstructionFormatMethodItem<T extends Instruction & OffsetInstruction>
|
||||
extends InstructionMethodItem<T> {
|
||||
public class OffsetInstructionFormatMethodItem extends InstructionMethodItem<OffsetInstruction> {
|
||||
protected LabelMethodItem label;
|
||||
|
||||
public OffsetInstructionFormatMethodItem(MethodDefinition.LabelCache labelCache, CodeItem codeItem, int codeAddress,
|
||||
T instruction) {
|
||||
OffsetInstruction instruction) {
|
||||
super(codeItem, codeAddress, instruction);
|
||||
|
||||
label = new LabelMethodItem(codeAddress + instruction.getTargetAddressOffset(), getLabelPrefix());
|
||||
|
@ -48,16 +48,6 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
|
||||
@Nullable
|
||||
private ParameterAnnotation[] parameterAnnotations;
|
||||
|
||||
/**
|
||||
* typically each AnnotationDirectoryItem will have a distinct parent. The only case that isn't true is when
|
||||
* the AnnotationDirectoryItem *only* contains class annotations, with no other type of annotation. In that
|
||||
* case, the same AnnotationDirectoryItem could be referenced from multiple classes.
|
||||
* This isn't a problem though, because this field is only used in compareTo to determine the sort order, which
|
||||
* which knows it should handle a null value as a special case
|
||||
*/
|
||||
@Nullable
|
||||
private ClassDefItem parent = null;
|
||||
|
||||
/**
|
||||
* Creates a new uninitialized <code>AnnotationDirectoryItem</code>
|
||||
* @param dexFile The <code>DexFile</code> that this item belongs to
|
||||
@ -211,8 +201,9 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
|
||||
/** {@inheritDoc} */
|
||||
protected void writeItem(AnnotatedOutput out) {
|
||||
if (out.annotates()) {
|
||||
if (!isInternable() && parent != null) {
|
||||
out.annotate(0, parent.getClassType().getTypeDescriptor());
|
||||
TypeIdItem parentType = getParentType();
|
||||
if (parentType != null) {
|
||||
out.annotate(0, parentType.getTypeDescriptor());
|
||||
}
|
||||
if (classAnnotations != null) {
|
||||
out.annotate(4, "class_annotations_off: 0x" + Integer.toHexString(classAnnotations.getOffset()));
|
||||
@ -303,29 +294,60 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String getConciseIdentity() {
|
||||
if (parent == null) {
|
||||
TypeIdItem parentType = getParentType();
|
||||
if (parentType == null) {
|
||||
return "annotation_directory_item @0x" + Integer.toHexString(getOffset());
|
||||
}
|
||||
return "annotation_directory_item @0x" + Integer.toHexString(getOffset()) + " (" + parent.getClassType() + ")";
|
||||
return "annotation_directory_item @0x" + Integer.toHexString(getOffset()) +
|
||||
" (" + parentType.getTypeDescriptor() + ")";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int compareTo(AnnotationDirectoryItem o) {
|
||||
Preconditions.checkNotNull(o);
|
||||
if (!isInternable()) {
|
||||
if (!o.isInternable()) {
|
||||
Preconditions.checkState(parent != null && o.parent != null,
|
||||
"Must call setParent before comparing AnnotationDirectoryItem instances");
|
||||
return parent.compareTo(o.parent);
|
||||
|
||||
TypeIdItem parentType = getParentType();
|
||||
TypeIdItem otherParentType = o.getParentType();
|
||||
if (parentType != null) {
|
||||
if (otherParentType != null) {
|
||||
return parentType.compareTo(otherParentType);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
if (otherParentType != null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!o.isInternable()) {
|
||||
if (classAnnotations != null) {
|
||||
if (o.classAnnotations != null) {
|
||||
return classAnnotations.compareTo(o.classAnnotations);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
return classAnnotations.compareTo(o.classAnnotations);
|
||||
/**
|
||||
* Returns the parent type for an AnnotationDirectoryItem that is guaranteed to have a single parent, or null
|
||||
* for one that may be referenced by multiple classes.
|
||||
*
|
||||
* Specifically, the AnnotationDirectoryItem may be referenced by multiple classes if it has only class annotations,
|
||||
* but not field/method/parameter annotations.
|
||||
*
|
||||
* @return The parent type for this AnnotationDirectoryItem, or null if it may have multiple parents
|
||||
*/
|
||||
@Nullable
|
||||
public TypeIdItem getParentType() {
|
||||
if (fieldAnnotations != null && fieldAnnotations.length > 0) {
|
||||
return fieldAnnotations[0].field.getContainingClass();
|
||||
}
|
||||
if (methodAnnotations != null && methodAnnotations.length > 0) {
|
||||
return methodAnnotations[0].method.getContainingClass();
|
||||
}
|
||||
if (parameterAnnotations != null && parameterAnnotations.length > 0) {
|
||||
return parameterAnnotations[0].method.getContainingClass();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -425,6 +447,17 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
|
||||
return parameterAnnotations[index].annotationSet;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public int getClassAnnotationCount() {
|
||||
if (classAnnotations == null) {
|
||||
return 0;
|
||||
}
|
||||
AnnotationItem[] annotations = classAnnotations.getAnnotations();
|
||||
return annotations.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The number of field annotations in this <code>AnnotationDirectoryItem</code>
|
||||
*/
|
||||
@ -455,40 +488,17 @@ public class AnnotationDirectoryItem extends Item<AnnotationDirectoryItem> {
|
||||
return parameterAnnotations.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this <code>AnnotationDirectoryItem</code> is internable. It is only internable if it has
|
||||
* only class annotations, but no field, method or parameter annotations
|
||||
*/
|
||||
private boolean isInternable() {
|
||||
return classAnnotations != null &&
|
||||
(fieldAnnotations == null || fieldAnnotations.length == 0) &&
|
||||
(methodAnnotations == null || methodAnnotations.length == 0) &&
|
||||
(parameterAnnotations == null || parameterAnnotations.length == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>ClassDefItem</code> that this <code>AnnotationDirectoryItem</code> is associated with.
|
||||
*
|
||||
* @param classDefItem the <code>ClassDefItem</code> that this <code>AnnotationDirectoryItem</code> is associated
|
||||
* with.
|
||||
*/
|
||||
protected void setParent(ClassDefItem classDefItem) {
|
||||
// If this AnnotationDirectoryItem is internable, then setParent may be called multiple times, because it is
|
||||
// reused for multiple classes. In this case, the parent field isn't used, so it doesn't matter if we overwrite
|
||||
// it.
|
||||
// If, on the other hand, it is not internable, we want to make sure that only a single parent is set. parent
|
||||
// should either be null, or be equal to the new parent
|
||||
Preconditions.checkState(this.isInternable() || (parent == null || parent.equals(classDefItem)));
|
||||
this.parent = classDefItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// An instance is internable only if it has only class annotations, but no other type of annotation
|
||||
if (!isInternable()) {
|
||||
return super.hashCode();
|
||||
// If the item has a single parent, we can use the re-use the identity (hash) of that parent
|
||||
TypeIdItem parentType = getParentType();
|
||||
if (parentType != null) {
|
||||
return parentType.hashCode();
|
||||
}
|
||||
return classAnnotations.hashCode();
|
||||
if (classAnnotations != null) {
|
||||
return classAnnotations.hashCode();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,9 +45,6 @@ public class ClassDataItem extends Item<ClassDataItem> {
|
||||
@Nullable
|
||||
private EncodedMethod[] virtualMethods = null;
|
||||
|
||||
@Nullable
|
||||
private ClassDefItem parent = null;
|
||||
|
||||
/**
|
||||
* Creates a new uninitialized <code>ClassDataItem</code>
|
||||
* @param dexFile The <code>DexFile</code> that this item belongs to
|
||||
@ -384,14 +381,17 @@ public class ClassDataItem extends Item<ClassDataItem> {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public String getConciseIdentity() {
|
||||
if (parent == null) {
|
||||
TypeIdItem parentType = getParentType();
|
||||
if (parentType == null) {
|
||||
return "class_data_item @0x" + Integer.toHexString(getOffset());
|
||||
}
|
||||
return "class_data_item @0x" + Integer.toHexString(getOffset()) + " (" + parent.getClassType() +")";
|
||||
return "class_data_item @0x" + Integer.toHexString(getOffset()) + " (" + parentType.getTypeDescriptor() +")";
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public int compareTo(ClassDataItem other) {
|
||||
Preconditions.checkNotNull(other);
|
||||
|
||||
// An empty CodeDataItem may be shared by multiple ClassDefItems, so we can't use parent in this case
|
||||
if (isEmpty()) {
|
||||
if (other.isEmpty()) {
|
||||
@ -403,25 +403,54 @@ public class ClassDataItem extends Item<ClassDataItem> {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (parent == null) {
|
||||
if (other.parent == null) {
|
||||
TypeIdItem parentType = getParentType();
|
||||
TypeIdItem otherParentType= other.getParentType();
|
||||
if (parentType == null) {
|
||||
if (otherParentType == null) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (other.parent == null) {
|
||||
if (otherParentType == null) {
|
||||
return 1;
|
||||
}
|
||||
return parent.compareTo(other.parent);
|
||||
return parentType.compareTo(otherParentType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// If the item has a single parent, we can use the re-use the identity (hash) of that parent
|
||||
TypeIdItem parentType = getParentType();
|
||||
if (parentType != null) {
|
||||
return parentType.hashCode();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the <code>ClassDefItem</code> that this <code>ClassDataItem</code> is associated with
|
||||
* @param classDefItem the <code>ClassDefItem</code> that this <code>ClassDataItem</code> is associated with
|
||||
* Returns the parent type for a non-empty ClassDataItem, or null for an empty one (which could be referenced by
|
||||
* multiple ClassDefItem parents)
|
||||
*
|
||||
* Specifically, the AnnotationDirectoryItem may be referenced by multiple classes if it has only class annotations,
|
||||
* but not field/method/parameter annotations.
|
||||
*
|
||||
* @return The parent type for this AnnotationDirectoryItem, or null if it may have multiple parents
|
||||
*/
|
||||
protected void setParent(ClassDefItem classDefItem) {
|
||||
Preconditions.checkState(parent == null || parent.compareTo(classDefItem) == 0 || isEmpty());
|
||||
parent = classDefItem;
|
||||
@Nullable
|
||||
public TypeIdItem getParentType() {
|
||||
if (staticFields != null && staticFields.length > 0) {
|
||||
return staticFields[0].field.getContainingClass();
|
||||
}
|
||||
if (instanceFields != null && instanceFields.length > 0) {
|
||||
return instanceFields[0].field.getContainingClass();
|
||||
}
|
||||
if (directMethods != null && directMethods.length > 0) {
|
||||
return directMethods[0].method.getContainingClass();
|
||||
}
|
||||
if (virtualMethods != null && virtualMethods.length > 0) {
|
||||
return virtualMethods[0].method.getContainingClass();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,7 +28,6 @@
|
||||
|
||||
package org.jf.dexlib;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import org.jf.dexlib.EncodedValue.ArrayEncodedSubValue;
|
||||
import org.jf.dexlib.EncodedValue.EncodedValue;
|
||||
import org.jf.dexlib.Util.AccessFlags;
|
||||
@ -88,13 +87,6 @@ public class ClassDefItem extends Item<ClassDefItem> {
|
||||
this.annotations = annotations;
|
||||
this.classData = classData;
|
||||
this.staticFieldInitializers = staticFieldInitializers;
|
||||
|
||||
if (classData != null) {
|
||||
classData.setParent(this);
|
||||
}
|
||||
if (annotations != null) {
|
||||
annotations.setParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,13 +137,6 @@ public class ClassDefItem extends Item<ClassDefItem> {
|
||||
classData = (ClassDataItem)readContext.getOptionalOffsettedItemByOffset(ItemType.TYPE_CLASS_DATA_ITEM, in.readInt());
|
||||
staticFieldInitializers = (EncodedArrayItem)readContext.getOptionalOffsettedItemByOffset(
|
||||
ItemType.TYPE_ENCODED_ARRAY_ITEM, in.readInt());
|
||||
|
||||
if (classData != null) {
|
||||
classData.setParent(this);
|
||||
}
|
||||
if (annotations != null) {
|
||||
annotations.setParent(this);
|
||||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@ -344,7 +329,7 @@ public class ClassDefItem extends Item<ClassDefItem> {
|
||||
*/
|
||||
private static EncodedArrayItem makeStaticFieldInitializersItem(DexFile dexFile,
|
||||
@Nonnull List<StaticFieldInitializer> staticFieldInitializers) {
|
||||
if (staticFieldInitializers == null || staticFieldInitializers.size() == 0) {
|
||||
if (staticFieldInitializers.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,13 @@ public class ClassPath {
|
||||
//if the two arrays have the same number of dimensions, then we should return an array class with the
|
||||
//same number of dimensions, for the common superclass of the 2 element classes
|
||||
if (class1.arrayDimensions == class2.arrayDimensions) {
|
||||
ClassDef commonElementClass = getCommonSuperclass(class1.elementClass, class2.elementClass);
|
||||
ClassDef commonElementClass;
|
||||
if (class1.elementClass instanceof UnresolvedClassDef ||
|
||||
class2.elementClass instanceof UnresolvedClassDef) {
|
||||
commonElementClass = ClassPath.getUnresolvedObjectClassDef();
|
||||
} else {
|
||||
commonElementClass = getCommonSuperclass(class1.elementClass, class2.elementClass);
|
||||
}
|
||||
return getArrayClassDefByElementClassAndDimension(commonElementClass, class1.arrayDimensions);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.jf.dexlib.Code.Opcode;
|
||||
import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
|
||||
public class Instruction10t extends Instruction implements OffsetInstruction {
|
||||
public class Instruction10t extends OffsetInstruction {
|
||||
public static final InstructionFactory Factory = new Factory();
|
||||
private int targetAddressOffset;
|
||||
|
||||
|
@ -35,7 +35,7 @@ import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
public class Instruction20t extends Instruction implements OffsetInstruction {
|
||||
public class Instruction20t extends OffsetInstruction {
|
||||
public static final InstructionFactory Factory = new Factory();
|
||||
private int targetAddressOffset;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
public class Instruction21t extends Instruction implements OffsetInstruction, SingleRegisterInstruction {
|
||||
public class Instruction21t extends OffsetInstruction implements SingleRegisterInstruction {
|
||||
public static final Instruction.InstructionFactory Factory = new Factory();
|
||||
private byte regA;
|
||||
private short targetAddressOffset;
|
||||
|
@ -36,7 +36,7 @@ import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
public class Instruction22t extends Instruction implements OffsetInstruction, TwoRegisterInstruction {
|
||||
public class Instruction22t extends OffsetInstruction implements TwoRegisterInstruction {
|
||||
public static final Instruction.InstructionFactory Factory = new Factory();
|
||||
private byte regA;
|
||||
private byte regB;
|
||||
|
@ -35,7 +35,7 @@ import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
public class Instruction30t extends Instruction implements OffsetInstruction {
|
||||
public class Instruction30t extends OffsetInstruction {
|
||||
public static final InstructionFactory Factory = new Factory();
|
||||
private int targetAddressOffset;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.jf.dexlib.DexFile;
|
||||
import org.jf.dexlib.Util.AnnotatedOutput;
|
||||
import org.jf.dexlib.Util.NumberUtils;
|
||||
|
||||
public class Instruction31t extends Instruction implements OffsetInstruction, SingleRegisterInstruction {
|
||||
public class Instruction31t extends OffsetInstruction implements SingleRegisterInstruction {
|
||||
public static final Instruction.InstructionFactory Factory = new Factory();
|
||||
private byte regA;
|
||||
private int targetAddressOffset;
|
||||
|
@ -28,7 +28,11 @@
|
||||
|
||||
package org.jf.dexlib.Code;
|
||||
|
||||
public interface OffsetInstruction {
|
||||
public int getTargetAddressOffset();
|
||||
public void updateTargetAddressOffset(int targetAddressOffset);
|
||||
public abstract class OffsetInstruction extends Instruction {
|
||||
protected OffsetInstruction(Opcode opcode) {
|
||||
super(opcode);
|
||||
}
|
||||
|
||||
public abstract int getTargetAddressOffset();
|
||||
public abstract void updateTargetAddressOffset(int targetAddressOffset);
|
||||
}
|
||||
|
@ -1,791 +0,0 @@
|
||||
/*
|
||||
* The comment, number, string and character constant lexical rules are
|
||||
* derived from rules from the Java 1.6 grammar which can be found here:
|
||||
* http://openjdk.java.net/projects/compiler-grammar/antlrworks/Java.g
|
||||
*
|
||||
* Specifically, these rules:
|
||||
*
|
||||
* BASE_INTEGER, DECIMAL_EXPONENT, BINARY_EXPONENT, HEX_PREFIX, HEX_DIGIT,
|
||||
* BASE_FLOAT_OR_ID, BASE_FLOAT, ESCAPE_SEQUENCE, POSITIVE_INTEGER_LITERAL,
|
||||
* NEGATIVE_INTEGER_LITERAL, LONG_LITERAL, SHORT_LITERAL, BYTE_LITERAL,
|
||||
* FLOAT_LITERAL_OR_ID, DOUBLE_LITERAL_OR_ID, FLOAT_LITERAL, DOUBLE_LITERAL,
|
||||
* BOOL_LITERAL, STRING_LITERAL, BASE_STRING_LITERAL, CHAR_LITERAL,
|
||||
* BASE_CHAR_LITERAL
|
||||
*
|
||||
* These rules were originally copyrighted by Terence Parr, and are used here in
|
||||
* accordance with the following license
|
||||
*
|
||||
* [The "BSD licence"]
|
||||
* Copyright (c) 2007-2008 Terence Parr
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*
|
||||
* The remainder of this grammar is released by me (Ben Gruver) under the
|
||||
* following license:
|
||||
*
|
||||
* [The "BSD licence"]
|
||||
* Copyright (c) 2010 Ben Gruver
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
lexer grammar smaliLexer;
|
||||
|
||||
options {
|
||||
superClass=ANTLRLexerWithErrorInterface;
|
||||
}
|
||||
|
||||
@lexer::header {
|
||||
package org.jf.smali;
|
||||
|
||||
import static org.jf.smali.LexerErrorInterface.ANTLRLexerWithErrorInterface;
|
||||
}
|
||||
|
||||
@lexer::members {
|
||||
public static final int ERROR_CHANNEL = 100;
|
||||
public String getErrorHeader(RecognitionException e) {
|
||||
return getSourceName()+"["+ e.line+","+e.charPositionInLine+"]";
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* DIRECTIVES
|
||||
**********************************************************/
|
||||
|
||||
CLASS_DIRECTIVE
|
||||
: '.class';
|
||||
|
||||
SUPER_DIRECTIVE
|
||||
: '.super';
|
||||
|
||||
IMPLEMENTS_DIRECTIVE
|
||||
: '.implements';
|
||||
|
||||
SOURCE_DIRECTIVE
|
||||
: '.source';
|
||||
|
||||
FIELD_DIRECTIVE
|
||||
: '.field';
|
||||
|
||||
END_FIELD_DIRECTIVE
|
||||
: '.end field';
|
||||
|
||||
SUBANNOTATION_DIRECTIVE
|
||||
: '.subannotation';
|
||||
|
||||
END_SUBANNOTATION_DIRECTIVE
|
||||
: '.end subannotation';
|
||||
|
||||
ANNOTATION_DIRECTIVE
|
||||
: '.annotation';
|
||||
|
||||
END_ANNOTATION_DIRECTIVE
|
||||
: '.end annotation';
|
||||
|
||||
ENUM_DIRECTIVE
|
||||
: '.enum';
|
||||
|
||||
METHOD_DIRECTIVE
|
||||
: '.method';
|
||||
|
||||
END_METHOD_DIRECTIVE
|
||||
: '.end method';
|
||||
|
||||
REGISTERS_DIRECTIVE
|
||||
: '.registers';
|
||||
|
||||
LOCALS_DIRECTIVE
|
||||
: '.locals';
|
||||
|
||||
ARRAY_DATA_DIRECTIVE
|
||||
: '.array-data';
|
||||
|
||||
END_ARRAY_DATA_DIRECTIVE
|
||||
: '.end array-data';
|
||||
|
||||
PACKED_SWITCH_DIRECTIVE
|
||||
: '.packed-switch';
|
||||
|
||||
END_PACKED_SWITCH_DIRECTIVE
|
||||
: '.end packed-switch';
|
||||
|
||||
SPARSE_SWITCH_DIRECTIVE
|
||||
: '.sparse-switch';
|
||||
|
||||
END_SPARSE_SWITCH_DIRECTIVE
|
||||
: '.end sparse-switch';
|
||||
|
||||
CATCH_DIRECTIVE
|
||||
: '.catch';
|
||||
|
||||
CATCHALL_DIRECTIVE
|
||||
: '.catchall';
|
||||
|
||||
LINE_DIRECTIVE
|
||||
: '.line';
|
||||
|
||||
PARAMETER_DIRECTIVE
|
||||
: '.parameter';
|
||||
|
||||
END_PARAMETER_DIRECTIVE
|
||||
: '.end parameter';
|
||||
|
||||
LOCAL_DIRECTIVE
|
||||
: '.local';
|
||||
|
||||
END_LOCAL_DIRECTIVE
|
||||
: '.end local';
|
||||
|
||||
RESTART_LOCAL_DIRECTIVE
|
||||
: '.restart local';
|
||||
|
||||
PROLOGUE_DIRECTIVE
|
||||
: '.prologue';
|
||||
|
||||
EPILOGUE_DIRECTIVE
|
||||
: '.epilogue';
|
||||
|
||||
/**********************************************************
|
||||
* LITERALS
|
||||
**********************************************************/
|
||||
fragment BASE_INTEGER
|
||||
: '0'
|
||||
| ('1'..'9') ('0'..'9')*
|
||||
| '0' ('0'..'7')+
|
||||
| HEX_PREFIX HEX_DIGIT+;
|
||||
|
||||
fragment DECIMAL_EXPONENT
|
||||
: ('e'|'E') '-'? ('0'..'9')+;
|
||||
|
||||
fragment BINARY_EXPONENT
|
||||
: ('p'|'P') '-'? ('0'..'9')+;
|
||||
|
||||
fragment HEX_PREFIX
|
||||
: '0x'|'0X';
|
||||
|
||||
fragment HEX_DIGIT
|
||||
: ('0'..'9')|('A'..'F')|('a'..'f');
|
||||
|
||||
fragment HEX_DIGITS
|
||||
: HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT;
|
||||
|
||||
/*This can either be floating point numbers, or identifier*/
|
||||
fragment BASE_FLOAT_OR_ID
|
||||
: '-'? ('0'..'9')+ DECIMAL_EXPONENT
|
||||
| HEX_PREFIX HEX_DIGIT+ BINARY_EXPONENT
|
||||
| '-'? ('i' | 'I') ('n' | 'N') ('f' | 'F') ('i' | 'I') ('n' | 'N') ('i' | 'I') ('t' | 'T') ('y' | 'Y')
|
||||
| ('n' | 'N') ('a' | 'A') ('n' | 'N');
|
||||
|
||||
/*These can't be identifiers, due to the decimal point*/
|
||||
fragment BASE_FLOAT
|
||||
: '-'? ('0'..'9')+ '.' ('0'..'9')* DECIMAL_EXPONENT?
|
||||
| '-'? '.' ('0'..'9')+ DECIMAL_EXPONENT?
|
||||
| '-'? HEX_PREFIX HEX_DIGIT+ '.' HEX_DIGIT* BINARY_EXPONENT
|
||||
| '-'? HEX_PREFIX '.' HEX_DIGIT+ BINARY_EXPONENT;
|
||||
|
||||
fragment ESCAPE_SEQUENCE[StringBuilder sb]
|
||||
: '\\'
|
||||
(
|
||||
'b' {sb.append("\b");}
|
||||
| 't' {sb.append("\t");}
|
||||
| 'n' {sb.append("\n");}
|
||||
| 'f' {sb.append("\f");}
|
||||
| 'r' {sb.append("\r");}
|
||||
| '\"' {sb.append("\"");}
|
||||
| '\'' {sb.append("'");}
|
||||
| '\\' {sb.append("\\");}
|
||||
| 'u' HEX_DIGITS {sb.append((char)Integer.parseInt($HEX_DIGITS.text, 16));}
|
||||
);
|
||||
|
||||
POSITIVE_INTEGER_LITERAL
|
||||
: BASE_INTEGER;
|
||||
|
||||
NEGATIVE_INTEGER_LITERAL
|
||||
: '-' BASE_INTEGER;
|
||||
|
||||
LONG_LITERAL
|
||||
: '-'? BASE_INTEGER ('l'|'L');
|
||||
|
||||
SHORT_LITERAL
|
||||
: '-'? BASE_INTEGER ('s'|'S');
|
||||
|
||||
BYTE_LITERAL
|
||||
: '-'? BASE_INTEGER ('t'|'T');
|
||||
|
||||
FLOAT_LITERAL_OR_ID
|
||||
: BASE_FLOAT_OR_ID ('f'|'F')
|
||||
| '-'? ('0'..'9')+ ('f'|'F');
|
||||
|
||||
DOUBLE_LITERAL_OR_ID
|
||||
: BASE_FLOAT_OR_ID ('d'|'D')?
|
||||
| '-'? ('0'..'9')+ ('d'|'D');
|
||||
|
||||
FLOAT_LITERAL
|
||||
: BASE_FLOAT ('f'|'F');
|
||||
|
||||
DOUBLE_LITERAL
|
||||
: BASE_FLOAT ('d'|'D')?;
|
||||
|
||||
BOOL_LITERAL
|
||||
: 'true'
|
||||
| 'false';
|
||||
|
||||
NULL_LITERAL
|
||||
: 'null';
|
||||
|
||||
STRING_LITERAL
|
||||
@init {StringBuilder sb = new StringBuilder();}
|
||||
: BASE_STRING_LITERAL[sb] {setText(sb.toString());};
|
||||
|
||||
fragment BASE_STRING_LITERAL[StringBuilder sb]
|
||||
: '"' {sb.append('"');}
|
||||
( ESCAPE_SEQUENCE[sb]
|
||||
| ~( '\\' | '"' | '\r' | '\n' ) {sb.append((char)input.LA(-1));}
|
||||
)*
|
||||
'"' {sb.append('"');};
|
||||
|
||||
CHAR_LITERAL
|
||||
@init {StringBuilder sb = new StringBuilder();}
|
||||
: BASE_CHAR_LITERAL[sb] {setText(sb.toString());};
|
||||
|
||||
fragment BASE_CHAR_LITERAL[StringBuilder sb]
|
||||
: '\'' {sb.append('\'');}
|
||||
( ESCAPE_SEQUENCE[sb]
|
||||
| ~( '\\' | '\'' | '\r' | '\n' ) {sb.append((char)input.LA(-1));}
|
||||
)
|
||||
'\'' { sb.append('\''); };
|
||||
|
||||
|
||||
/**********************************************************
|
||||
* MISC
|
||||
**********************************************************/
|
||||
REGISTER
|
||||
: ('v'|'p') ('0'..'9')+;
|
||||
|
||||
ANNOTATION_VISIBILITY
|
||||
: 'build'
|
||||
| 'runtime'
|
||||
| 'system';
|
||||
|
||||
ACCESS_SPEC
|
||||
: 'public'
|
||||
| 'private'
|
||||
| 'protected'
|
||||
| 'static'
|
||||
| 'final'
|
||||
| 'synchronized'
|
||||
| 'bridge'
|
||||
| 'varargs'
|
||||
| 'native'
|
||||
| 'abstract'
|
||||
| 'strictfp'
|
||||
| 'synthetic'
|
||||
| 'constructor'
|
||||
| 'declared-synchronized'
|
||||
| 'interface'
|
||||
| 'enum'
|
||||
| 'annotation'
|
||||
| 'volatile'
|
||||
| 'transient';
|
||||
|
||||
VERIFICATION_ERROR_TYPE
|
||||
: 'no-error'
|
||||
| 'generic-error'
|
||||
| 'no-such-class'
|
||||
| 'no-such-field'
|
||||
| 'no-such-method'
|
||||
| 'illegal-class-access'
|
||||
| 'illegal-field-access'
|
||||
| 'illegal-method-access'
|
||||
| 'class-change-error'
|
||||
| 'instantiation-error';
|
||||
|
||||
INLINE_INDEX
|
||||
: 'inline@0x' HEX_DIGIT+;
|
||||
|
||||
VTABLE_INDEX
|
||||
: 'vtable@0x' HEX_DIGIT+;
|
||||
|
||||
FIELD_OFFSET
|
||||
: 'field@0x' HEX_DIGIT+;
|
||||
|
||||
OFFSET
|
||||
: '+' BASE_INTEGER;
|
||||
|
||||
LINE_COMMENT
|
||||
: '#'
|
||||
(
|
||||
~('\n'|'\r')* ('\r\n' | '\r' | '\n')
|
||||
| ~('\n'|'\r')*
|
||||
)
|
||||
{$channel = HIDDEN;};
|
||||
|
||||
/**********************************************************
|
||||
* Instructions
|
||||
**********************************************************/
|
||||
INSTRUCTION_FORMAT10t
|
||||
: 'goto';
|
||||
|
||||
INSTRUCTION_FORMAT10x
|
||||
: 'return-void'
|
||||
| 'nop';
|
||||
|
||||
INSTRUCTION_FORMAT10x_ODEX
|
||||
: 'return-void-barrier';
|
||||
|
||||
INSTRUCTION_FORMAT11n
|
||||
: 'const/4';
|
||||
|
||||
INSTRUCTION_FORMAT11x
|
||||
: 'move-result'
|
||||
| 'move-result-wide'
|
||||
| 'move-result-object'
|
||||
| 'move-exception'
|
||||
| 'return'
|
||||
| 'return-wide'
|
||||
| 'return-object'
|
||||
| 'monitor-enter'
|
||||
| 'monitor-exit'
|
||||
| 'throw';
|
||||
|
||||
INSTRUCTION_FORMAT12x_OR_ID
|
||||
: 'move'
|
||||
| 'move-wide'
|
||||
| 'move-object'
|
||||
| 'array-length'
|
||||
| 'neg-int'
|
||||
| 'not-int'
|
||||
| 'neg-long'
|
||||
| 'not-long'
|
||||
| 'neg-float'
|
||||
| 'neg-double'
|
||||
| 'int-to-long'
|
||||
| 'int-to-float'
|
||||
| 'int-to-double'
|
||||
| 'long-to-int'
|
||||
| 'long-to-float'
|
||||
| 'long-to-double'
|
||||
| 'float-to-int'
|
||||
| 'float-to-long'
|
||||
| 'float-to-double'
|
||||
| 'double-to-int'
|
||||
| 'double-to-long'
|
||||
| 'double-to-float'
|
||||
| 'int-to-byte'
|
||||
| 'int-to-char'
|
||||
| 'int-to-short';
|
||||
|
||||
INSTRUCTION_FORMAT12x
|
||||
: 'add-int/2addr'
|
||||
| 'sub-int/2addr'
|
||||
| 'mul-int/2addr'
|
||||
| 'div-int/2addr'
|
||||
| 'rem-int/2addr'
|
||||
| 'and-int/2addr'
|
||||
| 'or-int/2addr'
|
||||
| 'xor-int/2addr'
|
||||
| 'shl-int/2addr'
|
||||
| 'shr-int/2addr'
|
||||
| 'ushr-int/2addr'
|
||||
| 'add-long/2addr'
|
||||
| 'sub-long/2addr'
|
||||
| 'mul-long/2addr'
|
||||
| 'div-long/2addr'
|
||||
| 'rem-long/2addr'
|
||||
| 'and-long/2addr'
|
||||
| 'or-long/2addr'
|
||||
| 'xor-long/2addr'
|
||||
| 'shl-long/2addr'
|
||||
| 'shr-long/2addr'
|
||||
| 'ushr-long/2addr'
|
||||
| 'add-float/2addr'
|
||||
| 'sub-float/2addr'
|
||||
| 'mul-float/2addr'
|
||||
| 'div-float/2addr'
|
||||
| 'rem-float/2addr'
|
||||
| 'add-double/2addr'
|
||||
| 'sub-double/2addr'
|
||||
| 'mul-double/2addr'
|
||||
| 'div-double/2addr'
|
||||
| 'rem-double/2addr';
|
||||
|
||||
INSTRUCTION_FORMAT20bc
|
||||
: 'throw-verification-error';
|
||||
|
||||
INSTRUCTION_FORMAT20t
|
||||
: 'goto/16';
|
||||
|
||||
INSTRUCTION_FORMAT21c_FIELD
|
||||
: 'sget'
|
||||
| 'sget-wide'
|
||||
| 'sget-object'
|
||||
| 'sget-boolean'
|
||||
| 'sget-byte'
|
||||
| 'sget-char'
|
||||
| 'sget-short'
|
||||
| 'sput'
|
||||
| 'sput-wide'
|
||||
| 'sput-object'
|
||||
| 'sput-boolean'
|
||||
| 'sput-byte'
|
||||
| 'sput-char'
|
||||
| 'sput-short';
|
||||
|
||||
INSTRUCTION_FORMAT21c_FIELD_ODEX
|
||||
: 'sget-volatile'
|
||||
| 'sget-wide-volatile'
|
||||
| 'sget-object-volatile'
|
||||
| 'sput-volatile'
|
||||
| 'sput-wide-volatile'
|
||||
| 'sput-object-volatile';
|
||||
|
||||
INSTRUCTION_FORMAT21c_STRING
|
||||
: 'const-string';
|
||||
|
||||
INSTRUCTION_FORMAT21c_TYPE
|
||||
: 'check-cast'
|
||||
| 'new-instance'
|
||||
| 'const-class';
|
||||
|
||||
INSTRUCTION_FORMAT21h
|
||||
: 'const/high16'
|
||||
| 'const-wide/high16';
|
||||
|
||||
INSTRUCTION_FORMAT21s
|
||||
: 'const/16'
|
||||
| 'const-wide/16';
|
||||
|
||||
INSTRUCTION_FORMAT21t
|
||||
: 'if-eqz'
|
||||
| 'if-nez'
|
||||
| 'if-ltz'
|
||||
| 'if-gez'
|
||||
| 'if-gtz'
|
||||
| 'if-lez';
|
||||
|
||||
INSTRUCTION_FORMAT22b
|
||||
: 'add-int/lit8'
|
||||
| 'rsub-int/lit8'
|
||||
| 'mul-int/lit8'
|
||||
| 'div-int/lit8'
|
||||
| 'rem-int/lit8'
|
||||
| 'and-int/lit8'
|
||||
| 'or-int/lit8'
|
||||
| 'xor-int/lit8'
|
||||
| 'shl-int/lit8'
|
||||
| 'shr-int/lit8'
|
||||
| 'ushr-int/lit8';
|
||||
|
||||
INSTRUCTION_FORMAT22c_FIELD
|
||||
: 'iget'
|
||||
| 'iget-wide'
|
||||
| 'iget-object'
|
||||
| 'iget-boolean'
|
||||
| 'iget-byte'
|
||||
| 'iget-char'
|
||||
| 'iget-short'
|
||||
| 'iput'
|
||||
| 'iput-wide'
|
||||
| 'iput-object'
|
||||
| 'iput-boolean'
|
||||
| 'iput-byte'
|
||||
| 'iput-char'
|
||||
| 'iput-short';
|
||||
|
||||
INSTRUCTION_FORMAT22c_FIELD_ODEX
|
||||
: 'iget-volatile'
|
||||
| 'iget-wide-volatile'
|
||||
| 'iget-object-volatile'
|
||||
| 'iput-volatile'
|
||||
| 'iput-wide-volatile'
|
||||
| 'iput-object-volatile';
|
||||
|
||||
INSTRUCTION_FORMAT22c_TYPE
|
||||
: 'instance-of'
|
||||
| 'new-array';
|
||||
|
||||
|
||||
INSTRUCTION_FORMAT22cs_FIELD
|
||||
: 'iget-quick'
|
||||
| 'iget-wide-quick'
|
||||
| 'iget-object-quick'
|
||||
| 'iput-quick'
|
||||
| 'iput-wide-quick'
|
||||
| 'iput-object-quick';
|
||||
|
||||
INSTRUCTION_FORMAT22s_OR_ID
|
||||
: 'rsub-int';
|
||||
|
||||
INSTRUCTION_FORMAT22s
|
||||
: 'add-int/lit16'
|
||||
| 'mul-int/lit16'
|
||||
| 'div-int/lit16'
|
||||
| 'rem-int/lit16'
|
||||
| 'and-int/lit16'
|
||||
| 'or-int/lit16'
|
||||
| 'xor-int/lit16';
|
||||
|
||||
INSTRUCTION_FORMAT22t
|
||||
: 'if-eq'
|
||||
| 'if-ne'
|
||||
| 'if-lt'
|
||||
| 'if-ge'
|
||||
| 'if-gt'
|
||||
| 'if-le';
|
||||
|
||||
INSTRUCTION_FORMAT22x
|
||||
: 'move/from16'
|
||||
| 'move-wide/from16'
|
||||
| 'move-object/from16';
|
||||
|
||||
INSTRUCTION_FORMAT23x
|
||||
: 'cmpl-float'
|
||||
| 'cmpg-float'
|
||||
| 'cmpl-double'
|
||||
| 'cmpg-double'
|
||||
| 'cmp-long'
|
||||
| 'aget'
|
||||
| 'aget-wide'
|
||||
| 'aget-object'
|
||||
| 'aget-boolean'
|
||||
| 'aget-byte'
|
||||
| 'aget-char'
|
||||
| 'aget-short'
|
||||
| 'aput'
|
||||
| 'aput-wide'
|
||||
| 'aput-object'
|
||||
| 'aput-boolean'
|
||||
| 'aput-byte'
|
||||
| 'aput-char'
|
||||
| 'aput-short'
|
||||
| 'add-int'
|
||||
| 'sub-int'
|
||||
| 'mul-int'
|
||||
| 'div-int'
|
||||
| 'rem-int'
|
||||
| 'and-int'
|
||||
| 'or-int'
|
||||
| 'xor-int'
|
||||
| 'shl-int'
|
||||
| 'shr-int'
|
||||
| 'ushr-int'
|
||||
| 'add-long'
|
||||
| 'sub-long'
|
||||
| 'mul-long'
|
||||
| 'div-long'
|
||||
| 'rem-long'
|
||||
| 'and-long'
|
||||
| 'or-long'
|
||||
| 'xor-long'
|
||||
| 'shl-long'
|
||||
| 'shr-long'
|
||||
| 'ushr-long'
|
||||
| 'add-float'
|
||||
| 'sub-float'
|
||||
| 'mul-float'
|
||||
| 'div-float'
|
||||
| 'rem-float'
|
||||
| 'add-double'
|
||||
| 'sub-double'
|
||||
| 'mul-double'
|
||||
| 'div-double'
|
||||
| 'rem-double';
|
||||
|
||||
INSTRUCTION_FORMAT30t
|
||||
: 'goto/32';
|
||||
|
||||
INSTRUCTION_FORMAT31c
|
||||
: 'const-string/jumbo';
|
||||
|
||||
INSTRUCTION_FORMAT31i_OR_ID
|
||||
: 'const';
|
||||
|
||||
INSTRUCTION_FORMAT31i
|
||||
: 'const-wide/32';
|
||||
|
||||
INSTRUCTION_FORMAT31t
|
||||
: 'fill-array-data'
|
||||
| 'packed-switch'
|
||||
| 'sparse-switch';
|
||||
|
||||
INSTRUCTION_FORMAT32x
|
||||
: 'move/16'
|
||||
| 'move-wide/16'
|
||||
| 'move-object/16';
|
||||
|
||||
INSTRUCTION_FORMAT35c_METHOD
|
||||
: 'invoke-virtual'
|
||||
| 'invoke-super'
|
||||
| 'invoke-direct'
|
||||
| 'invoke-static'
|
||||
| 'invoke-interface';
|
||||
|
||||
INSTRUCTION_FORMAT35c_METHOD_ODEX
|
||||
: 'invoke-direct-empty';
|
||||
|
||||
INSTRUCTION_FORMAT35c_TYPE
|
||||
: 'filled-new-array';
|
||||
|
||||
INSTRUCTION_FORMAT35mi_METHOD
|
||||
: 'execute-inline';
|
||||
|
||||
INSTRUCTION_FORMAT35ms_METHOD
|
||||
: 'invoke-virtual-quick'
|
||||
| 'invoke-super-quick';
|
||||
|
||||
INSTRUCTION_FORMAT3rc_METHOD
|
||||
: 'invoke-virtual/range'
|
||||
| 'invoke-super/range'
|
||||
| 'invoke-direct/range'
|
||||
| 'invoke-static/range'
|
||||
| 'invoke-interface/range';
|
||||
|
||||
INSTRUCTION_FORMAT3rc_METHOD_ODEX
|
||||
: 'invoke-object-init/range';
|
||||
|
||||
INSTRUCTION_FORMAT3rc_TYPE
|
||||
: 'filled-new-array/range';
|
||||
|
||||
INSTRUCTION_FORMAT3rmi_METHOD
|
||||
: 'execute-inline/range';
|
||||
|
||||
INSTRUCTION_FORMAT3rms_METHOD
|
||||
: 'invoke-virtual-quick/range'
|
||||
| 'invoke-super-quick/range';
|
||||
|
||||
INSTRUCTION_FORMAT51l
|
||||
: 'const-wide';
|
||||
|
||||
/**********************************************************
|
||||
* Types
|
||||
**********************************************************/
|
||||
fragment BASE_SIMPLE_NAME:
|
||||
( 'A'..'Z'
|
||||
| 'a'..'z'
|
||||
| '0'..'9'
|
||||
| '$'
|
||||
| '-'
|
||||
| '_'
|
||||
| '\u00a1'..'\u1fff'
|
||||
| '\u2010'..'\u2027'
|
||||
| '\u2030'..'\ud7ff'
|
||||
| '\ue000'..'\uffef'
|
||||
)+;
|
||||
|
||||
fragment BASE_PRIMITIVE_TYPE
|
||||
: 'Z'|'B'|'S'|'C'|'I'|'J'|'F'|'D';
|
||||
|
||||
|
||||
fragment BASE_CLASS_DESCRIPTOR
|
||||
: 'L' (BASE_SIMPLE_NAME '/')* BASE_SIMPLE_NAME ';';
|
||||
|
||||
fragment BASE_ARRAY_DESCRIPTOR
|
||||
: '['+ (BASE_PRIMITIVE_TYPE | BASE_CLASS_DESCRIPTOR);
|
||||
|
||||
fragment BASE_TYPE
|
||||
: BASE_PRIMITIVE_TYPE
|
||||
| BASE_CLASS_DESCRIPTOR
|
||||
| BASE_ARRAY_DESCRIPTOR;
|
||||
|
||||
PRIMITIVE_TYPE
|
||||
: BASE_PRIMITIVE_TYPE;
|
||||
|
||||
VOID_TYPE
|
||||
: 'V';
|
||||
|
||||
CLASS_DESCRIPTOR
|
||||
: BASE_CLASS_DESCRIPTOR;
|
||||
|
||||
ARRAY_DESCRIPTOR
|
||||
: BASE_ARRAY_DESCRIPTOR;
|
||||
|
||||
PARAM_LIST_OR_ID
|
||||
: BASE_PRIMITIVE_TYPE BASE_PRIMITIVE_TYPE+;
|
||||
|
||||
PARAM_LIST
|
||||
: BASE_TYPE BASE_TYPE+;
|
||||
|
||||
SIMPLE_NAME
|
||||
: BASE_SIMPLE_NAME;
|
||||
|
||||
METHOD_NAME
|
||||
: '<init>'
|
||||
| '<clinit>';
|
||||
|
||||
|
||||
/**********************************************************
|
||||
* Symbols
|
||||
**********************************************************/
|
||||
|
||||
DOTDOT
|
||||
: '..';
|
||||
|
||||
ARROW
|
||||
: '->';
|
||||
|
||||
EQUAL
|
||||
: '=';
|
||||
|
||||
COLON
|
||||
: ':';
|
||||
|
||||
COMMA
|
||||
: ',';
|
||||
|
||||
OPEN_BRACE
|
||||
: '{';
|
||||
|
||||
CLOSE_BRACE
|
||||
: '}';
|
||||
|
||||
OPEN_PAREN
|
||||
: '(';
|
||||
|
||||
CLOSE_PAREN
|
||||
: ')';
|
||||
|
||||
WHITE_SPACE
|
||||
: (' '|'\t'|'\n'|'\r')+ {$channel = HIDDEN;};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -28,7 +28,6 @@
|
||||
|
||||
package org.jf.smali;
|
||||
|
||||
import org.antlr.runtime.CharStream;
|
||||
import org.antlr.runtime.CommonToken;
|
||||
|
||||
public class InvalidToken extends CommonToken {
|
||||
@ -37,13 +36,13 @@ public class InvalidToken extends CommonToken {
|
||||
public InvalidToken(String message) {
|
||||
super(smaliParser.INVALID_TOKEN);
|
||||
this.message = message;
|
||||
this.channel = smaliLexer.ERROR_CHANNEL;
|
||||
this.channel = smaliParser.ERROR_CHANNEL;
|
||||
}
|
||||
|
||||
public InvalidToken(String message, String text) {
|
||||
super(smaliParser.INVALID_TOKEN, text);
|
||||
this.message = message;
|
||||
this.channel = smaliLexer.ERROR_CHANNEL;
|
||||
this.channel = smaliParser.ERROR_CHANNEL;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
package org.jf.smali;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class LiteralTools
|
||||
{
|
||||
public static byte parseByte(String byteLiteral)
|
||||
@ -304,6 +307,42 @@ public class LiteralTools
|
||||
}
|
||||
}
|
||||
|
||||
private static Pattern specialFloatRegex = Pattern.compile("((-)?infinityf)|(nanf)", Pattern.CASE_INSENSITIVE);
|
||||
public static float parseFloat(String floatString) {
|
||||
Matcher m = specialFloatRegex.matcher(floatString);
|
||||
if (m.matches()) {
|
||||
//got an infinity
|
||||
if (m.start(1) != -1) {
|
||||
if (m.start(2) != -1) {
|
||||
return Float.NEGATIVE_INFINITY;
|
||||
} else {
|
||||
return Float.POSITIVE_INFINITY;
|
||||
}
|
||||
} else {
|
||||
return Float.NaN;
|
||||
}
|
||||
}
|
||||
return Float.parseFloat(floatString);
|
||||
}
|
||||
|
||||
private static Pattern specialDoubleRegex = Pattern.compile("((-)?infinityd?)|(nand?)", Pattern.CASE_INSENSITIVE);
|
||||
public static double parseDouble(String doubleString) {
|
||||
Matcher m = specialDoubleRegex.matcher(doubleString);
|
||||
if (m.matches()) {
|
||||
//got an infinity
|
||||
if (m.start(1) != -1) {
|
||||
if (m.start(2) != -1) {
|
||||
return Double.NEGATIVE_INFINITY;
|
||||
} else {
|
||||
return Double.POSITIVE_INFINITY;
|
||||
}
|
||||
} else {
|
||||
return Double.NaN;
|
||||
}
|
||||
}
|
||||
return Double.parseDouble(doubleString);
|
||||
}
|
||||
|
||||
public static byte[] longToBytes(long value) {
|
||||
byte[] bytes = new byte[8];
|
||||
|
||||
|
@ -103,7 +103,6 @@ public class main {
|
||||
boolean fixJumbo = true;
|
||||
boolean fixGoto = true;
|
||||
boolean verboseErrors = false;
|
||||
boolean oldLexer = false;
|
||||
boolean printTokens = false;
|
||||
|
||||
boolean apiSet = false;
|
||||
@ -158,9 +157,6 @@ public class main {
|
||||
case 'V':
|
||||
verboseErrors = true;
|
||||
break;
|
||||
case 'L':
|
||||
oldLexer = true;
|
||||
break;
|
||||
case 'T':
|
||||
printTokens = true;
|
||||
break;
|
||||
@ -202,7 +198,7 @@ public class main {
|
||||
boolean errors = false;
|
||||
|
||||
for (File file: filesToProcess) {
|
||||
if (!assembleSmaliFile(file, dexFile, verboseErrors, oldLexer, printTokens, allowOdex, apiLevel)) {
|
||||
if (!assembleSmaliFile(file, dexFile, verboseErrors, printTokens, allowOdex, apiLevel)) {
|
||||
errors = true;
|
||||
}
|
||||
}
|
||||
@ -276,7 +272,7 @@ public class main {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean assembleSmaliFile(File smaliFile, DexFile dexFile, boolean verboseErrors, boolean oldLexer,
|
||||
private static boolean assembleSmaliFile(File smaliFile, DexFile dexFile, boolean verboseErrors,
|
||||
boolean printTokens, boolean allowOdex, int apiLevel)
|
||||
throws Exception {
|
||||
CommonTokenStream tokens;
|
||||
@ -285,27 +281,19 @@ public class main {
|
||||
boolean lexerErrors = false;
|
||||
LexerErrorInterface lexer;
|
||||
|
||||
if (oldLexer) {
|
||||
ANTLRFileStream input = new ANTLRFileStream(smaliFile.getAbsolutePath(), "UTF-8");
|
||||
input.name = smaliFile.getAbsolutePath();
|
||||
FileInputStream fis = new FileInputStream(smaliFile.getAbsolutePath());
|
||||
InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
|
||||
|
||||
lexer = new smaliLexer(input);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
} else {
|
||||
FileInputStream fis = new FileInputStream(smaliFile.getAbsolutePath());
|
||||
InputStreamReader reader = new InputStreamReader(fis, "UTF-8");
|
||||
|
||||
lexer = new smaliFlexLexer(reader);
|
||||
((smaliFlexLexer)lexer).setSourceFile(smaliFile);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
}
|
||||
lexer = new smaliFlexLexer(reader);
|
||||
((smaliFlexLexer)lexer).setSourceFile(smaliFile);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
|
||||
if (printTokens) {
|
||||
tokens.getTokens();
|
||||
|
||||
for (int i=0; i<tokens.size(); i++) {
|
||||
Token token = tokens.get(i);
|
||||
if (token.getChannel() == smaliLexer.HIDDEN) {
|
||||
if (token.getChannel() == smaliParser.HIDDEN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -330,7 +318,7 @@ public class main {
|
||||
treeStream.setTokenStream(tokens);
|
||||
|
||||
smaliTreeWalker dexGen = new smaliTreeWalker(treeStream);
|
||||
|
||||
dexGen.setVerboseErrors(verboseErrors);
|
||||
dexGen.dexFile = dexFile;
|
||||
dexGen.smali_file();
|
||||
|
||||
@ -423,10 +411,6 @@ public class main {
|
||||
.withDescription("Generate verbose error messages")
|
||||
.create("V");
|
||||
|
||||
Option oldLexerOption = OptionBuilder.withLongOpt("old-lexer")
|
||||
.withDescription("Use the old lexer")
|
||||
.create("L");
|
||||
|
||||
Option printTokensOption = OptionBuilder.withLongOpt("print-tokens")
|
||||
.withDescription("Print the name and text of each token")
|
||||
.create("T");
|
||||
@ -442,7 +426,6 @@ public class main {
|
||||
debugOptions.addOption(noFixJumboOption);
|
||||
debugOptions.addOption(noFixGotoOption);
|
||||
debugOptions.addOption(verboseErrorsOption);
|
||||
debugOptions.addOption(oldLexerOption);
|
||||
debugOptions.addOption(printTokensOption);
|
||||
|
||||
for (Object option: basicOptions.getOptions()) {
|
||||
|
@ -74,6 +74,9 @@ import static org.jf.smali.smaliParser.*;
|
||||
}
|
||||
|
||||
public String getSourceName() {
|
||||
if (sourceFile == null) {
|
||||
return "";
|
||||
}
|
||||
try {
|
||||
return PathUtil.getRelativeFile(new File("."), sourceFile).getPath();
|
||||
} catch (IOException ex) {
|
||||
@ -267,7 +270,8 @@ Type = {PrimitiveType} | {ClassDescriptor} | {ArrayDescriptor}
|
||||
|
||||
/*Literals*/
|
||||
<YYINITIAL> {
|
||||
-? {Integer} { return newToken(INTEGER_LITERAL); }
|
||||
{Integer} { return newToken(POSITIVE_INTEGER_LITERAL); }
|
||||
- {Integer} { return newToken(NEGATIVE_INTEGER_LITERAL); }
|
||||
-? {Integer} [lL] { return newToken(LONG_LITERAL); }
|
||||
-? {Integer} [sS] { return newToken(SHORT_LITERAL); }
|
||||
-? {Integer} [tT] { return newToken(BYTE_LITERAL); }
|
||||
|
@ -165,7 +165,7 @@ public class LexerTest {
|
||||
for (int i=0; i<tokens.size(); i++) {
|
||||
token = (CommonToken)tokens.get(i);
|
||||
|
||||
if (discardHiddenTokens && token.getChannel() == smaliLexer.HIDDEN) {
|
||||
if (discardHiddenTokens && token.getChannel() == smaliParser.HIDDEN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ public class LexerTest {
|
||||
|
||||
if (token.getType() == smaliParser.INVALID_TOKEN) {
|
||||
Assert.assertTrue("Encountered an INVALID_TOKEN not on the error channel",
|
||||
token.getChannel() == smaliLexer.ERROR_CHANNEL);
|
||||
token.getChannel() == smaliParser.ERROR_CHANNEL);
|
||||
}
|
||||
|
||||
ExpectedToken expectedToken = expectedTokens.get(expectedTokenIndex++);
|
||||
|
@ -1,47 +1,47 @@
|
||||
BYTE_LITERAL("0x0T")
|
||||
INTEGER_LITERAL("0x00")
|
||||
POSITIVE_INTEGER_LITERAL("0x00")
|
||||
BYTE_LITERAL("0x1T")
|
||||
INTEGER_LITERAL("0x12")
|
||||
POSITIVE_INTEGER_LITERAL("0x12")
|
||||
BYTE_LITERAL("0x7fT")
|
||||
BYTE_LITERAL("0x80t")
|
||||
BYTE_LITERAL("0xFFt")
|
||||
INTEGER_LITERAL("-0x00")
|
||||
INTEGER_LITERAL("-0x01")
|
||||
INTEGER_LITERAL("-0x12")
|
||||
INTEGER_LITERAL("-0x80")
|
||||
INTEGER_LITERAL("-0x1f")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x00")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x01")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x12")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x80")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x1f")
|
||||
BYTE_LITERAL("-0x1fT")
|
||||
INTEGER_LITERAL("-0x81")
|
||||
INTEGER_LITERAL("-0xFF")
|
||||
INTEGER_LITERAL("-0x100")
|
||||
INTEGER_LITERAL("0")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x81")
|
||||
NEGATIVE_INTEGER_LITERAL("-0xFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x100")
|
||||
POSITIVE_INTEGER_LITERAL("0")
|
||||
BYTE_LITERAL("1t")
|
||||
INTEGER_LITERAL("123")
|
||||
POSITIVE_INTEGER_LITERAL("123")
|
||||
BYTE_LITERAL("127T")
|
||||
INTEGER_LITERAL("128")
|
||||
INTEGER_LITERAL("255")
|
||||
INTEGER_LITERAL("-0")
|
||||
INTEGER_LITERAL("-1")
|
||||
INTEGER_LITERAL("-123")
|
||||
POSITIVE_INTEGER_LITERAL("128")
|
||||
POSITIVE_INTEGER_LITERAL("255")
|
||||
NEGATIVE_INTEGER_LITERAL("-0")
|
||||
NEGATIVE_INTEGER_LITERAL("-1")
|
||||
NEGATIVE_INTEGER_LITERAL("-123")
|
||||
BYTE_LITERAL("-123T")
|
||||
INTEGER_LITERAL("-127")
|
||||
INTEGER_LITERAL("-128")
|
||||
INTEGER_LITERAL("-129")
|
||||
INTEGER_LITERAL("-255")
|
||||
INTEGER_LITERAL("256")
|
||||
INTEGER_LITERAL("260")
|
||||
INTEGER_LITERAL("00")
|
||||
INTEGER_LITERAL("01")
|
||||
NEGATIVE_INTEGER_LITERAL("-127")
|
||||
NEGATIVE_INTEGER_LITERAL("-128")
|
||||
NEGATIVE_INTEGER_LITERAL("-129")
|
||||
NEGATIVE_INTEGER_LITERAL("-255")
|
||||
POSITIVE_INTEGER_LITERAL("256")
|
||||
POSITIVE_INTEGER_LITERAL("260")
|
||||
POSITIVE_INTEGER_LITERAL("00")
|
||||
POSITIVE_INTEGER_LITERAL("01")
|
||||
BYTE_LITERAL("0123t")
|
||||
INTEGER_LITERAL("0177")
|
||||
POSITIVE_INTEGER_LITERAL("0177")
|
||||
BYTE_LITERAL("0200T")
|
||||
INTEGER_LITERAL("0377")
|
||||
INTEGER_LITERAL("-00")
|
||||
INTEGER_LITERAL("-01")
|
||||
INTEGER_LITERAL("-0123")
|
||||
POSITIVE_INTEGER_LITERAL("0377")
|
||||
NEGATIVE_INTEGER_LITERAL("-00")
|
||||
NEGATIVE_INTEGER_LITERAL("-01")
|
||||
NEGATIVE_INTEGER_LITERAL("-0123")
|
||||
BYTE_LITERAL("-0123t")
|
||||
INTEGER_LITERAL("-177")
|
||||
INTEGER_LITERAL("-0200")
|
||||
INTEGER_LITERAL("-0201")
|
||||
INTEGER_LITERAL("-0377")
|
||||
INTEGER_LITERAL("-0400")
|
||||
NEGATIVE_INTEGER_LITERAL("-177")
|
||||
NEGATIVE_INTEGER_LITERAL("-0200")
|
||||
NEGATIVE_INTEGER_LITERAL("-0201")
|
||||
NEGATIVE_INTEGER_LITERAL("-0377")
|
||||
NEGATIVE_INTEGER_LITERAL("-0400")
|
@ -2,5 +2,5 @@ LINE_COMMENT("#") WHITE_SPACE("\n")
|
||||
LINE_COMMENT("#abcd") WHITE_SPACE("\n")
|
||||
LINE_COMMENT("# abcd") WHITE_SPACE("\n")
|
||||
LINE_COMMENT("#0x1234") WHITE_SPACE("\n")
|
||||
INTEGER_LITERAL("0x1234") WHITE_SPACE(" ") LINE_COMMENT("#0x1234") WHITE_SPACE("\n")
|
||||
POSITIVE_INTEGER_LITERAL("0x1234") WHITE_SPACE(" ") LINE_COMMENT("#0x1234") WHITE_SPACE("\n")
|
||||
INSTRUCTION_FORMAT35c_METHOD("invoke-virtual") WHITE_SPACE(" ") LINE_COMMENT("#invoke-virtual")
|
@ -209,7 +209,7 @@ SIMPLE_NAME("-0x123ABCpZ")
|
||||
SIMPLE_NAME("-0x123ABCp-")
|
||||
SIMPLE_NAME("-0x123ABCp-A")
|
||||
SIMPLE_NAME("-0x123ABCp-Z")
|
||||
INTEGER_LITERAL("0x123ABCDE1")
|
||||
POSITIVE_INTEGER_LITERAL("0x123ABCDE1")
|
||||
|
||||
SIMPLE_NAME("infinitye")
|
||||
SIMPLE_NAME("-infinitye")
|
||||
|
@ -1,45 +1,45 @@
|
||||
INTEGER_LITERAL("0x0")
|
||||
INTEGER_LITERAL("0x00")
|
||||
INTEGER_LITERAL("0x1")
|
||||
INTEGER_LITERAL("0x12345678")
|
||||
INTEGER_LITERAL("0x7fffffff")
|
||||
INTEGER_LITERAL("0x80000000")
|
||||
INTEGER_LITERAL("0xFFFFFFFF")
|
||||
INTEGER_LITERAL("-0x00")
|
||||
INTEGER_LITERAL("-0x01")
|
||||
INTEGER_LITERAL("-0x12345678")
|
||||
INTEGER_LITERAL("-0x80000000")
|
||||
INTEGER_LITERAL("-0x1FFFFFFF")
|
||||
INTEGER_LITERAL("-0x80000001")
|
||||
INTEGER_LITERAL("-0xFFFFFFFF")
|
||||
INTEGER_LITERAL("-0x100000000")
|
||||
INTEGER_LITERAL("0")
|
||||
INTEGER_LITERAL("1")
|
||||
INTEGER_LITERAL("1234567890")
|
||||
INTEGER_LITERAL("2147483647")
|
||||
INTEGER_LITERAL("2147483648")
|
||||
INTEGER_LITERAL("4294967295")
|
||||
INTEGER_LITERAL("-0")
|
||||
INTEGER_LITERAL("-1")
|
||||
INTEGER_LITERAL("-1234567890")
|
||||
INTEGER_LITERAL("-2147483647")
|
||||
INTEGER_LITERAL("-2147483648")
|
||||
INTEGER_LITERAL("-2147483649")
|
||||
INTEGER_LITERAL("-4294967295")
|
||||
INTEGER_LITERAL("4294967295")
|
||||
INTEGER_LITERAL("4294967300")
|
||||
INTEGER_LITERAL("8589934592")
|
||||
INTEGER_LITERAL("00")
|
||||
INTEGER_LITERAL("01")
|
||||
INTEGER_LITERAL("012345670123")
|
||||
INTEGER_LITERAL("017777777777")
|
||||
INTEGER_LITERAL("020000000000")
|
||||
INTEGER_LITERAL("037777777777")
|
||||
INTEGER_LITERAL("-00")
|
||||
INTEGER_LITERAL("-01")
|
||||
INTEGER_LITERAL("-012345670123")
|
||||
INTEGER_LITERAL("-017777777777")
|
||||
INTEGER_LITERAL("-020000000000")
|
||||
INTEGER_LITERAL("-020000000001")
|
||||
INTEGER_LITERAL("-037777777777")
|
||||
INTEGER_LITERAL("0400000000000")
|
||||
POSITIVE_INTEGER_LITERAL("0x0")
|
||||
POSITIVE_INTEGER_LITERAL("0x00")
|
||||
POSITIVE_INTEGER_LITERAL("0x1")
|
||||
POSITIVE_INTEGER_LITERAL("0x12345678")
|
||||
POSITIVE_INTEGER_LITERAL("0x7fffffff")
|
||||
POSITIVE_INTEGER_LITERAL("0x80000000")
|
||||
POSITIVE_INTEGER_LITERAL("0xFFFFFFFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x00")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x01")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x12345678")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x80000000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x1FFFFFFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x80000001")
|
||||
NEGATIVE_INTEGER_LITERAL("-0xFFFFFFFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x100000000")
|
||||
POSITIVE_INTEGER_LITERAL("0")
|
||||
POSITIVE_INTEGER_LITERAL("1")
|
||||
POSITIVE_INTEGER_LITERAL("1234567890")
|
||||
POSITIVE_INTEGER_LITERAL("2147483647")
|
||||
POSITIVE_INTEGER_LITERAL("2147483648")
|
||||
POSITIVE_INTEGER_LITERAL("4294967295")
|
||||
NEGATIVE_INTEGER_LITERAL("-0")
|
||||
NEGATIVE_INTEGER_LITERAL("-1")
|
||||
NEGATIVE_INTEGER_LITERAL("-1234567890")
|
||||
NEGATIVE_INTEGER_LITERAL("-2147483647")
|
||||
NEGATIVE_INTEGER_LITERAL("-2147483648")
|
||||
NEGATIVE_INTEGER_LITERAL("-2147483649")
|
||||
NEGATIVE_INTEGER_LITERAL("-4294967295")
|
||||
POSITIVE_INTEGER_LITERAL("4294967295")
|
||||
POSITIVE_INTEGER_LITERAL("4294967300")
|
||||
POSITIVE_INTEGER_LITERAL("8589934592")
|
||||
POSITIVE_INTEGER_LITERAL("00")
|
||||
POSITIVE_INTEGER_LITERAL("01")
|
||||
POSITIVE_INTEGER_LITERAL("012345670123")
|
||||
POSITIVE_INTEGER_LITERAL("017777777777")
|
||||
POSITIVE_INTEGER_LITERAL("020000000000")
|
||||
POSITIVE_INTEGER_LITERAL("037777777777")
|
||||
NEGATIVE_INTEGER_LITERAL("-00")
|
||||
NEGATIVE_INTEGER_LITERAL("-01")
|
||||
NEGATIVE_INTEGER_LITERAL("-012345670123")
|
||||
NEGATIVE_INTEGER_LITERAL("-017777777777")
|
||||
NEGATIVE_INTEGER_LITERAL("-020000000000")
|
||||
NEGATIVE_INTEGER_LITERAL("-020000000001")
|
||||
NEGATIVE_INTEGER_LITERAL("-037777777777")
|
||||
POSITIVE_INTEGER_LITERAL("0400000000000")
|
@ -10,39 +10,39 @@ LONG_LITERAL("-0x01L")
|
||||
LONG_LITERAL("-0x1234567890123456L")
|
||||
LONG_LITERAL("-0x8000000000000000L")
|
||||
LONG_LITERAL("-0x1fffffffffffffffL")
|
||||
INTEGER_LITERAL("-0x8000000000000001")
|
||||
INTEGER_LITERAL("-0xFFFFFFFFFFFFFFFF")
|
||||
INTEGER_LITERAL("0x10000000000000000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x8000000000000001")
|
||||
NEGATIVE_INTEGER_LITERAL("-0xFFFFFFFFFFFFFFFF")
|
||||
POSITIVE_INTEGER_LITERAL("0x10000000000000000")
|
||||
LONG_LITERAL("0L")
|
||||
INTEGER_LITERAL("1")
|
||||
INTEGER_LITERAL("1234567890123456789")
|
||||
POSITIVE_INTEGER_LITERAL("1")
|
||||
POSITIVE_INTEGER_LITERAL("1234567890123456789")
|
||||
LONG_LITERAL("1234567890123456789L")
|
||||
INTEGER_LITERAL("9223372036854775807")
|
||||
INTEGER_LITERAL("9223372036854775808")
|
||||
POSITIVE_INTEGER_LITERAL("9223372036854775807")
|
||||
POSITIVE_INTEGER_LITERAL("9223372036854775808")
|
||||
LONG_LITERAL("18446744073709551615L")
|
||||
INTEGER_LITERAL("-0")
|
||||
INTEGER_LITERAL("-1")
|
||||
INTEGER_LITERAL("-1234567890123456789")
|
||||
NEGATIVE_INTEGER_LITERAL("-0")
|
||||
NEGATIVE_INTEGER_LITERAL("-1")
|
||||
NEGATIVE_INTEGER_LITERAL("-1234567890123456789")
|
||||
LONG_LITERAL("-1234567890123456789L")
|
||||
INTEGER_LITERAL("-9223372036854775807")
|
||||
INTEGER_LITERAL("-9223372036854775808")
|
||||
INTEGER_LITERAL("-9223372036854775809")
|
||||
INTEGER_LITERAL("-18446744073709551616")
|
||||
INTEGER_LITERAL("18446744073709551617")
|
||||
INTEGER_LITERAL("18446744073709551700")
|
||||
INTEGER_LITERAL("00")
|
||||
INTEGER_LITERAL("01")
|
||||
INTEGER_LITERAL("0123456701234567012345")
|
||||
NEGATIVE_INTEGER_LITERAL("-9223372036854775807")
|
||||
NEGATIVE_INTEGER_LITERAL("-9223372036854775808")
|
||||
NEGATIVE_INTEGER_LITERAL("-9223372036854775809")
|
||||
NEGATIVE_INTEGER_LITERAL("-18446744073709551616")
|
||||
POSITIVE_INTEGER_LITERAL("18446744073709551617")
|
||||
POSITIVE_INTEGER_LITERAL("18446744073709551700")
|
||||
POSITIVE_INTEGER_LITERAL("00")
|
||||
POSITIVE_INTEGER_LITERAL("01")
|
||||
POSITIVE_INTEGER_LITERAL("0123456701234567012345")
|
||||
LONG_LITERAL("0123456701234567012345L")
|
||||
INTEGER_LITERAL("0777777777777777777777")
|
||||
INTEGER_LITERAL("0100000000000000000000")
|
||||
INTEGER_LITERAL("0177777777777777777777")
|
||||
INTEGER_LITERAL("-00")
|
||||
INTEGER_LITERAL("-01")
|
||||
INTEGER_LITERAL("-0123456701234567012345")
|
||||
POSITIVE_INTEGER_LITERAL("0777777777777777777777")
|
||||
POSITIVE_INTEGER_LITERAL("0100000000000000000000")
|
||||
POSITIVE_INTEGER_LITERAL("0177777777777777777777")
|
||||
NEGATIVE_INTEGER_LITERAL("-00")
|
||||
NEGATIVE_INTEGER_LITERAL("-01")
|
||||
NEGATIVE_INTEGER_LITERAL("-0123456701234567012345")
|
||||
LONG_LITERAL("-0123456701234567012345L")
|
||||
INTEGER_LITERAL("-0777777777777777777777")
|
||||
INTEGER_LITERAL("-0100000000000000000000")
|
||||
INTEGER_LITERAL("-0100000000000000000001")
|
||||
INTEGER_LITERAL("-0177777777777777777777")
|
||||
INTEGER_LITERAL("-02000000000000000000000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0777777777777777777777")
|
||||
NEGATIVE_INTEGER_LITERAL("-0100000000000000000000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0100000000000000000001")
|
||||
NEGATIVE_INTEGER_LITERAL("-0177777777777777777777")
|
||||
NEGATIVE_INTEGER_LITERAL("-02000000000000000000000")
|
@ -74,5 +74,5 @@ OFFSET("+0777")
|
||||
OFFSET("+0x1234ABC")
|
||||
OFFSET("+1234")
|
||||
|
||||
OFFSET("+0") INTEGER_LITERAL("8")
|
||||
OFFSET("+0") POSITIVE_INTEGER_LITERAL("8")
|
||||
INVALID_TOKEN("+")
|
@ -21,7 +21,7 @@ SIMPLE_NAME("CARD_MAX_APPS")
|
||||
COLON(":")
|
||||
PRIMITIVE_TYPE("I")
|
||||
EQUAL("=")
|
||||
INTEGER_LITERAL("0x8")
|
||||
POSITIVE_INTEGER_LITERAL("0x8")
|
||||
FIELD_DIRECTIVE(".field")
|
||||
SIMPLE_NAME("mWifiOnUid")
|
||||
COLON(":")
|
||||
@ -157,14 +157,14 @@ OPEN_PAREN("(")
|
||||
CLOSE_PAREN(")")
|
||||
VOID_TYPE("V")
|
||||
REGISTERS_DIRECTIVE(".registers")
|
||||
INTEGER_LITERAL("1")
|
||||
POSITIVE_INTEGER_LITERAL("1")
|
||||
PROLOGUE_DIRECTIVE(".prologue")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("180")
|
||||
POSITIVE_INTEGER_LITERAL("180")
|
||||
INSTRUCTION_FORMAT11n("const/4")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
INTEGER_LITERAL("0x0")
|
||||
POSITIVE_INTEGER_LITERAL("0x0")
|
||||
INSTRUCTION_FORMAT21c_FIELD("sput")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
@ -174,11 +174,11 @@ SIMPLE_NAME("sKernelWakelockUpdateVersion")
|
||||
COLON(":")
|
||||
PRIMITIVE_TYPE("I")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("182")
|
||||
POSITIVE_INTEGER_LITERAL("182")
|
||||
INSTRUCTION_FORMAT11n("const/4")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
INTEGER_LITERAL("0x6")
|
||||
POSITIVE_INTEGER_LITERAL("0x6")
|
||||
INSTRUCTION_FORMAT22c_TYPE("new-array")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
@ -199,7 +199,7 @@ SIMPLE_NAME("PROC_WAKELOCKS_FORMAT")
|
||||
COLON(":")
|
||||
ARRAY_DESCRIPTOR("[I")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("3495")
|
||||
POSITIVE_INTEGER_LITERAL("3495")
|
||||
INSTRUCTION_FORMAT21c_TYPE("new-instance")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
@ -225,12 +225,12 @@ COLON(":")
|
||||
CLASS_DESCRIPTOR("Landroid/os/Parcelable$Creator;")
|
||||
INSTRUCTION_FORMAT10x("return-void")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("182")
|
||||
POSITIVE_INTEGER_LITERAL("182")
|
||||
INSTRUCTION_FORMAT10x("nop")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("array_14")
|
||||
ARRAY_DATA_DIRECTIVE(".array-data")
|
||||
INTEGER_LITERAL("0x4")
|
||||
POSITIVE_INTEGER_LITERAL("0x4")
|
||||
BYTE_LITERAL("0x9t")
|
||||
BYTE_LITERAL("0x10t")
|
||||
BYTE_LITERAL("0x0t")
|
||||
@ -265,12 +265,12 @@ CLASS_DESCRIPTOR("Lcom/android/internal/telephony/cdma/CDMAPhone;")
|
||||
CLOSE_PAREN(")")
|
||||
VOID_TYPE("V")
|
||||
REGISTERS_DIRECTIVE(".registers")
|
||||
INTEGER_LITERAL("2")
|
||||
POSITIVE_INTEGER_LITERAL("2")
|
||||
PARAMETER_DIRECTIVE(".parameter")
|
||||
STRING_LITERAL("\"phone\"")
|
||||
PROLOGUE_DIRECTIVE(".prologue")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("42")
|
||||
POSITIVE_INTEGER_LITERAL("42")
|
||||
INSTRUCTION_FORMAT35c_METHOD("invoke-direct")
|
||||
OPEN_BRACE("{")
|
||||
REGISTER("p0")
|
||||
@ -286,7 +286,7 @@ CLASS_DESCRIPTOR("Lcom/android/internal/telephony/PhoneBase;")
|
||||
CLOSE_PAREN(")")
|
||||
VOID_TYPE("V")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("43")
|
||||
POSITIVE_INTEGER_LITERAL("43")
|
||||
INSTRUCTION_FORMAT10x("return-void")
|
||||
END_METHOD_DIRECTIVE(".end method")
|
||||
METHOD_DIRECTIVE(".method")
|
||||
@ -297,19 +297,19 @@ PRIMITIVE_TYPE("I")
|
||||
CLOSE_PAREN(")")
|
||||
CLASS_DESCRIPTOR("Ljava/lang/String;")
|
||||
REGISTERS_DIRECTIVE(".registers")
|
||||
INTEGER_LITERAL("3")
|
||||
POSITIVE_INTEGER_LITERAL("3")
|
||||
PARAMETER_DIRECTIVE(".parameter")
|
||||
STRING_LITERAL("\"efid\"")
|
||||
PROLOGUE_DIRECTIVE(".prologue")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("71")
|
||||
POSITIVE_INTEGER_LITERAL("71")
|
||||
INSTRUCTION_FORMAT31t("sparse-switch")
|
||||
REGISTER("p1")
|
||||
COMMA(",")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_data_c")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("77")
|
||||
POSITIVE_INTEGER_LITERAL("77")
|
||||
INSTRUCTION_FORMAT35c_METHOD("invoke-virtual")
|
||||
OPEN_BRACE("{")
|
||||
REGISTER("p0")
|
||||
@ -331,7 +331,7 @@ SIMPLE_NAME("goto_7")
|
||||
INSTRUCTION_FORMAT11x("return-object")
|
||||
REGISTER("v0")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("75")
|
||||
POSITIVE_INTEGER_LITERAL("75")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_8")
|
||||
INSTRUCTION_FORMAT21c_STRING("const-string")
|
||||
@ -342,20 +342,20 @@ INSTRUCTION_FORMAT10t("goto")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("goto_7")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("71")
|
||||
POSITIVE_INTEGER_LITERAL("71")
|
||||
INSTRUCTION_FORMAT10x("nop")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_data_c")
|
||||
SPARSE_SWITCH_DIRECTIVE(".sparse-switch")
|
||||
INTEGER_LITERAL("0x6f32")
|
||||
POSITIVE_INTEGER_LITERAL("0x6f32")
|
||||
ARROW("->")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_8")
|
||||
INTEGER_LITERAL("0x6f3c")
|
||||
POSITIVE_INTEGER_LITERAL("0x6f3c")
|
||||
ARROW("->")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_8")
|
||||
INTEGER_LITERAL("0x6f41")
|
||||
POSITIVE_INTEGER_LITERAL("0x6f41")
|
||||
ARROW("->")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("sswitch_8")
|
||||
@ -368,19 +368,19 @@ PRIMITIVE_TYPE("I")
|
||||
CLOSE_PAREN(")")
|
||||
CLASS_DESCRIPTOR("Lcom/android/internal/telephony/IccCardStatus$CardState;")
|
||||
REGISTERS_DIRECTIVE(".registers")
|
||||
INTEGER_LITERAL("6")
|
||||
POSITIVE_INTEGER_LITERAL("6")
|
||||
PARAMETER_DIRECTIVE(".parameter")
|
||||
STRING_LITERAL("\"state\"")
|
||||
PROLOGUE_DIRECTIVE(".prologue")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("59")
|
||||
POSITIVE_INTEGER_LITERAL("59")
|
||||
INSTRUCTION_FORMAT31t("packed-switch")
|
||||
REGISTER("p1")
|
||||
COMMA(",")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("pswitch_data_26")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("64")
|
||||
POSITIVE_INTEGER_LITERAL("64")
|
||||
INSTRUCTION_FORMAT21c_TYPE("new-instance")
|
||||
REGISTER("v1")
|
||||
COMMA(",")
|
||||
@ -466,7 +466,7 @@ VOID_TYPE("V")
|
||||
INSTRUCTION_FORMAT11x("throw")
|
||||
REGISTER("v1")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("60")
|
||||
POSITIVE_INTEGER_LITERAL("60")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("pswitch_1c")
|
||||
INSTRUCTION_FORMAT21c_FIELD("sget-object")
|
||||
@ -478,7 +478,7 @@ SIMPLE_NAME("CARDSTATE_ABSENT")
|
||||
COLON(":")
|
||||
CLASS_DESCRIPTOR("Lcom/android/internal/telephony/IccCardStatus$CardState;")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("67")
|
||||
POSITIVE_INTEGER_LITERAL("67")
|
||||
LOCAL_DIRECTIVE(".local")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
@ -490,7 +490,7 @@ SIMPLE_NAME("goto_1e")
|
||||
INSTRUCTION_FORMAT11x("return-object")
|
||||
REGISTER("v0")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("61")
|
||||
POSITIVE_INTEGER_LITERAL("61")
|
||||
END_LOCAL_DIRECTIVE(".end local")
|
||||
REGISTER("v0")
|
||||
COLON(":")
|
||||
@ -509,7 +509,7 @@ INSTRUCTION_FORMAT10t("goto")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("goto_1e")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("62")
|
||||
POSITIVE_INTEGER_LITERAL("62")
|
||||
END_LOCAL_DIRECTIVE(".end local")
|
||||
REGISTER("v0")
|
||||
COLON(":")
|
||||
@ -528,12 +528,12 @@ INSTRUCTION_FORMAT10t("goto")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("goto_1e")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("59")
|
||||
POSITIVE_INTEGER_LITERAL("59")
|
||||
INSTRUCTION_FORMAT10x("nop")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("pswitch_data_26")
|
||||
PACKED_SWITCH_DIRECTIVE(".packed-switch")
|
||||
INTEGER_LITERAL("0x0")
|
||||
POSITIVE_INTEGER_LITERAL("0x0")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("pswitch_1c")
|
||||
COLON(":")
|
||||
@ -550,7 +550,7 @@ PARAM_LIST("IILjava/lang/String;ILandroid/os/Message;")
|
||||
CLOSE_PAREN(")")
|
||||
VOID_TYPE("V")
|
||||
REGISTERS_DIRECTIVE(".registers")
|
||||
INTEGER_LITERAL("13")
|
||||
POSITIVE_INTEGER_LITERAL("13")
|
||||
PARAMETER_DIRECTIVE(".parameter")
|
||||
STRING_LITERAL("\"commandInterfaceCFAction\"")
|
||||
PARAMETER_DIRECTIVE(".parameter")
|
||||
@ -565,13 +565,13 @@ PROLOGUE_DIRECTIVE(".prologue")
|
||||
INSTRUCTION_FORMAT11n("const/4")
|
||||
REGISTER("v3")
|
||||
COMMA(",")
|
||||
INTEGER_LITERAL("0x1")
|
||||
POSITIVE_INTEGER_LITERAL("0x1")
|
||||
INSTRUCTION_FORMAT11n("const/4")
|
||||
REGISTER("v4")
|
||||
COMMA(",")
|
||||
INTEGER_LITERAL("0x0")
|
||||
POSITIVE_INTEGER_LITERAL("0x0")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("981")
|
||||
POSITIVE_INTEGER_LITERAL("981")
|
||||
INSTRUCTION_FORMAT35c_METHOD("invoke-direct")
|
||||
OPEN_BRACE("{")
|
||||
REGISTER("p0")
|
||||
@ -615,14 +615,14 @@ COMMA(",")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("cond_28")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("985")
|
||||
POSITIVE_INTEGER_LITERAL("985")
|
||||
INSTRUCTION_FORMAT21t("if-nez")
|
||||
REGISTER("p2")
|
||||
COMMA(",")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("cond_2b")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("986")
|
||||
POSITIVE_INTEGER_LITERAL("986")
|
||||
INSTRUCTION_FORMAT22c_FIELD("iget-object")
|
||||
REGISTER("v0")
|
||||
COMMA(",")
|
||||
@ -636,7 +636,7 @@ CLASS_DESCRIPTOR("Lcom/android/internal/telephony/gsm/GSMPhone$MyHandler;")
|
||||
INSTRUCTION_FORMAT21s("const/16")
|
||||
REGISTER("v1")
|
||||
COMMA(",")
|
||||
INTEGER_LITERAL("0xc")
|
||||
POSITIVE_INTEGER_LITERAL("0xc")
|
||||
INSTRUCTION_FORMAT35c_METHOD("invoke-virtual")
|
||||
OPEN_BRACE("{")
|
||||
REGISTER("p0")
|
||||
@ -687,7 +687,7 @@ CLASS_DESCRIPTOR("Landroid/os/Message;")
|
||||
INSTRUCTION_FORMAT11x("move-result-object")
|
||||
REGISTER("v6")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("991")
|
||||
POSITIVE_INTEGER_LITERAL("991")
|
||||
LOCAL_DIRECTIVE(".local")
|
||||
REGISTER("v6")
|
||||
COMMA(",")
|
||||
@ -737,7 +737,7 @@ PARAM_LIST("IIILjava/lang/String;ILandroid/os/Message;")
|
||||
CLOSE_PAREN(")")
|
||||
VOID_TYPE("V")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("998")
|
||||
POSITIVE_INTEGER_LITERAL("998")
|
||||
END_LOCAL_DIRECTIVE(".end local")
|
||||
REGISTER("v6")
|
||||
COLON(":")
|
||||
@ -750,12 +750,12 @@ REGISTER("v2")
|
||||
COMMA(",")
|
||||
REGISTER("v4")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("986")
|
||||
POSITIVE_INTEGER_LITERAL("986")
|
||||
INSTRUCTION_FORMAT10t("goto")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("goto_1b")
|
||||
LINE_DIRECTIVE(".line")
|
||||
INTEGER_LITERAL("989")
|
||||
POSITIVE_INTEGER_LITERAL("989")
|
||||
COLON(":")
|
||||
SIMPLE_NAME("cond_2b")
|
||||
INSTRUCTION_FORMAT12x_OR_ID("move-object")
|
||||
|
@ -1,49 +1,49 @@
|
||||
SHORT_LITERAL("0x0S")
|
||||
INTEGER_LITERAL("0x00")
|
||||
POSITIVE_INTEGER_LITERAL("0x00")
|
||||
SHORT_LITERAL("0x1s")
|
||||
INTEGER_LITERAL("0x1234")
|
||||
POSITIVE_INTEGER_LITERAL("0x1234")
|
||||
SHORT_LITERAL("0x7fffS")
|
||||
SHORT_LITERAL("0x8000s")
|
||||
INTEGER_LITERAL("0xFFFF")
|
||||
INTEGER_LITERAL("-0x00")
|
||||
INTEGER_LITERAL("-0x01")
|
||||
INTEGER_LITERAL("-01234")
|
||||
POSITIVE_INTEGER_LITERAL("0xFFFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x00")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x01")
|
||||
NEGATIVE_INTEGER_LITERAL("-01234")
|
||||
SHORT_LITERAL("-01234s")
|
||||
INTEGER_LITERAL("-0x8000")
|
||||
INTEGER_LITERAL("-0x1fff")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x8000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x1fff")
|
||||
SHORT_LITERAL("-0x1fffS")
|
||||
INTEGER_LITERAL("-0x8001")
|
||||
INTEGER_LITERAL("-0xFFFF")
|
||||
INTEGER_LITERAL("-0x100000")
|
||||
INTEGER_LITERAL("0")
|
||||
INTEGER_LITERAL("1")
|
||||
INTEGER_LITERAL("12345")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x8001")
|
||||
NEGATIVE_INTEGER_LITERAL("-0xFFFF")
|
||||
NEGATIVE_INTEGER_LITERAL("-0x100000")
|
||||
POSITIVE_INTEGER_LITERAL("0")
|
||||
POSITIVE_INTEGER_LITERAL("1")
|
||||
POSITIVE_INTEGER_LITERAL("12345")
|
||||
SHORT_LITERAL("12345s")
|
||||
INTEGER_LITERAL("32767")
|
||||
INTEGER_LITERAL("32678")
|
||||
POSITIVE_INTEGER_LITERAL("32767")
|
||||
POSITIVE_INTEGER_LITERAL("32678")
|
||||
SHORT_LITERAL("65535S")
|
||||
INTEGER_LITERAL("-0")
|
||||
INTEGER_LITERAL("-1")
|
||||
NEGATIVE_INTEGER_LITERAL("-0")
|
||||
NEGATIVE_INTEGER_LITERAL("-1")
|
||||
SHORT_LITERAL("-12345S")
|
||||
INTEGER_LITERAL("-32767")
|
||||
NEGATIVE_INTEGER_LITERAL("-32767")
|
||||
SHORT_LITERAL("-32768s")
|
||||
SHORT_LITERAL("-32679s")
|
||||
SHORT_LITERAL("-65535s")
|
||||
INTEGER_LITERAL("65536")
|
||||
INTEGER_LITERAL("65600")
|
||||
INTEGER_LITERAL("00")
|
||||
INTEGER_LITERAL("01")
|
||||
INTEGER_LITERAL("012345")
|
||||
POSITIVE_INTEGER_LITERAL("65536")
|
||||
POSITIVE_INTEGER_LITERAL("65600")
|
||||
POSITIVE_INTEGER_LITERAL("00")
|
||||
POSITIVE_INTEGER_LITERAL("01")
|
||||
POSITIVE_INTEGER_LITERAL("012345")
|
||||
SHORT_LITERAL("012345s")
|
||||
INTEGER_LITERAL("077777")
|
||||
INTEGER_LITERAL("0100000")
|
||||
INTEGER_LITERAL("0177777")
|
||||
INTEGER_LITERAL("-00")
|
||||
INTEGER_LITERAL("-01")
|
||||
INTEGER_LITERAL("-012345")
|
||||
POSITIVE_INTEGER_LITERAL("077777")
|
||||
POSITIVE_INTEGER_LITERAL("0100000")
|
||||
POSITIVE_INTEGER_LITERAL("0177777")
|
||||
NEGATIVE_INTEGER_LITERAL("-00")
|
||||
NEGATIVE_INTEGER_LITERAL("-01")
|
||||
NEGATIVE_INTEGER_LITERAL("-012345")
|
||||
SHORT_LITERAL("-012345S")
|
||||
INTEGER_LITERAL("-077777")
|
||||
INTEGER_LITERAL("-0100000")
|
||||
INTEGER_LITERAL("-0100001")
|
||||
INTEGER_LITERAL("-0177777")
|
||||
INTEGER_LITERAL("0200000")
|
||||
NEGATIVE_INTEGER_LITERAL("-077777")
|
||||
NEGATIVE_INTEGER_LITERAL("-0100000")
|
||||
NEGATIVE_INTEGER_LITERAL("-0100001")
|
||||
NEGATIVE_INTEGER_LITERAL("-0177777")
|
||||
POSITIVE_INTEGER_LITERAL("0200000")
|
@ -85,19 +85,19 @@ class RadixTreeNode<T> {
|
||||
this.childern = childern;
|
||||
}
|
||||
|
||||
public int getNumberOfMatchingCharacters(String key) {
|
||||
int numberOfMatchingCharacters = 0;
|
||||
public int getNumberOfMatchingCharacters(String key) {
|
||||
int numberOfMatchingCharacters = 0;
|
||||
while (numberOfMatchingCharacters < key.length() && numberOfMatchingCharacters < this.getKey().length()) {
|
||||
if (key.charAt(numberOfMatchingCharacters) != this.getKey().charAt(numberOfMatchingCharacters)) {
|
||||
break;
|
||||
}
|
||||
numberOfMatchingCharacters++;
|
||||
}
|
||||
return numberOfMatchingCharacters;
|
||||
}
|
||||
return numberOfMatchingCharacters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return key;
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
@ -11,17 +11,17 @@ public abstract class VisitorImpl<T, R> implements Visitor<T, R> {
|
||||
|
||||
protected R result;
|
||||
|
||||
public VisitorImpl() {
|
||||
this.result = null;
|
||||
}
|
||||
public VisitorImpl() {
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
public VisitorImpl(R initialValue) {
|
||||
this.result = initialValue;
|
||||
}
|
||||
public VisitorImpl(R initialValue) {
|
||||
this.result = initialValue;
|
||||
}
|
||||
|
||||
public R getResult() {
|
||||
return result;
|
||||
}
|
||||
public R getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
abstract public void visit(String key, RadixTreeNode<T> parent, RadixTreeNode<T> node);
|
||||
abstract public void visit(String key, RadixTreeNode<T> parent, RadixTreeNode<T> node);
|
||||
}
|
@ -114,7 +114,7 @@ public class ClassFileNameHandler {
|
||||
|
||||
try {
|
||||
FileWriter writer = new FileWriter(f);
|
||||
//writer.write("test");
|
||||
writer.write("test");
|
||||
writer.flush();
|
||||
writer.close();
|
||||
f.delete(); //doesn't throw IOException
|
||||
|
@ -465,6 +465,7 @@ public class Androlib {
|
||||
|
||||
// add res folder
|
||||
editOrig.addFolder(new File(appDir, APK_DIRNAME + "/res").getAbsolutePath(), parameters);
|
||||
System.out.println("file: " + new File(appDir, APK_DIRNAME + "/res").getAbsolutePath());
|
||||
|
||||
// add assets, if there
|
||||
if (assetDir != null) {
|
||||
|
@ -38,26 +38,17 @@ public class SmaliMod {
|
||||
boolean lexerErrors = false;
|
||||
LexerErrorInterface lexer;
|
||||
|
||||
if (oldLexer) {
|
||||
ANTLRInputStream input = new ANTLRInputStream(smaliStream, "UTF-8");
|
||||
input.name = name;
|
||||
InputStreamReader reader = new InputStreamReader(smaliStream, "UTF-8");
|
||||
|
||||
lexer = new smaliLexer(input);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
} else {
|
||||
InputStreamReader reader =
|
||||
new InputStreamReader(smaliStream, "UTF-8");
|
||||
|
||||
lexer = new smaliFlexLexer(reader);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
}
|
||||
lexer = new smaliFlexLexer(reader);
|
||||
tokens = new CommonTokenStream((TokenSource)lexer);
|
||||
|
||||
if (printTokens) {
|
||||
tokens.getTokens();
|
||||
|
||||
for (int i=0; i<tokens.size(); i++) {
|
||||
Token token = tokens.get(i);
|
||||
if (token.getChannel() == smaliLexer.HIDDEN) {
|
||||
if (token.getChannel() == smaliParser.HIDDEN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user