Minor in Parser: "attribute" -> "annotation"
This commit is contained in:
@@ -116,7 +116,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
EXPRESSION_FIRST,
|
EXPRESSION_FIRST,
|
||||||
TokenSet.create(
|
TokenSet.create(
|
||||||
// declaration
|
// declaration
|
||||||
LBRACKET, // attribute
|
LBRACKET, // annotation
|
||||||
FUN_KEYWORD,
|
FUN_KEYWORD,
|
||||||
VAL_KEYWORD, VAR_KEYWORD,
|
VAL_KEYWORD, VAR_KEYWORD,
|
||||||
TRAIT_KEYWORD,
|
TRAIT_KEYWORD,
|
||||||
@@ -140,7 +140,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
POSTFIX(PLUSPLUS, MINUSMINUS, EXCLEXCL,
|
POSTFIX(PLUSPLUS, MINUSMINUS, EXCLEXCL,
|
||||||
DOT, SAFE_ACCESS), // typeArguments? valueArguments : typeArguments : arrayAccess
|
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
|
@Override
|
||||||
public void parseHigherPrecedence(JetExpressionParsing parser) {
|
public void parseHigherPrecedence(JetExpressionParsing parser) {
|
||||||
@@ -269,7 +269,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* element
|
* element
|
||||||
* : attributes element
|
* : annotations element
|
||||||
* : "(" element ")" // see tupleLiteral
|
* : "(" element ")" // see tupleLiteral
|
||||||
* : literalConstant
|
* : literalConstant
|
||||||
* : functionLiteral
|
* : functionLiteral
|
||||||
@@ -1449,7 +1449,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
* : "try" block catchBlock* finallyBlock?
|
* : "try" block catchBlock* finallyBlock?
|
||||||
* ;
|
* ;
|
||||||
* catchBlock
|
* catchBlock
|
||||||
* : "catch" "(" attributes SimpleName ":" userType ")" block
|
* : "catch" "(" annotations SimpleName ":" userType ")" block
|
||||||
* ;
|
* ;
|
||||||
*
|
*
|
||||||
* finallyBlock
|
* finallyBlock
|
||||||
|
|||||||
@@ -385,7 +385,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (modifier | attribute)*
|
* (modifier | annotation)*
|
||||||
*/
|
*/
|
||||||
boolean parseModifierList(
|
boolean parseModifierList(
|
||||||
@NotNull IElementType nodeType,
|
@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(
|
boolean parseModifierList(
|
||||||
@NotNull IElementType nodeType,
|
@NotNull IElementType nodeType,
|
||||||
@@ -492,23 +492,23 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!at(IDENTIFIER)) {
|
if (!at(IDENTIFIER)) {
|
||||||
error("Expecting a list of attributes");
|
error("Expecting a list of annotations");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
parseAnnotationEntry();
|
parseAnnotationEntry();
|
||||||
while (at(COMMA)) {
|
while (at(COMMA)) {
|
||||||
errorAndAdvance("No commas needed to separate attributes");
|
errorAndAdvance("No commas needed to separate annotations");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (at(IDENTIFIER)) {
|
while (at(IDENTIFIER)) {
|
||||||
parseAnnotationEntry();
|
parseAnnotationEntry();
|
||||||
while (at(COMMA)) {
|
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();
|
myBuilder.restoreNewlinesState();
|
||||||
|
|
||||||
annotation.done(ANNOTATION);
|
annotation.done(ANNOTATION);
|
||||||
@@ -530,7 +530,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
private void parseAnnotationEntry() {
|
private void parseAnnotationEntry() {
|
||||||
assert _at(IDENTIFIER);
|
assert _at(IDENTIFIER);
|
||||||
|
|
||||||
PsiBuilder.Marker attribute = mark();
|
PsiBuilder.Marker annotation = mark();
|
||||||
|
|
||||||
PsiBuilder.Marker reference = mark();
|
PsiBuilder.Marker reference = mark();
|
||||||
PsiBuilder.Marker typeReference = mark();
|
PsiBuilder.Marker typeReference = mark();
|
||||||
@@ -543,7 +543,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
if (at(LPAR)) {
|
if (at(LPAR)) {
|
||||||
myExpressionParsing.parseValueArgumentList();
|
myExpressionParsing.parseValueArgumentList();
|
||||||
}
|
}
|
||||||
attribute.done(ANNOTATION_ENTRY);
|
annotation.done(ANNOTATION_ENTRY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -551,7 +551,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
* : modifiers ("class" | "trait") SimpleName
|
* : modifiers ("class" | "trait") SimpleName
|
||||||
* typeParameters?
|
* typeParameters?
|
||||||
* modifiers ("(" primaryConstructorParameter{","} ")")?
|
* modifiers ("(" primaryConstructorParameter{","} ")")?
|
||||||
* (":" attributes delegationSpecifier{","})?
|
* (":" annotations delegationSpecifier{","})?
|
||||||
* typeConstraints
|
* typeConstraints
|
||||||
* (classBody? | enumClassBody)
|
* (classBody? | enumClassBody)
|
||||||
* ;
|
* ;
|
||||||
@@ -826,8 +826,8 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* initializer
|
* initializer
|
||||||
* : attributes "this" valueArguments
|
* : annotations "this" valueArguments
|
||||||
* : attributes constructorInvocation // type parameters may (must?) be omitted
|
* : annotations constructorInvocation // type parameters may (must?) be omitted
|
||||||
* ;
|
* ;
|
||||||
*/
|
*/
|
||||||
private void parseInitializer() {
|
private void parseInitializer() {
|
||||||
@@ -1132,7 +1132,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
/*
|
/*
|
||||||
* function
|
* function
|
||||||
* : modifiers "fun" typeParameters?
|
* : modifiers "fun" typeParameters?
|
||||||
* (type "." | attributes)?
|
* (type "." | annotations)?
|
||||||
* SimpleName
|
* SimpleName
|
||||||
* typeParameters? functionParameters (":" type)?
|
* typeParameters? functionParameters (":" type)?
|
||||||
* typeConstraints
|
* typeConstraints
|
||||||
@@ -1201,7 +1201,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (type "." | attributes)?
|
* (type "." | annotations)?
|
||||||
*/
|
*/
|
||||||
private void parseReceiverType(String title, TokenSet nameFollow, int lastDot) {
|
private void parseReceiverType(String title, TokenSet nameFollow, int lastDot) {
|
||||||
if (lastDot == -1) { // There's no explicit receiver type specified
|
if (lastDot == -1) { // There's no explicit receiver type specified
|
||||||
@@ -1290,7 +1290,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* attributes delegationSpecifier
|
* annotations delegationSpecifier
|
||||||
*
|
*
|
||||||
* delegationSpecifier
|
* delegationSpecifier
|
||||||
* : constructorInvocation // type and constructor arguments
|
* : constructorInvocation // type and constructor arguments
|
||||||
@@ -1397,8 +1397,8 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* typeConstraint
|
* typeConstraint
|
||||||
* : attributes SimpleName ":" type
|
* : annotations SimpleName ":" type
|
||||||
* : attributes "class" "object" SimpleName ":" type
|
* : annotations "class" "object" SimpleName ":" type
|
||||||
* ;
|
* ;
|
||||||
*/
|
*/
|
||||||
private void parseTypeConstraint() {
|
private void parseTypeConstraint() {
|
||||||
@@ -1456,7 +1456,7 @@ public class JetParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* type
|
* type
|
||||||
* : attributes typeDescriptor
|
* : annotations typeDescriptor
|
||||||
*
|
*
|
||||||
* typeDescriptor
|
* typeDescriptor
|
||||||
* : selfType
|
* : selfType
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ JetFile: Properties_ERR.kt
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('foo')
|
PsiElement(IDENTIFIER)('foo')
|
||||||
PsiErrorElement:Expecting ']' to close an attribute annotation
|
PsiErrorElement:Expecting ']' to close an list of annotation
|
||||||
<empty list>
|
<empty list>
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(EQ)('=')
|
PsiElement(EQ)('=')
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
JetFile: Attributes.kt
|
JetFile: Annotations.kt
|
||||||
PACKAGE_DIRECTIVE
|
PACKAGE_DIRECTIVE
|
||||||
PsiElement(package)('package')
|
PsiElement(package)('package')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
JetFile: AttributesOnPatterns.kt
|
JetFile: AnnotationsOnPatterns.kt
|
||||||
PACKAGE_DIRECTIVE
|
PACKAGE_DIRECTIVE
|
||||||
<empty list>
|
<empty list>
|
||||||
FUN
|
FUN
|
||||||
+4
-4
@@ -1,4 +1,4 @@
|
|||||||
JetFile: Attributes_ERR.kt
|
JetFile: Annotations_ERR.kt
|
||||||
PACKAGE_DIRECTIVE
|
PACKAGE_DIRECTIVE
|
||||||
PsiElement(package)('package')
|
PsiElement(package)('package')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
@@ -33,7 +33,7 @@ JetFile: Attributes_ERR.kt
|
|||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
ANNOTATION
|
ANNOTATION
|
||||||
PsiElement(LBRACKET)('[')
|
PsiElement(LBRACKET)('[')
|
||||||
PsiErrorElement:Expecting a list of attributes
|
PsiErrorElement:Expecting a list of annotations
|
||||||
<empty list>
|
<empty list>
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
@@ -79,7 +79,7 @@ JetFile: Attributes_ERR.kt
|
|||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('b')
|
PsiElement(IDENTIFIER)('b')
|
||||||
PsiElement(RPAR)(')')
|
PsiElement(RPAR)(')')
|
||||||
PsiErrorElement:No commas needed to separate attributes
|
PsiErrorElement:No commas needed to separate annotations
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
ANNOTATION_ENTRY
|
ANNOTATION_ENTRY
|
||||||
@@ -185,7 +185,7 @@ JetFile: Attributes_ERR.kt
|
|||||||
USER_TYPE
|
USER_TYPE
|
||||||
REFERENCE_EXPRESSION
|
REFERENCE_EXPRESSION
|
||||||
PsiElement(IDENTIFIER)('d')
|
PsiElement(IDENTIFIER)('d')
|
||||||
PsiErrorElement:No commas needed to separate attributes
|
PsiErrorElement:No commas needed to separate annotations
|
||||||
PsiElement(COMMA)(',')
|
PsiElement(COMMA)(',')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
@@ -84,7 +84,7 @@ JetFile: fileAnnotationInWrongPlace.kt
|
|||||||
PsiErrorElement:File annotations are only allowed before package declaration
|
PsiErrorElement:File annotations are only allowed before package declaration
|
||||||
PsiElement(file)('file')
|
PsiElement(file)('file')
|
||||||
PsiElement(COLON)(':')
|
PsiElement(COLON)(':')
|
||||||
PsiErrorElement:Expecting a list of attributes
|
PsiErrorElement:Expecting a list of annotations
|
||||||
<empty list>
|
<empty list>
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
|
|||||||
@@ -525,21 +525,21 @@ public class JetParsingTestGenerated extends AbstractJetParsingTest {
|
|||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Attributes.kt")
|
@TestMetadata("Annotations.kt")
|
||||||
public void testAttributes() throws Exception {
|
public void testAnnotations() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Attributes.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Annotations.kt");
|
||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("AttributesOnPatterns.kt")
|
@TestMetadata("AnnotationsOnPatterns.kt")
|
||||||
public void testAttributesOnPatterns() throws Exception {
|
public void testAnnotationsOnPatterns() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/AttributesOnPatterns.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/AnnotationsOnPatterns.kt");
|
||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("Attributes_ERR.kt")
|
@TestMetadata("Annotations_ERR.kt")
|
||||||
public void testAttributes_ERR() throws Exception {
|
public void testAnnotations_ERR() throws Exception {
|
||||||
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Attributes_ERR.kt");
|
String fileName = JetTestUtils.navigationMetadata("compiler/testData/psi/annotation/Annotations_ERR.kt");
|
||||||
doParsingTest(fileName);
|
doParsingTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user