Use the SIMPLE_NAME token for label names, instead of creating a new LABEL token

git-svn-id: https://smali.googlecode.com/svn/trunk@712 55b6fa8a-2a1e-11de-a435-ffa8d773f76a
This commit is contained in:
JesusFreke@JesusFreke.com 2010-04-17 07:02:39 +00:00
parent 28a614553b
commit ec643e6520
2 changed files with 9 additions and 9 deletions

View File

@ -489,10 +489,10 @@ fully_qualified_field
-> reference_type_descriptor simple_name nonvoid_type_descriptor;
label
: COLON SIMPLE_NAME -> ^(I_LABEL LABEL[$SIMPLE_NAME] I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
: COLON simple_name -> ^(I_LABEL simple_name I_ADDRESS[$start, Integer.toString($method::currentAddress)]);
label_ref_or_offset
: COLON SIMPLE_NAME -> LABEL[$SIMPLE_NAME]
: COLON simple_name -> simple_name
| OFFSET
| NEGATIVE_INTEGER_LITERAL -> OFFSET[$NEGATIVE_INTEGER_LITERAL];

View File

@ -625,14 +625,14 @@ labels
: ^(I_LABELS label_def*);
label_def
: ^(I_LABEL LABEL address)
: ^(I_LABEL SIMPLE_NAME address)
{
if ($method::labels.containsKey($LABEL.text)) {
throw new SemanticException(input, "Label " + $LABEL.text + " has multiple defintions.");
if ($method::labels.containsKey($SIMPLE_NAME.text)) {
throw new SemanticException(input, "Label " + $SIMPLE_NAME.text + " has multiple defintions.");
}
$method::labels.put($LABEL.text, $address.address);
$method::labels.put($SIMPLE_NAME.text, $address.address);
};
packed_switch_declarations
@ -806,12 +806,12 @@ statements[int totalMethodRegisters, int methodParameterRegisters] returns[List<
})*);
label_ref returns[int labelAddress]
: LABEL
: SIMPLE_NAME
{
Integer labelAdd = $method::labels.get($LABEL.text);
Integer labelAdd = $method::labels.get($SIMPLE_NAME.text);
if (labelAdd == null) {
throw new SemanticException(input, "Label \"" + $LABEL.text + "\" is not defined.");
throw new SemanticException(input, "Label \"" + $SIMPLE_NAME.text + "\" is not defined.");
}
$labelAddress = labelAdd;