mirror of
https://github.com/revanced/smali.git
synced 2025-05-27 19:30:13 +02:00
Improve error handling for literal parsing
This commit is contained in:
parent
251d6073b9
commit
4640cc9c5b
@ -690,6 +690,11 @@ literal
|
||||
| subannotation
|
||||
| type_field_method_literal
|
||||
| enum_literal;
|
||||
catch [RecognitionException re] {
|
||||
Marker errorMarker = mark();
|
||||
recover(input, re);
|
||||
reportError(errorMarker, re, false);
|
||||
}
|
||||
|
||||
integral_literal
|
||||
: long_literal
|
||||
@ -697,6 +702,11 @@ integral_literal
|
||||
| short_literal
|
||||
| char_literal
|
||||
| byte_literal;
|
||||
catch [RecognitionException re] {
|
||||
Marker errorMarker = mark();
|
||||
recover(input, re);
|
||||
reportError(errorMarker, re, false);
|
||||
}
|
||||
|
||||
fixed_32bit_literal
|
||||
: long_literal
|
||||
@ -706,6 +716,11 @@ fixed_32bit_literal
|
||||
| float_literal
|
||||
| char_literal
|
||||
| bool_literal;
|
||||
catch [RecognitionException re] {
|
||||
Marker errorMarker = mark();
|
||||
recover(input, re);
|
||||
reportError(errorMarker, re, false);
|
||||
}
|
||||
|
||||
fixed_literal
|
||||
: integer_literal
|
||||
@ -716,6 +731,11 @@ fixed_literal
|
||||
| double_literal
|
||||
| char_literal
|
||||
| bool_literal;
|
||||
catch [RecognitionException re] {
|
||||
Marker errorMarker = mark();
|
||||
recover(input, re);
|
||||
reportError(errorMarker, re, false);
|
||||
}
|
||||
|
||||
annotation_element
|
||||
@init {
|
||||
|
@ -6,4 +6,8 @@
|
||||
|
||||
.annotation runtime Lblah;
|
||||
blah .blah .blah
|
||||
.end annotation
|
||||
|
||||
.annotation runtime Lblah;
|
||||
blah = .blah .blah
|
||||
.end annotation
|
@ -47,4 +47,26 @@ smali.FILE
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(BAD_CHARACTER)('.blah')
|
||||
PsiWhiteSpace('\n')
|
||||
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(' ')
|
||||
PsiErrorElement:no viable alternative at input '.blah'
|
||||
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