mirror of
https://github.com/revanced/smali.git
synced 2025-05-21 16:37:04 +02:00
Split out a separate class access list, to improve parsing
This commit is contained in:
parent
ea04d22ffd
commit
f47973006b
@ -209,7 +209,7 @@ smali_file
|
||||
|
||||
class_spec
|
||||
@init { Marker marker = mark(); }
|
||||
: CLASS_DIRECTIVE access_list class_descriptor
|
||||
: CLASS_DIRECTIVE class_access_list class_descriptor
|
||||
{ marker.done(SmaliElementTypes.CLASS_STATEMENT); };
|
||||
catch [RecognitionException re] {
|
||||
recover(input, re);
|
||||
@ -243,6 +243,18 @@ source_spec
|
||||
reportError(marker, re, false);
|
||||
}
|
||||
|
||||
// class_access_list should be separate from access_list, because
|
||||
// it exists in a slightly different context, and can consume
|
||||
// ACCESS_SPECs greedily, without having to look ahead.
|
||||
class_access_list
|
||||
@init { Marker marker = mark(); }
|
||||
: ACCESS_SPEC*
|
||||
{ marker.done(SmaliElementTypes.ACCESS_LIST); };
|
||||
catch [RecognitionException re] {
|
||||
recover(input, re);
|
||||
reportError(marker, re, false);
|
||||
}
|
||||
|
||||
access_list
|
||||
@init { Marker marker = mark(); }
|
||||
: ACCESS_SPEC*
|
||||
|
@ -98,6 +98,7 @@ public class ParserTest extends ParsingTestCase {
|
||||
public void testEmpty() throws Exception { doTest(true); }
|
||||
public void testInvalidClassDirective() throws Exception { doTest(true); }
|
||||
public void testInvalidClassDirective2() throws Exception { doTest(true); }
|
||||
public void testInvalidClassDirective3() throws Exception { doTest(true); }
|
||||
public void testParamListInvalidParameter() throws Exception { doTest(true); }
|
||||
public void testSuperClassInvalidSyntax() throws Exception { doTest(true); }
|
||||
public void testSuperClassInvalidSyntax2() throws Exception { doTest(true); }
|
||||
|
1
smalidea/testData/InvalidClassDirective3.smalidea
Normal file
1
smalidea/testData/InvalidClassDirective3.smalidea
Normal file
@ -0,0 +1 @@
|
||||
.class public .class Ltest;
|
18
smalidea/testData/InvalidClassDirective3.txt
Normal file
18
smalidea/testData/InvalidClassDirective3.txt
Normal file
@ -0,0 +1,18 @@
|
||||
smali.FILE
|
||||
SmaliClass(CLASS)
|
||||
SmaliModifierList(MODIFIER_LIST)
|
||||
<empty list>
|
||||
SmaliExtendsList(EXTENDS_LIST)
|
||||
<empty list>
|
||||
SmaliImplementsList(IMPLEMENTS_LIST)
|
||||
<empty list>
|
||||
PsiElement(CLASS_STATEMENT)
|
||||
PsiElement(CLASS_DIRECTIVE)('.class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ACCESS_LIST)
|
||||
PsiElement(ACCESS_SPEC)('public')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:extraneous input '.class' expecting CLASS_DESCRIPTOR
|
||||
PsiElement(CLASS_DIRECTIVE)('.class')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(CLASS_DESCRIPTOR)('Ltest;')
|
Loading…
x
Reference in New Issue
Block a user