mirror of
https://github.com/revanced/smali.git
synced 2025-05-03 16:14:29 +02:00
Improve error recovery of arrow parsing
This commit is contained in:
parent
18ff2d8368
commit
1d3d657b7f
@ -650,7 +650,7 @@ array_literal
|
|||||||
|
|
||||||
enum_literal
|
enum_literal
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: ENUM_DIRECTIVE reference_type_descriptor ARROW simple_name COLON reference_type_descriptor
|
: ENUM_DIRECTIVE reference_type_descriptor arrow simple_name COLON reference_type_descriptor
|
||||||
{ marker.done(SmaliElementTypes.LITERAL); };
|
{ marker.done(SmaliElementTypes.LITERAL); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
@ -661,7 +661,7 @@ enum_literal
|
|||||||
type_field_method_literal
|
type_field_method_literal
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: ( reference_type_descriptor
|
: ( reference_type_descriptor
|
||||||
( ARROW
|
( arrow
|
||||||
( member_name COLON nonvoid_type_descriptor
|
( member_name COLON nonvoid_type_descriptor
|
||||||
| member_name method_prototype_reference
|
| member_name method_prototype_reference
|
||||||
)
|
)
|
||||||
@ -804,10 +804,18 @@ end_annotation_directive
|
|||||||
reportError(errorMarker, re, false);
|
reportError(errorMarker, re, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
arrow
|
||||||
|
: ARROW;
|
||||||
|
catch [RecognitionException re] {
|
||||||
|
Marker errorMarker = mark();
|
||||||
|
recover(input, re);
|
||||||
|
reportError(errorMarker, re, false);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: check missing initial token
|
// TODO: check missing initial token
|
||||||
fully_qualified_method
|
fully_qualified_method
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: reference_type_descriptor ARROW member_name method_prototype_reference
|
: reference_type_descriptor arrow member_name method_prototype_reference
|
||||||
{ marker.done(SmaliElementTypes.METHOD_REFERENCE); };
|
{ marker.done(SmaliElementTypes.METHOD_REFERENCE); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
@ -817,7 +825,7 @@ fully_qualified_method
|
|||||||
// TODO: check missing initial token
|
// TODO: check missing initial token
|
||||||
fully_qualified_field
|
fully_qualified_field
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: reference_type_descriptor ARROW member_name COLON nonvoid_type_descriptor
|
: reference_type_descriptor arrow member_name COLON nonvoid_type_descriptor
|
||||||
{ marker.done(SmaliElementTypes.FIELD_REFERENCE); };
|
{ marker.done(SmaliElementTypes.FIELD_REFERENCE); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
@ -1243,7 +1251,7 @@ insn_sparse_switch_directive
|
|||||||
|
|
||||||
sparse_switch_element
|
sparse_switch_element
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: fixed_32bit_literal ARROW label_ref
|
: fixed_32bit_literal arrow label_ref
|
||||||
{ marker.done(SmaliElementTypes.SPARSE_SWITCH_ELEMENT); };
|
{ marker.done(SmaliElementTypes.SPARSE_SWITCH_ELEMENT); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
|
@ -2,3 +2,8 @@
|
|||||||
.registers 1
|
.registers 1
|
||||||
invoke-virtual {v0}, .blah->
|
invoke-virtual {v0}, .blah->
|
||||||
.end method
|
.end method
|
||||||
|
|
||||||
|
.method blah2()V
|
||||||
|
.registers 1
|
||||||
|
invoke-virtual {v0}, Lblah;.blah
|
||||||
|
.end method
|
@ -44,3 +44,45 @@ smali.FILE
|
|||||||
PsiElement(MEMBER_NAME)
|
PsiElement(MEMBER_NAME)
|
||||||
<empty list>
|
<empty list>
|
||||||
PsiElement(END_METHOD_DIRECTIVE)('.end method')
|
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)('blah2')
|
||||||
|
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(REGISTERS_STATEMENT)
|
||||||
|
PsiElement(REGISTERS_DIRECTIVE)('.registers')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(POSITIVE_INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(INSTRUCTION)
|
||||||
|
PsiElement(INSTRUCTION_FORMAT35c_METHOD)('invoke-virtual')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(OPEN_BRACE)('{')
|
||||||
|
PsiElement(REGISTER_REFERENCE)
|
||||||
|
PsiElement(REGISTER)('v0')
|
||||||
|
PsiElement(CLOSE_BRACE)('}')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(METHOD_REFERENCE)
|
||||||
|
PsiElement(CLASS_TYPE)
|
||||||
|
PsiElement(CLASS_DESCRIPTOR)('Lblah;')
|
||||||
|
PsiErrorElement:mismatched input '.blah' expecting ARROW
|
||||||
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(MEMBER_NAME)
|
||||||
|
<empty list>
|
||||||
|
PsiElement(END_METHOD_DIRECTIVE)('.end method')
|
Loading…
x
Reference in New Issue
Block a user