IDEA-96136 Groovy: line feed after annotation reference is allowed

This commit is contained in:
Max Medvedev
2012-11-29 16:24:28 +04:00
parent 961d93c8b2
commit 827d5ce271
3 changed files with 42 additions and 4 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import org.jetbrains.plugins.groovy.lang.parser.GroovyParser;
import org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.ReferenceElement;
import org.jetbrains.plugins.groovy.lang.parser.parsing.util.ParserUtils;
import static org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.ReferenceElement.ReferenceElementResult.*;
import static org.jetbrains.plugins.groovy.lang.parser.parsing.statements.typeDefinitions.ReferenceElement.ReferenceElementResult.fail;
/**
* @autor: Dmitry.Krasilschikov
@@ -54,6 +54,9 @@ public class Annotation implements GroovyElementTypes {
return false;
}
if (ParserUtils.lookAhead(builder, mNLS, mLPAREN)) {
ParserUtils.getToken(builder, mNLS);
}
AnnotationArguments.parse(builder, parser);
annMarker.done(ANNOTATION);
@@ -1,6 +1,17 @@
/*
* Copyright (c) 2000-2005 by JetBrains s.r.o. All Rights Reserved.
* Use is subject to license terms.
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.groovy.lang.parser
@@ -21,4 +32,5 @@ public class AnnotationsParsingTest extends GroovyParsingTestCase {
public void testImportAnn() { doTest() }
public void testPackageAnn() { doTest() }
public void testDefAttribute() {doTest()}
public void testLineFeedAfterRef() {doTest()}
}
@@ -0,0 +1,23 @@
@Foo
(args)
def abc
-----
Groovy script
Variable definitions
Modifiers
Annotation
PsiElement(@)('@')
Reference element
PsiElement(identifier)('Foo')
PsiElement(new line)('\n')
Annotation arguments
PsiElement(()('(')
Annotation member value pair
Reference expression
PsiElement(identifier)('args')
PsiElement())(')')
PsiElement(new line)('\n')
PsiElement(def)('def')
PsiWhiteSpace(' ')
Variable
PsiElement(identifier)('abc')