mirror of
https://github.com/revanced/smali.git
synced 2025-05-01 23:24:38 +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;
|
||||
}
|
||||
: { nameMarker = mark(); } simple_name { nameMarker.done(SmaliElementTypes.ANNOTATION_ELEMENT_NAME); }
|
||||
EQUAL literal
|
||||
equal literal
|
||||
{ marker.done(SmaliElementTypes.ANNOTATION_ELEMENT); };
|
||||
catch [RecognitionException re] {
|
||||
recover(input, re);
|
||||
reportError(marker, re, false);
|
||||
}
|
||||
|
||||
equal
|
||||
: EQUAL;
|
||||
catch [RecognitionException re] {
|
||||
Marker errorMarker = mark();
|
||||
recover(input, re);
|
||||
reportError(errorMarker, re, false);
|
||||
}
|
||||
|
||||
annotation
|
||||
@init {
|
||||
Marker marker = mark();
|
||||
|
@ -4,3 +4,6 @@
|
||||
.annotation runtime .blah
|
||||
.end annotation
|
||||
|
||||
.annotation runtime Lblah;
|
||||
blah .blah .blah
|
||||
.end annotation
|
@ -28,3 +28,23 @@ smali.FILE
|
||||
PsiElement(ANNOTATION_PARAMETER_LIST)
|
||||
<empty list>
|
||||
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