Minor in Parser: "attribute" -> "annotation"
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
<empty list>
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
@@ -176,4 +176,4 @@ JetFile: Properties_ERR.kt
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiErrorElement:Expecting function body
|
||||
PsiElement(MINUS)('-')
|
||||
PsiElement(MINUS)('-')
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
JetFile: Attributes.kt
|
||||
JetFile: Annotations.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
PsiElement(package)('package')
|
||||
PsiWhiteSpace(' ')
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
JetFile: AttributesOnPatterns.kt
|
||||
JetFile: AnnotationsOnPatterns.kt
|
||||
PACKAGE_DIRECTIVE
|
||||
<empty list>
|
||||
FUN
|
||||
+4
-4
@@ -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
|
||||
<empty list>
|
||||
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)(']')
|
||||
@@ -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
|
||||
<empty list>
|
||||
PsiElement(RBRACKET)(']')
|
||||
PsiWhiteSpace('\n')
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user