Improve error handling for missing reference_type_descriptor

This commit is contained in:
Ben Gruver 2015-02-26 09:37:16 -08:00
parent a0149307bd
commit bcc0d5fa64
4 changed files with 56 additions and 0 deletions

View File

@ -540,6 +540,11 @@ nonvoid_type_descriptor
reference_type_descriptor
: class_descriptor
| array_descriptor;
catch [RecognitionException re] {
Marker marker = mark();
recover(input, re);
reportError(marker, re, false);
}
null_literal
@init { Marker marker = mark(); }

View File

@ -54,6 +54,7 @@ public class ParserTest extends LightCodeInsightParsingTestCase {
public void testParamListInvalidParameter() throws Exception { doTest(true); }
public void testSuperClassInvalidSyntax() throws Exception { doTest(true); }
public void testSuperClassInvalidSyntax2() throws Exception { doTest(true); }
public void testInvalidMethodReference() throws Exception { doTest(true); }
public void testInvalidMethod() throws Exception { doTest(true); }
public void testInvalidMethod2() throws Exception { doTest(true); }
public void testInvalidMethod3() throws Exception { doTest(true); }

View File

@ -0,0 +1,4 @@
.method blah()V
.registers 1
invoke-virtual {v0}, .blah->
.end method

View File

@ -0,0 +1,46 @@
smali.FILE
SmaliClass(CLASS)
SmaliExtendsList(EXTENDS_LIST)
<empty list>
SmaliImplementsList(IMPLEMENTS_LIST)
<empty list>
SmaliMethod(METHOD)
SmaliThrowsList(THROWS_LIST)
<empty list>
PsiElement(METHOD_DIRECTIVE)('.method')
PsiWhiteSpace(' ')
SmaliModifierList(MODIFIER_LIST)
<empty list>
PsiElement(MEMBER_NAME)
PsiElement(SIMPLE_NAME)('blah')
SmaliMethodPrototype(METHOD_PROTOTYPE)
PsiElement(OPEN_PAREN)('(')
SmaliMethodParamList(METHOD_PARAM_LIST)
<empty list>
PsiElement(CLOSE_PAREN)(')')
PsiElement(VOID_TYPE)
PsiElement(VOID_TYPE)('V')
PsiWhiteSpace('\n')
PsiElement(REGISTERS_STATEMENT)
PsiElement(REGISTERS_DIRECTIVE)('.registers')
PsiWhiteSpace(' ')
PsiElement(LITERAL)
PsiElement(POSITIVE_INTEGER_LITERAL)('1')
PsiWhiteSpace('\n')
PsiElement(INSTRUCTION)
PsiElement(INSTRUCTION_FORMAT35c_METHOD)('invoke-virtual')
PsiWhiteSpace(' ')
PsiElement(OPEN_BRACE)('{')
PsiElement(REGISTER_REFERENCE)
PsiElement(REGISTER)('v0')
PsiElement(CLOSE_BRACE)('}')
PsiElement(COMMA)(',')
PsiWhiteSpace(' ')
PsiElement(METHOD_REFERENCE)
PsiErrorElement:no viable alternative at input '.blah-'
PsiElement(BAD_CHARACTER)('.blah-')
PsiElement(BAD_CHARACTER)('>')
PsiWhiteSpace('\n')
PsiElement(MEMBER_NAME)
<empty list>
PsiElement(END_METHOD_DIRECTIVE)('.end method')