mirror of
https://github.com/revanced/smali.git
synced 2025-05-01 23:24:38 +02:00
Improve error recovery when missing an .end sparse-switch
This commit is contained in:
parent
3abee993db
commit
698b799e4f
@ -1342,7 +1342,15 @@ packed_switch_element
|
|||||||
insn_sparse_switch_directive
|
insn_sparse_switch_directive
|
||||||
: SPARSE_SWITCH_DIRECTIVE
|
: SPARSE_SWITCH_DIRECTIVE
|
||||||
sparse_switch_element*
|
sparse_switch_element*
|
||||||
END_SPARSE_SWITCH_DIRECTIVE;
|
end_sparse_switch_directive;
|
||||||
|
|
||||||
|
end_sparse_switch_directive
|
||||||
|
: END_SPARSE_SWITCH_DIRECTIVE;
|
||||||
|
catch [RecognitionException re] {
|
||||||
|
Marker errorMarker = mark();
|
||||||
|
recover(input, re);
|
||||||
|
reportError(errorMarker, re, false);
|
||||||
|
}
|
||||||
|
|
||||||
sparse_switch_element
|
sparse_switch_element
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
|
@ -20,4 +20,12 @@ invoke-virtual {v1, v2} .blah Lblah;->blah()V
|
|||||||
:blah
|
:blah
|
||||||
:blah2
|
:blah2
|
||||||
.blah
|
.blah
|
||||||
|
.end method
|
||||||
|
|
||||||
|
.method blah5()V
|
||||||
|
.sparse-switch
|
||||||
|
1 -> :blah
|
||||||
|
3 -> :blah2
|
||||||
|
5 -> :blah3
|
||||||
|
.blah
|
||||||
.end method
|
.end method
|
@ -178,4 +178,59 @@ smali.FILE
|
|||||||
PsiErrorElement:mismatched input '.blah' expecting END_PACKED_SWITCH_DIRECTIVE
|
PsiErrorElement:mismatched input '.blah' expecting END_PACKED_SWITCH_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)('blah5')
|
||||||
|
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(SPARSE_SWITCH_DIRECTIVE)('.sparse-switch')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(SPARSE_SWITCH_ELEMENT)
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(POSITIVE_INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LABEL_REFERENCE)
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiElement(SIMPLE_NAME)('blah')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(SPARSE_SWITCH_ELEMENT)
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(POSITIVE_INTEGER_LITERAL)('3')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LABEL_REFERENCE)
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiElement(SIMPLE_NAME)('blah2')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(SPARSE_SWITCH_ELEMENT)
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(POSITIVE_INTEGER_LITERAL)('5')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LABEL_REFERENCE)
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiElement(SIMPLE_NAME)('blah3')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiErrorElement:mismatched input '.blah' expecting END_SPARSE_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