The great tab cleanup of 2012

This commit is contained in:
Ben Gruver 2012-09-23 21:16:21 -07:00
parent 8d299c0222
commit 40c48da564
5 changed files with 1952 additions and 1944 deletions

View File

@ -1156,12 +1156,14 @@ insn_packed_switch_directive returns [int size]
-> {needsNop}? ^(I_STATEMENT_FORMAT10x[$start, "I_STATEMENT_FORMAT10x"] INSTRUCTION_FORMAT10x[$start, "nop"]) -> {needsNop}? ^(I_STATEMENT_FORMAT10x[$start, "I_STATEMENT_FORMAT10x"] INSTRUCTION_FORMAT10x[$start, "nop"])
^(I_STATEMENT_PACKED_SWITCH[$start, "I_STATEMENT_PACKED_SWITCH"] ^(I_STATEMENT_PACKED_SWITCH[$start, "I_STATEMENT_PACKED_SWITCH"]
^(I_PACKED_SWITCH_START_KEY[$start, "I_PACKED_SWITCH_START_KEY"] fixed_32bit_literal) ^(I_PACKED_SWITCH_START_KEY[$start, "I_PACKED_SWITCH_START_KEY"] fixed_32bit_literal)
^(I_PACKED_SWITCH_TARGETS[$start, "I_PACKED_SWITCH_TARGETS"] I_PACKED_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] $switch_target*) ^(I_PACKED_SWITCH_TARGETS[$start, "I_PACKED_SWITCH_TARGETS"]
I_PACKED_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] $switch_target*)
) )
-> ^(I_STATEMENT_PACKED_SWITCH[$start, "I_STATEMENT_PACKED_SWITCH"] -> ^(I_STATEMENT_PACKED_SWITCH[$start, "I_STATEMENT_PACKED_SWITCH"]
^(I_PACKED_SWITCH_START_KEY[$start, "I_PACKED_SWITCH_START_KEY"] fixed_32bit_literal) ^(I_PACKED_SWITCH_START_KEY[$start, "I_PACKED_SWITCH_START_KEY"] fixed_32bit_literal)
^(I_PACKED_SWITCH_TARGETS[$start, "I_PACKED_SWITCH_TARGETS"] I_PACKED_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] $switch_target*) ^(I_PACKED_SWITCH_TARGETS[$start, "I_PACKED_SWITCH_TARGETS"]
I_PACKED_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] $switch_target*)
); );
insn_sparse_switch_directive returns [int size] insn_sparse_switch_directive returns [int size]
@ -1182,11 +1184,14 @@ insn_sparse_switch_directive returns [int size]
END_SPARSE_SWITCH_DIRECTIVE {$size = $size + 4;} END_SPARSE_SWITCH_DIRECTIVE {$size = $size + 4;}
/*add a nop statement before this if needed to force the correct alignment*/ /*add a nop statement before this if needed to force the correct alignment*/
-> {needsNop}? ^(I_STATEMENT_FORMAT10x[$start, "I_STATEMENT_FORMAT10x"] INSTRUCTION_FORMAT10x[$start, "nop"]) -> {needsNop}?
^(I_STATEMENT_FORMAT10x[$start, "I_STATEMENT_FORMAT10x"] INSTRUCTION_FORMAT10x[$start, "nop"])
^(I_STATEMENT_SPARSE_SWITCH[$start, "I_STATEMENT_SPARSE_SWITCH"] ^(I_STATEMENT_SPARSE_SWITCH[$start, "I_STATEMENT_SPARSE_SWITCH"]
I_SPARSE_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] I_SPARSE_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)]
^(I_SPARSE_SWITCH_KEYS[$start, "I_SPARSE_SWITCH_KEYS"] fixed_32bit_literal*) ^(I_SPARSE_SWITCH_KEYS[$start, "I_SPARSE_SWITCH_KEYS"] fixed_32bit_literal*)
^(I_SPARSE_SWITCH_TARGETS $switch_target*)) ^(I_SPARSE_SWITCH_TARGETS $switch_target*)
)
-> ^(I_STATEMENT_SPARSE_SWITCH[$start, "I_STATEMENT_SPARSE_SWITCH"] -> ^(I_STATEMENT_SPARSE_SWITCH[$start, "I_STATEMENT_SPARSE_SWITCH"]
I_SPARSE_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)] I_SPARSE_SWITCH_TARGET_COUNT[$start, Integer.toString(targetCount)]
^(I_SPARSE_SWITCH_KEYS[$start, "I_SPARSE_SWITCH_KEYS"] fixed_32bit_literal*) ^(I_SPARSE_SWITCH_KEYS[$start, "I_SPARSE_SWITCH_KEYS"] fixed_32bit_literal*)

