mirror of
https://github.com/revanced/smali.git
synced 2025-05-01 07:04:30 +02:00
Improve error handling for subannotation parsing
This commit is contained in:
parent
4640cc9c5b
commit
f35c18489b
@ -668,13 +668,21 @@ type_field_method_literal
|
|||||||
// TODO: check missing initial token
|
// TODO: check missing initial token
|
||||||
subannotation
|
subannotation
|
||||||
@init { Marker marker = mark(); }
|
@init { Marker marker = mark(); }
|
||||||
: SUBANNOTATION_DIRECTIVE class_descriptor annotation_element* END_SUBANNOTATION_DIRECTIVE
|
: SUBANNOTATION_DIRECTIVE class_descriptor annotation_element* end_subannotation_directive
|
||||||
{ marker.done(SmaliElementTypes.LITERAL); };
|
{ marker.done(SmaliElementTypes.LITERAL); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
reportError(marker, re, false);
|
reportError(marker, re, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end_subannotation_directive
|
||||||
|
: END_SUBANNOTATION_DIRECTIVE;
|
||||||
|
catch [RecognitionException re] {
|
||||||
|
Marker errorMarker = mark();
|
||||||
|
recover(input, re);
|
||||||
|
reportError(errorMarker, re, false);
|
||||||
|
}
|
||||||
|
|
||||||
literal
|
literal
|
||||||
: long_literal
|
: long_literal
|
||||||
| integer_literal
|
| integer_literal
|
||||||
|
@ -11,3 +11,9 @@
|
|||||||
.annotation runtime Lblah;
|
.annotation runtime Lblah;
|
||||||
blah = .blah .blah
|
blah = .blah .blah
|
||||||
.end annotation
|
.end annotation
|
||||||
|
|
||||||
|
.annotation runtime Lblah;
|
||||||
|
blah = .subannotation Lblah2;
|
||||||
|
blah = "blah"
|
||||||
|
.blah
|
||||||
|
.end annotation
|
@ -70,3 +70,38 @@ smali.FILE
|
|||||||
PsiElement(BAD_CHARACTER)('.blah')
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(END_ANNOTATION_DIRECTIVE)('.end annotation')
|
PsiElement(END_ANNOTATION_DIRECTIVE)('.end annotation')
|
||||||
|
PsiWhiteSpace('\n\n')
|
||||||
|
SmaliAnnotation(ANNOTATION)
|
||||||
|
PsiElement(ANNOTATION_DIRECTIVE)('.annotation')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ANNOTATION_VISIBILITY)('runtime')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(CLASS_TYPE)
|
||||||
|
PsiElement(CLASS_DESCRIPTOR)('Lblah;')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(ANNOTATION_PARAMETER_LIST)
|
||||||
|
PsiElement(ANNOTATION_ELEMENT)
|
||||||
|
PsiElement(ANNOTATION_ELEMENT_NAME)
|
||||||
|
PsiElement(SIMPLE_NAME)('blah')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQUAL)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(SUBANNOTATION_DIRECTIVE)('.subannotation')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(CLASS_TYPE)
|
||||||
|
PsiElement(CLASS_DESCRIPTOR)('Lblah2;')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(ANNOTATION_ELEMENT)
|
||||||
|
PsiElement(ANNOTATION_ELEMENT_NAME)
|
||||||
|
PsiElement(SIMPLE_NAME)('blah')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQUAL)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LITERAL)
|
||||||
|
PsiElement(STRING_LITERAL)('"blah"')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiErrorElement:mismatched input '.blah' expecting END_SUBANNOTATION_DIRECTIVE
|
||||||
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(END_ANNOTATION_DIRECTIVE)('.end annotation')
|
Loading…
x
Reference in New Issue
Block a user