Tests for match
This commit is contained in:
@@ -392,6 +392,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
|
|
||||||
myJetParsing.parseAttributeList();
|
myJetParsing.parseAttributeList();
|
||||||
|
|
||||||
|
myBuilder.disableEols();
|
||||||
expect(CASE_KEYWORD, "Expecting 'case' to start pattern matching", TokenSet.create(RBRACE, IF_KEYWORD, DOUBLE_ARROW));
|
expect(CASE_KEYWORD, "Expecting 'case' to start pattern matching", TokenSet.create(RBRACE, IF_KEYWORD, DOUBLE_ARROW));
|
||||||
|
|
||||||
parsePattern();
|
parsePattern();
|
||||||
@@ -403,6 +404,7 @@ public class JetExpressionParsing extends AbstractJetParsing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(DOUBLE_ARROW, "Expecting '=>'", TokenSet.create(RBRACE));
|
expect(DOUBLE_ARROW, "Expecting '=>'", TokenSet.create(RBRACE));
|
||||||
|
myBuilder.enableEols();
|
||||||
|
|
||||||
parseExpression();
|
parseExpression();
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
fun foo() {
|
||||||
|
e match {
|
||||||
|
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
case a => foo
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
case Tree(a, b) => foo
|
||||||
|
case Tree(a, b) if (a > 5) => foo
|
||||||
|
case null => foo
|
||||||
|
case 1 => foo
|
||||||
|
case A.b => foo
|
||||||
|
case 1l => foo
|
||||||
|
case 1.0 => foo
|
||||||
|
case 'c' => foo
|
||||||
|
case "sadfsa" => foo
|
||||||
|
case """ddd""" => foo
|
||||||
|
case ? => foo
|
||||||
|
case ? : Foo => foo
|
||||||
|
case ?a : Foo => foo
|
||||||
|
case (?a : Foo, b) => foo
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
|
||||||
|
} match {
|
||||||
|
|
||||||
|
} match {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,294 @@
|
|||||||
|
JetFile: Match.jet
|
||||||
|
NAMESPACE
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
<empty list>
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('Tree')
|
||||||
|
TUPLE_PATTERN
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('Tree')
|
||||||
|
TUPLE_PATTERN
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(if)('if')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
CONDITION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(GT)('>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('5')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
NULL
|
||||||
|
PsiElement(null)('null')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('A')
|
||||||
|
PsiElement(DOT)('.')
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
LONG_CONSTANT
|
||||||
|
PsiElement(LONG_LITERAL)('1l')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
FLOAT_CONSTANT
|
||||||
|
PsiElement(FLOAT_CONSTANT)('1.0')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
CHARACTER_CONSTANT
|
||||||
|
PsiElement(CHARACTER_LITERAL)(''c'')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
STRING_CONSTANT
|
||||||
|
PsiElement(STRING_LITERAL)('"sadfsa"')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
STRING_CONSTANT
|
||||||
|
PsiElement(RAW_STRING_LITERAL)('"""ddd"""')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('Foo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('Foo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
TUPLE_PATTERN
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PATTERN
|
||||||
|
PsiElement(QUEST)('?')
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(COLON)(':')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('Foo')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
fun foo() {
|
||||||
|
e match {
|
||||||
|
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
case => foo
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
case => ;
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
foo bar
|
||||||
|
case a => foo
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
foo bar
|
||||||
|
}
|
||||||
|
e match {
|
||||||
|
case - => foo
|
||||||
|
case (, , 1, , ) => foo
|
||||||
|
} match {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
JetFile: Match_ERR.jet
|
||||||
|
NAMESPACE
|
||||||
|
FUN
|
||||||
|
PsiElement(fun)('fun')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
TYPE_PARAMETER_LIST
|
||||||
|
<empty list>
|
||||||
|
VALUE_PARAMETER_LIST
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BLOCK
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiErrorElement:Pattern expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiErrorElement:Pattern expected
|
||||||
|
<empty list>
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting an expression
|
||||||
|
PsiElement(SEMICOLON)(';')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiErrorElement:Expecting 'case' to start pattern matching
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiErrorElement:Expecting 'case' to start pattern matching
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('bar')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiErrorElement:Pattern expected
|
||||||
|
PsiElement(MINUS)('-')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
TUPLE_PATTERN
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiErrorElement:Expecting a pattern
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a pattern
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
INTEGER_CONSTANT
|
||||||
|
PsiElement(INTEGER_LITERAL)('1')
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiErrorElement:Expecting a pattern
|
||||||
|
PsiElement(COMMA)(',')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
PsiErrorElement:Pattern expected
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiErrorElement:Expecting ')'
|
||||||
|
<empty list>
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
@@ -19,4 +19,9 @@ fun foo() {
|
|||||||
val a = b[{c
|
val a = b[{c
|
||||||
+ d}
|
+ d}
|
||||||
+ d]
|
+ d]
|
||||||
|
|
||||||
|
e match {
|
||||||
|
case A
|
||||||
|
() => foo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -188,5 +188,30 @@ JetFile: NewlinesInParentheses.jet
|
|||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('d')
|
PsiElement(IDENTIFIER)('d')
|
||||||
PsiElement(RBRACKET)(']')
|
PsiElement(RBRACKET)(']')
|
||||||
|
PsiWhiteSpace('\n\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('e')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
MATCH_ENTRY
|
||||||
|
PsiElement(case)('case')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PATTERN
|
||||||
|
USER_TYPE
|
||||||
|
PsiElement(IDENTIFIER)('A')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
TUPLE_PATTERN
|
||||||
|
PsiElement(LPAR)('(')
|
||||||
|
PsiElement(RPAR)(')')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(DOUBLE_ARROW)('=>')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('foo')
|
||||||
|
PsiElement(SEMICOLON)(';')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -32,4 +32,7 @@ fun foo() {
|
|||||||
a || b && c
|
a || b && c
|
||||||
a = b -> c
|
a = b -> c
|
||||||
a = b || c
|
a = b || c
|
||||||
|
a = b || c match {} match {}
|
||||||
|
a = b || c match {}
|
||||||
|
a = a -> c match {} -> c
|
||||||
}
|
}
|
||||||
@@ -518,5 +518,70 @@ JetFile: Precedence.jet
|
|||||||
PsiElement(OROR)('||')
|
PsiElement(OROR)('||')
|
||||||
PsiWhiteSpace(' ')
|
PsiWhiteSpace(' ')
|
||||||
PsiElement(IDENTIFIER)('c')
|
PsiElement(IDENTIFIER)('c')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(OROR)('||')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('c')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('b')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(OROR)('||')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('c')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace('\n ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(EQ)('=')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('a')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
BINARY_EXPRESSION
|
||||||
|
PsiElement(IDENTIFIER)('c')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(match)('match')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(LBRACE)('{')
|
||||||
|
PsiElement(RBRACE)('}')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(ARROW)('->')
|
||||||
|
PsiWhiteSpace(' ')
|
||||||
|
PsiElement(IDENTIFIER)('c')
|
||||||
PsiWhiteSpace('\n')
|
PsiWhiteSpace('\n')
|
||||||
PsiElement(RBRACE)('}')
|
PsiElement(RBRACE)('}')
|
||||||
@@ -52,6 +52,8 @@ public class JetParsingTest extends ParsingTestCase {
|
|||||||
public void testImports_ERR() throws Exception {doTest(true);}
|
public void testImports_ERR() throws Exception {doTest(true);}
|
||||||
public void testImportSoftKW() throws Exception {doTest(true);}
|
public void testImportSoftKW() throws Exception {doTest(true);}
|
||||||
public void testLocalDeclarations() throws Exception {doTest(true);}
|
public void testLocalDeclarations() throws Exception {doTest(true);}
|
||||||
|
public void testMatch() throws Exception {doTest(true);}
|
||||||
|
public void testMatch_ERR() throws Exception {doTest(true);}
|
||||||
public void testNamespaceBlock_ERR() throws Exception {doTest(true);}
|
public void testNamespaceBlock_ERR() throws Exception {doTest(true);}
|
||||||
public void testNamespaceBlock() throws Exception {doTest(true);}
|
public void testNamespaceBlock() throws Exception {doTest(true);}
|
||||||
public void testNewlinesInParentheses() throws Exception {doTest(true);}
|
public void testNewlinesInParentheses() throws Exception {doTest(true);}
|
||||||
|
|||||||
Reference in New Issue
Block a user