View File

@ -154,7 +154,7 @@ smali_file
ClassDefItem classDefItem = null; ClassDefItem classDefItem = null;
ClassDataItem classDataItem = null; ClassDataItem classDataItem = null;
if ( $methods.methodAnnotations != null || if ($methods.methodAnnotations != null ||
$methods.parameterAnnotations != null || $methods.parameterAnnotations != null ||
$fields.fieldAnnotations != null || $fields.fieldAnnotations != null ||
$annotations.annotationSetItem != null) { $annotations.annotationSetItem != null) {
@ -229,7 +229,7 @@ implements_list returns[TypeListItem implementsList]
source_spec returns[StringIdItem source] source_spec returns[StringIdItem source]
: {$source = null;} : {$source = null;}
^(I_SOURCE string_literal {$source = StringIdItem.internStringIdItem(dexFile, $string_literal.value);}) ^(I_SOURCE string_literal {$source = StringIdItem.internStringIdItem(dexFile, $string_literal.value);})
| ; | /*epsilon*/;
@ -338,7 +338,7 @@ field returns [ClassDataItem.EncodedField encodedField, EncodedValue encodedValu
field_initial_value returns[EncodedValue encodedValue] field_initial_value returns[EncodedValue encodedValue]
: ^(I_FIELD_INITIAL_VALUE literal) {$encodedValue = $literal.encodedValue;} : ^(I_FIELD_INITIAL_VALUE literal) {$encodedValue = $literal.encodedValue;}
| ; | /*epsilon*/;
literal returns[EncodedValue encodedValue] literal returns[EncodedValue encodedValue]
: integer_literal { $encodedValue = new IntEncodedValue($integer_literal.value); } : integer_literal { $encodedValue = new IntEncodedValue($integer_literal.value); }
@ -447,7 +447,7 @@ sparse_switch_targets[int baseAddress, int targetCount] returns[int[\] targets]
})* })*
); );
method returns[ ClassDataItem.EncodedMethod encodedMethod, method returns[ClassDataItem.EncodedMethod encodedMethod,
AnnotationSetItem methodAnnotationSet, AnnotationSetItem methodAnnotationSet,
AnnotationSetRefList parameterAnnotationSets] AnnotationSetRefList parameterAnnotationSets]
scope scope
@ -475,7 +475,7 @@ method returns[ ClassDataItem.EncodedMethod encodedMethod,
$method::packedSwitchDeclarations = new HashMap<Integer, Integer>(); $method::packedSwitchDeclarations = new HashMap<Integer, Integer>();
$method::sparseSwitchDeclarations = new HashMap<Integer, Integer>(); $method::sparseSwitchDeclarations = new HashMap<Integer, Integer>();
} }
^( I_METHOD ^(I_METHOD
method_name_and_prototype method_name_and_prototype
access_list access_list
{ {
@ -487,7 +487,7 @@ method returns[ ClassDataItem.EncodedMethod encodedMethod,
methodParameterRegisters++; methodParameterRegisters++;
} }
} }
( registers_directive (registers_directive
{ {
if ($registers_directive.isLocalsDirective) { if ($registers_directive.isLocalsDirective) {
totalMethodRegisters = $registers_directive.registers + methodParameterRegisters; totalMethodRegisters = $registers_directive.registers + methodParameterRegisters;
@ -658,7 +658,7 @@ fully_qualified_field returns[FieldIdItem fieldIdItem]
registers_directive returns[boolean isLocalsDirective, int registers] registers_directive returns[boolean isLocalsDirective, int registers]
: {$registers = 0;} : {$registers = 0;}
^( ( I_REGISTERS {$isLocalsDirective = false;} ^(( I_REGISTERS {$isLocalsDirective = false;}
| I_LOCALS {$isLocalsDirective = true;} | I_LOCALS {$isLocalsDirective = true;}
) )
short_integral_literal {$registers = $short_integral_literal.value;} short_integral_literal {$registers = $short_integral_literal.value;}
@ -674,7 +674,6 @@ label_def
throw new SemanticException(input, $I_LABEL, "Label " + $SIMPLE_NAME.text + " has multiple defintions."); throw new SemanticException(input, $I_LABEL, "Label " + $SIMPLE_NAME.text + " has multiple defintions.");
} }
$method::labels.put($SIMPLE_NAME.text, $address.address); $method::labels.put($SIMPLE_NAME.text, $address.address);
}; };
@ -766,21 +765,23 @@ parameters returns[AnnotationSetRefList parameterAnnotations]
}; };
parameter returns[AnnotationSetItem parameterAnnotationSet] parameter returns[AnnotationSetItem parameterAnnotationSet]
: ^(I_PARAMETER ( string_literal {$method::debugInfo.addParameterName($string_literal.value);} : ^(I_PARAMETER (string_literal {$method::debugInfo.addParameterName($string_literal.value);}
| {$method::debugInfo.addParameterName(null);} | {$method::debugInfo.addParameterName(null);}
) )
annotations {$parameterAnnotationSet = $annotations.annotationSetItem;} annotations {$parameterAnnotationSet = $annotations.annotationSetItem;}
); );
ordered_debug_directives[int totalMethodRegisters, int methodParameterRegisters] ordered_debug_directives[int totalMethodRegisters, int methodParameterRegisters]
: ^(I_ORDERED_DEBUG_DIRECTIVES ( line : ^(I_ORDERED_DEBUG_DIRECTIVES
( line
| local[$totalMethodRegisters, $methodParameterRegisters] | local[$totalMethodRegisters, $methodParameterRegisters]
| end_local[$totalMethodRegisters, $methodParameterRegisters] | end_local[$totalMethodRegisters, $methodParameterRegisters]
| restart_local[$totalMethodRegisters, $methodParameterRegisters] | restart_local[$totalMethodRegisters, $methodParameterRegisters]
| prologue | prologue
| epilogue | epilogue
| source | source
)*); )*
);
line line
: ^(I_LINE integral_literal address) : ^(I_LINE integral_literal address)
@ -1558,13 +1559,15 @@ annotation_element returns[StringIdItem elementName, EncodedValue elementValue]
subannotation returns[TypeIdItem annotationType, StringIdItem[\] elementNames, EncodedValue[\] elementValues] subannotation returns[TypeIdItem annotationType, StringIdItem[\] elementNames, EncodedValue[\] elementValues]
: {ArrayList<StringIdItem> elementNamesList = new ArrayList<StringIdItem>(); : {ArrayList<StringIdItem> elementNamesList = new ArrayList<StringIdItem>();
ArrayList<EncodedValue> elementValuesList = new ArrayList<EncodedValue>();} ArrayList<EncodedValue> elementValuesList = new ArrayList<EncodedValue>();}
^( I_SUBANNOTATION ^(I_SUBANNOTATION
class_type_descriptor class_type_descriptor
(annotation_element (annotation_element
{ {
elementNamesList.add($annotation_element.elementName); elementNamesList.add($annotation_element.elementName);
elementValuesList.add($annotation_element.elementValue); elementValuesList.add($annotation_element.elementValue);
} )* ) }
)*
)
{ {
$annotationType = $class_type_descriptor.type; $annotationType = $class_type_descriptor.type;
$elementNames = new StringIdItem[elementNamesList.size()]; $elementNames = new StringIdItem[elementNamesList.size()];