drop tuples support from parser

This commit is contained in:
Dmitry Jemerov
2015-07-14 14:59:47 +02:00
parent a84fe53256
commit 55c11539f8
2 changed files with 12 additions and 67 deletions
@@ -604,7 +604,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
/*
* atomicExpression
* : tupleLiteral // or parenthesized element
* : "this" label?
* : "super" ("<" type ">")? label?
* : objectLiteral
@@ -628,9 +627,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
if (at(LPAR)) {
parseParenthesizedExpression();
}
else if (at(HASH)) {
parseTupleExpression();
}
else if (at(PACKAGE_KEYWORD)) {
parseOneTokenExpression(ROOT_PACKAGE);
}
@@ -1782,49 +1778,6 @@ public class JetExpressionParsing extends AbstractJetParsing {
mark.done(PARENTHESIZED);
}
/*
* tupleLiteral
* : "#" "(" (((SimpleName "=")? expression){","})? ")"
* ;
*/
@Deprecated // Tuples are dropped, but parsing is left to minimize surprising. This code should be removed some time (in Kotlin 1.0?)
private void parseTupleExpression() {
assert _at(HASH);
PsiBuilder.Marker mark = mark();
advance(); // HASH
advance(); // LPAR
myBuilder.disableNewlines();
if (!at(RPAR)) {
while (true) {
while (at(COMMA)) {
advance();
}
if (at(IDENTIFIER) && lookahead(1) == EQ) {
advance(); // IDENTIFIER
advance(); // EQ
parseExpression();
}
else {
parseExpression();
}
if (!at(COMMA)) break;
advance(); // COMMA
if (at(RPAR)) {
break;
}
}
}
consumeIf(RPAR);
myBuilder.restoreNewlinesState();
mark.error("Tuples are not supported. Use data classes instead.");
}
/*
* "this" label?
*/
+12 -20
View File
@@ -16,24 +16,16 @@ JetFile: ShebangIncorrect.kts
PsiElement(RPAR)(')')
PsiElement(SEMICOLON)(';')
PsiWhiteSpace(' ')
BINARY_EXPRESSION
PsiErrorElement:Tuples are not supported. Use data classes instead.
PsiElement(HASH)('#')
PsiElement(EXCL)('!')
PsiErrorElement:Expecting an expression
<empty list>
OPERATION_REFERENCE
PsiElement(DIV)('/')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('usr')
PsiErrorElement:Expecting an element
PsiElement(HASH)('#')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(EXCL)('!')
PsiElement(DIV)('/')
PsiElement(IDENTIFIER)('usr')
PsiWhiteSpace('\n\n')
BINARY_EXPRESSION
PsiErrorElement:Tuples are not supported. Use data classes instead.
PsiElement(HASH)('#')
PsiElement(EXCL)('!')
PsiErrorElement:Expecting an expression
<empty list>
OPERATION_REFERENCE
PsiElement(DIV)('/')
REFERENCE_EXPRESSION
PsiElement(IDENTIFIER)('hi')
PsiErrorElement:Expecting an element
PsiElement(HASH)('#')
PsiErrorElement:Unexpected tokens (use ';' to separate expressions on the same line)
PsiElement(EXCL)('!')
PsiElement(DIV)('/')
PsiElement(IDENTIFIER)('hi')