From 486b6be32c76eb24b8dfa0b039cb3fd352f3cb53 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Wed, 10 Sep 2014 14:42:19 +0400 Subject: [PATCH] Minor in Parser: "attribute" -> "annotation" --- .../lang/parsing/JetExpressionParsing.java | 8 ++--- .../jet/lang/parsing/JetParsing.java | 36 +++++++++---------- compiler/testData/psi/Properties_ERR.txt | 4 +-- .../{Attributes.kt => Annotations.kt} | 0 .../{Attributes.txt => Annotations.txt} | 2 +- ...OnPatterns.kt => AnnotationsOnPatterns.kt} | 0 ...Patterns.txt => AnnotationsOnPatterns.txt} | 2 +- .../{Attributes_ERR.kt => Annotations_ERR.kt} | 0 ...Attributes_ERR.txt => Annotations_ERR.txt} | 8 ++--- .../onFile/fileAnnotationInWrongPlace.txt | 2 +- .../jet/parsing/JetParsingTestGenerated.java | 18 +++++----- 11 files changed, 40 insertions(+), 40 deletions(-) rename compiler/testData/psi/annotation/{Attributes.kt => Annotations.kt} (100%) rename compiler/testData/psi/annotation/{Attributes.txt => Annotations.txt} (99%) rename compiler/testData/psi/annotation/{AttributesOnPatterns.kt => AnnotationsOnPatterns.kt} (100%) rename compiler/testData/psi/annotation/{AttributesOnPatterns.txt => AnnotationsOnPatterns.txt} (97%) rename compiler/testData/psi/annotation/{Attributes_ERR.kt => Annotations_ERR.kt} (100%) rename compiler/testData/psi/annotation/{Attributes_ERR.txt => Annotations_ERR.txt} (97%) diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java index 8408026a70c..415b52ed94d 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetExpressionParsing.java @@ -116,7 +116,7 @@ public class JetExpressionParsing extends AbstractJetParsing { EXPRESSION_FIRST, TokenSet.create( // declaration - LBRACKET, // attribute + LBRACKET, // annotation FUN_KEYWORD, VAL_KEYWORD, VAR_KEYWORD, TRAIT_KEYWORD, @@ -140,7 +140,7 @@ public class JetExpressionParsing extends AbstractJetParsing { POSTFIX(PLUSPLUS, MINUSMINUS, EXCLEXCL, DOT, SAFE_ACCESS), // typeArguments? valueArguments : typeArguments : arrayAccess - PREFIX(MINUS, PLUS, MINUSMINUS, PLUSPLUS, EXCL, LABEL_IDENTIFIER) { // attributes + PREFIX(MINUS, PLUS, MINUSMINUS, PLUSPLUS, EXCL, LABEL_IDENTIFIER) { // annotations @Override public void parseHigherPrecedence(JetExpressionParsing parser) { @@ -269,7 +269,7 @@ public class JetExpressionParsing extends AbstractJetParsing { /* * element - * : attributes element + * : annotations element * : "(" element ")" // see tupleLiteral * : literalConstant * : functionLiteral @@ -1449,7 +1449,7 @@ public class JetExpressionParsing extends AbstractJetParsing { * : "try" block catchBlock* finallyBlock? * ; * catchBlock - * : "catch" "(" attributes SimpleName ":" userType ")" block + * : "catch" "(" annotations SimpleName ":" userType ")" block * ; * * finallyBlock diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java index ac1b04c0748..896b6ea35b2 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/parsing/JetParsing.java @@ -385,7 +385,7 @@ public class JetParsing extends AbstractJetParsing { } /* - * (modifier | attribute)* + * (modifier | annotation)* */ boolean parseModifierList( @NotNull IElementType nodeType, @@ -395,9 +395,9 @@ public class JetParsing extends AbstractJetParsing { } /** - * (modifier | attribute)* + * (modifier | annotation)* * - * Feeds modifiers (not attributes) into the passed consumer, if it is not null + * Feeds modifiers (not annotations) into the passed consumer, if it is not null */ boolean parseModifierList( @NotNull IElementType nodeType, @@ -492,23 +492,23 @@ public class JetParsing extends AbstractJetParsing { } if (!at(IDENTIFIER)) { - error("Expecting a list of attributes"); + error("Expecting a list of annotations"); } else { parseAnnotationEntry(); while (at(COMMA)) { - errorAndAdvance("No commas needed to separate attributes"); + errorAndAdvance("No commas needed to separate annotations"); } while (at(IDENTIFIER)) { parseAnnotationEntry(); while (at(COMMA)) { - errorAndAdvance("No commas needed to separate attributes"); + errorAndAdvance("No commas needed to separate annotations"); } } } - expect(RBRACKET, "Expecting ']' to close an attribute annotation"); + expect(RBRACKET, "Expecting ']' to close an list of annotation"); myBuilder.restoreNewlinesState(); annotation.done(ANNOTATION); @@ -530,7 +530,7 @@ public class JetParsing extends AbstractJetParsing { private void parseAnnotationEntry() { assert _at(IDENTIFIER); - PsiBuilder.Marker attribute = mark(); + PsiBuilder.Marker annotation = mark(); PsiBuilder.Marker reference = mark(); PsiBuilder.Marker typeReference = mark(); @@ -543,7 +543,7 @@ public class JetParsing extends AbstractJetParsing { if (at(LPAR)) { myExpressionParsing.parseValueArgumentList(); } - attribute.done(ANNOTATION_ENTRY); + annotation.done(ANNOTATION_ENTRY); } /* @@ -551,7 +551,7 @@ public class JetParsing extends AbstractJetParsing { * : modifiers ("class" | "trait") SimpleName * typeParameters? * modifiers ("(" primaryConstructorParameter{","} ")")? - * (":" attributes delegationSpecifier{","})? + * (":" annotations delegationSpecifier{","})? * typeConstraints * (classBody? | enumClassBody) * ; @@ -826,8 +826,8 @@ public class JetParsing extends AbstractJetParsing { /* * initializer - * : attributes "this" valueArguments - * : attributes constructorInvocation // type parameters may (must?) be omitted + * : annotations "this" valueArguments + * : annotations constructorInvocation // type parameters may (must?) be omitted * ; */ private void parseInitializer() { @@ -1132,7 +1132,7 @@ public class JetParsing extends AbstractJetParsing { /* * function * : modifiers "fun" typeParameters? - * (type "." | attributes)? + * (type "." | annotations)? * SimpleName * typeParameters? functionParameters (":" type)? * typeConstraints @@ -1201,7 +1201,7 @@ public class JetParsing extends AbstractJetParsing { } /* - * (type "." | attributes)? + * (type "." | annotations)? */ private void parseReceiverType(String title, TokenSet nameFollow, int lastDot) { if (lastDot == -1) { // There's no explicit receiver type specified @@ -1290,7 +1290,7 @@ public class JetParsing extends AbstractJetParsing { } /* - * attributes delegationSpecifier + * annotations delegationSpecifier * * delegationSpecifier * : constructorInvocation // type and constructor arguments @@ -1397,8 +1397,8 @@ public class JetParsing extends AbstractJetParsing { /* * typeConstraint - * : attributes SimpleName ":" type - * : attributes "class" "object" SimpleName ":" type + * : annotations SimpleName ":" type + * : annotations "class" "object" SimpleName ":" type * ; */ private void parseTypeConstraint() { @@ -1456,7 +1456,7 @@ public class JetParsing extends AbstractJetParsing { /* * type - * : attributes typeDescriptor + * : annotations typeDescriptor * * typeDescriptor * : selfType diff --git a/compiler/testData/psi/Properties_ERR.txt b/compiler/testData/psi/Properties_ERR.txt index 9d811255714..eaa89dc4aef 100644 --- a/compiler/testData/psi/Properties_ERR.txt +++ b/compiler/testData/psi/Properties_ERR.txt @@ -58,7 +58,7 @@ JetFile: Properties_ERR.kt USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('foo') - PsiErrorElement:Expecting ']' to close an attribute annotation + PsiErrorElement:Expecting ']' to close an list of annotation PsiWhiteSpace(' ') PsiElement(EQ)('=') @@ -176,4 +176,4 @@ JetFile: Properties_ERR.kt PsiElement(RPAR)(')') PsiWhiteSpace(' ') PsiErrorElement:Expecting function body - PsiElement(MINUS)('-') \ No newline at end of file + PsiElement(MINUS)('-') diff --git a/compiler/testData/psi/annotation/Attributes.kt b/compiler/testData/psi/annotation/Annotations.kt similarity index 100% rename from compiler/testData/psi/annotation/Attributes.kt rename to compiler/testData/psi/annotation/Annotations.kt diff --git a/compiler/testData/psi/annotation/Attributes.txt b/compiler/testData/psi/annotation/Annotations.txt similarity index 99% rename from compiler/testData/psi/annotation/Attributes.txt rename to compiler/testData/psi/annotation/Annotations.txt index 714ec127c60..e6e8ac97e37 100644 --- a/compiler/testData/psi/annotation/Attributes.txt +++ b/compiler/testData/psi/annotation/Annotations.txt @@ -1,4 +1,4 @@ -JetFile: Attributes.kt +JetFile: Annotations.kt PACKAGE_DIRECTIVE PsiElement(package)('package') PsiWhiteSpace(' ') diff --git a/compiler/testData/psi/annotation/AttributesOnPatterns.kt b/compiler/testData/psi/annotation/AnnotationsOnPatterns.kt similarity index 100% rename from compiler/testData/psi/annotation/AttributesOnPatterns.kt rename to compiler/testData/psi/annotation/AnnotationsOnPatterns.kt diff --git a/compiler/testData/psi/annotation/AttributesOnPatterns.txt b/compiler/testData/psi/annotation/AnnotationsOnPatterns.txt similarity index 97% rename from compiler/testData/psi/annotation/AttributesOnPatterns.txt rename to compiler/testData/psi/annotation/AnnotationsOnPatterns.txt index a30d88ab840..3ec476d2601 100644 --- a/compiler/testData/psi/annotation/AttributesOnPatterns.txt +++ b/compiler/testData/psi/annotation/AnnotationsOnPatterns.txt @@ -1,4 +1,4 @@ -JetFile: AttributesOnPatterns.kt +JetFile: AnnotationsOnPatterns.kt PACKAGE_DIRECTIVE FUN diff --git a/compiler/testData/psi/annotation/Attributes_ERR.kt b/compiler/testData/psi/annotation/Annotations_ERR.kt similarity index 100% rename from compiler/testData/psi/annotation/Attributes_ERR.kt rename to compiler/testData/psi/annotation/Annotations_ERR.kt diff --git a/compiler/testData/psi/annotation/Attributes_ERR.txt b/compiler/testData/psi/annotation/Annotations_ERR.txt similarity index 97% rename from compiler/testData/psi/annotation/Attributes_ERR.txt rename to compiler/testData/psi/annotation/Annotations_ERR.txt index fb309021504..af436c72e44 100644 --- a/compiler/testData/psi/annotation/Attributes_ERR.txt +++ b/compiler/testData/psi/annotation/Annotations_ERR.txt @@ -1,4 +1,4 @@ -JetFile: Attributes_ERR.kt +JetFile: Annotations_ERR.kt PACKAGE_DIRECTIVE PsiElement(package)('package') PsiWhiteSpace(' ') @@ -33,7 +33,7 @@ JetFile: Attributes_ERR.kt PsiWhiteSpace('\n') ANNOTATION PsiElement(LBRACKET)('[') - PsiErrorElement:Expecting a list of attributes + PsiErrorElement:Expecting a list of annotations PsiElement(RBRACKET)(']') PsiWhiteSpace('\n') @@ -79,7 +79,7 @@ JetFile: Attributes_ERR.kt REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('b') PsiElement(RPAR)(')') - PsiErrorElement:No commas needed to separate attributes + PsiErrorElement:No commas needed to separate annotations PsiElement(COMMA)(',') PsiWhiteSpace(' ') ANNOTATION_ENTRY @@ -185,7 +185,7 @@ JetFile: Attributes_ERR.kt USER_TYPE REFERENCE_EXPRESSION PsiElement(IDENTIFIER)('d') - PsiErrorElement:No commas needed to separate attributes + PsiErrorElement:No commas needed to separate annotations PsiElement(COMMA)(',') PsiWhiteSpace(' ') PsiElement(RBRACKET)(']') diff --git a/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt b/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt index b8bf1232a7d..4de4835383c 100644 --- a/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt +++ b/compiler/testData/psi/annotation/onFile/fileAnnotationInWrongPlace.txt @@ -84,7 +84,7 @@ JetFile: fileAnnotationInWrongPlace.kt PsiErrorElement:File annotations are only allowed before package declaration PsiElement(file)('file') PsiElement(COLON)(':') - PsiErrorElement:Expecting a list of attributes + PsiErrorElement:Expecting a list of annotations PsiElement(RBRACKET)(']') PsiWhiteSpace('\n') diff --git a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java index c5157a7c6af..1a810392adc 100644 --- a/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java +++ b/compiler/tests/org/jetbrains/jet/parsing/JetParsingTestGenerated.java @@ -525,21 +525,21 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest { doParsingTest(fileName); } - @TestMetadata("Attributes.kt") - public void testAttributes() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Attributes.kt"); + @TestMetadata("Annotations.kt") + public void testAnnotations() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Annotations.kt"); doParsingTest(fileName); } - @TestMetadata("AttributesOnPatterns.kt") - public void testAttributesOnPatterns() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/AttributesOnPatterns.kt"); + @TestMetadata("AnnotationsOnPatterns.kt") + public void testAnnotationsOnPatterns() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/AnnotationsOnPatterns.kt"); doParsingTest(fileName); } - @TestMetadata("Attributes_ERR.kt") - public void testAttributes_ERR() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Attributes_ERR.kt"); + @TestMetadata("Annotations_ERR.kt") + public void testAnnotations_ERR() throws Exception { + String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Annotations_ERR.kt"); doParsingTest(fileName); }