mirror of
https://github.com/revanced/smali.git
synced 2025-05-02 15:44:30 +02:00
Improve error handling for annotation element parsing
This commit is contained in:
parent
1325537f8a
commit
251d6073b9
@ -723,13 +723,21 @@ annotation_element
|
|||||||
Marker nameMarker = null;
|
Marker nameMarker = null;
|
||||||
}
|
}
|
||||||
: { nameMarker = mark(); } simple_name { nameMarker.done(SmaliElementTypes.ANNOTATION_ELEMENT_NAME); }
|
: { nameMarker = mark(); } simple_name { nameMarker.done(SmaliElementTypes.ANNOTATION_ELEMENT_NAME); }
|
||||||
EQUAL literal
|
equal literal
|
||||||
{ marker.done(SmaliElementTypes.ANNOTATION_ELEMENT); };
|
{ marker.done(SmaliElementTypes.ANNOTATION_ELEMENT); };
|
||||||
catch [RecognitionException re] {
|
catch [RecognitionException re] {
|
||||||
recover(input, re);
|
recover(input, re);
|
||||||
reportError(marker, re, false);
|
reportError(marker, re, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
equal
|
||||||
|
: EQUAL;
|
||||||
|
catch [RecognitionException re] {
|
||||||
|
Marker errorMarker = mark();
|
||||||
|
recover(input, re);
|
||||||
|
reportError(errorMarker, re, false);
|
||||||
|
}
|
||||||
|
|
||||||
annotation
|
annotation
|
||||||
@init {
|
@init {
|
||||||
Marker marker = mark();
|
Marker marker = mark();
|
||||||
|
@ -4,3 +4,6 @@
|
|||||||
.annotation runtime .blah
|
.annotation runtime .blah
|
||||||
.end annotation
|
.end annotation
|
||||||
|
|
||||||
|
.annotation runtime Lblah;
|
||||||
|
blah .blah .blah
|
||||||
|
.end annotation
|
@ -28,3 +28,23 @@ smali.FILE
|
|||||||
PsiElement(ANNOTATION_PARAMETER_LIST)
|
PsiElement(ANNOTATION_PARAMETER_LIST)
|
||||||
<empty list>
|
<empty list>
|
||||||
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(' ')
|
||||||
|
PsiErrorElement:mismatched input '.blah' expecting EQUAL
|
||||||
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(BAD_CHARACTER)('.blah')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(END_ANNOTATION_DIRECTIVE)('.end annotation')
|
Loading…
x
Reference in New Issue
Block a user