mirror of
https://github.com/revanced/smali.git
synced 2025-05-29 20:20:12 +02:00
Improve error recovery when missing an .end packed-switch
This commit is contained in:
parent
da28228d69
commit
3abee993db
@ -1320,7 +1320,15 @@ insn_packed_switch_directive
|
|||||||
: PACKED_SWITCH_DIRECTIVE
|
: PACKED_SWITCH_DIRECTIVE
|
||||||
fixed_32bit_literal
|
fixed_32bit_literal
|
||||||
packed_switch_element*
|
packed_switch_element*
|
||||||
END_PACKED_SWITCH_DIRECTIVE;
|
end_packed_switch_directive;
|
||||||
|
|
||||||
|
end_packed_switch_directive
|
||||||
|
: END_PACKED_SWITCH_DIRECTIVE;
|
||||||
|
catch [RecognitionException re] {
|
||||||
|
Marker errorMarker = mark();
|
||||||
|
recover(input, re);
|
||||||
|
reportError(errorMarker, re, false);
|
||||||
|
}
|
||||||
|
|
||||||
packed_switch_element
|
packed_switch_element
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
|
@ -13,4 +13,11 @@ invoke-virtual {v1, v2} .blah Lblah;->blah()V
|
|||||||
1
|
1
|
||||||
2
|
2
|
||||||
.blah
|
.blah
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method blah4()V
|
||||||
|
.packed-switch 1
|
||||||
|
:blah
|
||||||
|
:blah2
|
||||||
|
.blah
|
||||||
.end method
|
.end method
|
@ -140,4 +140,42 @@ smali.FILE
|
|||||||
PsiErrorElement:mismatched input '.blah' expecting END_ARRAY_DATA_DIRECTIVE
|
PsiErrorElement:mismatched input '.blah' expecting END_ARRAY_DATA_DIRECTIVE
|
||||||
PsiElement(BAD_CHARACTER)('.blah')
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(END_METHOD_DIRECTIVE)('.end method')
|
||||||
|
PsiWhiteSpace('\n\n')
|
||||||
|
SmaliMethod(METHOD)
|
||||||
|
SmaliThrowsList(THROWS_LIST)
|
||||||
|
<empty list>
|
||||||
|
PsiElement(METHOD_DIRECTIVE)('.method')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
SmaliModifierList(MODIFIER_LIST)
|
||||||
|
<empty list>
|
||||||
|
PsiElement(MEMBER_NAME)
|
||||||
|
PsiElement(SIMPLE_NAME)('blah4')
|
||||||
|
SmaliMethodPrototype(METHOD_PROTOTYPE)
|
||||||
|
PsiElement(OPEN_PAREN)('(')
|
||||||
|
SmaliMethodParamList(METHOD_PARAM_LIST)
|
||||||
|
<empty list>
|
||||||
|
PsiElement(CLOSE_PAREN)(')')
|
||||||
|
PsiElement(VOID_TYPE)
|
||||||
|
PsiElement(VOID_TYPE)('V')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(INSTRUCTION)
|
||||||
|
PsiElement(PACKED_SWITCH_DIRECTIVE)('.packed-switch')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(POSITIVE_INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(PACKED_SWITCH_ELEMENT)
|
||||||
|
PsiElement(LABEL_REFERENCE)
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiElement(SIMPLE_NAME)('blah')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(PACKED_SWITCH_ELEMENT)
|
||||||
|
PsiElement(LABEL_REFERENCE)
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiElement(SIMPLE_NAME)('blah2')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiErrorElement:mismatched input '.blah' expecting END_PACKED_SWITCH_DIRECTIVE
|
||||||
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(END_METHOD_DIRECTIVE)('.end method')
|
PsiElement(END_METHOD_DIRECTIVE)('.end method')
|
Loading…
x
Reference in New Issue
Block a user