diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/auxiliary/annotations/Annotation.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/auxiliary/annotations/Annotation.java index c5d0b9a4ae31..5437a85fbfcd 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/auxiliary/annotations/Annotation.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/lang/parser/parsing/auxiliary/annotations/Annotation.java @@ -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); diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/AnnotationsParsingTest.groovy b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/AnnotationsParsingTest.groovy index 28cf3d6e47db..e7771412a0c2 100644 --- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/AnnotationsParsingTest.groovy +++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/parser/AnnotationsParsingTest.groovy @@ -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()} } \ No newline at end of file diff --git a/plugins/groovy/testdata/parsing/groovy/annotations/lineFeedAfterRef.test b/plugins/groovy/testdata/parsing/groovy/annotations/lineFeedAfterRef.test new file mode 100644 index 000000000000..4bcc4ccc3831 --- /dev/null +++ b/plugins/groovy/testdata/parsing/groovy/annotations/lineFeedAfterRef.test @@ -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') \ No newline at end of file