GreatSyntacticShift: Parser test data fixed
This commit is contained in:
@@ -28,9 +28,9 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
fun contains(node : TreeNode, item : T) : Boolean {
|
||||
if (node == null) return false
|
||||
when(compare(item, node.value)) {
|
||||
EQ => true
|
||||
LS => contains(node.left, item)
|
||||
GT => contains(node.right, item)
|
||||
EQ -> true
|
||||
LS -> contains(node.left, item)
|
||||
GT -> contains(node.right, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,9 +51,9 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
return true
|
||||
}
|
||||
when (compare(item, node.value)) {
|
||||
EQ => false
|
||||
LS => add(ref node.left, node)
|
||||
GT => add(ref node.right, node)
|
||||
EQ -> false
|
||||
LS -> add(ref node.left, node)
|
||||
GT -> add(ref node.right, node)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,13 +64,13 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
return true
|
||||
}
|
||||
when (compare(item, node.value)) {
|
||||
EQ => return false
|
||||
LS =>
|
||||
EQ -> return false
|
||||
LS ->
|
||||
if (node.left == null) {
|
||||
node.left = TreeNode(item, node)
|
||||
return true
|
||||
} else return add(node.left)
|
||||
GT =>
|
||||
GT ->
|
||||
if (node.right == null) {
|
||||
node.right = TreeNode(item, node)
|
||||
return true
|
||||
@@ -90,19 +90,19 @@ class BinaryTree<T> : IMutableSet<T> {
|
||||
fun find(node : TreeNode) : TreeNode {
|
||||
if (node == null) return null
|
||||
when (compare(item, node.value)) {
|
||||
EQ => node
|
||||
LS => find(node.left)
|
||||
GT => find(node.right)
|
||||
EQ -> node
|
||||
LS -> find(node.left)
|
||||
GT -> find(node.right)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun remove(node : TreeNode) {
|
||||
when (node) {
|
||||
is TreeNode @ (null, null) => replace(node, null)
|
||||
is TreeNode @ (null, right) => replace(node, right)
|
||||
is TreeNode @ (left, null) => replace(node, left)
|
||||
is TreeNode @ (left, right) => {
|
||||
is TreeNode #(null, null) -> replace(node, null)
|
||||
is TreeNode #(null, right) -> replace(node, right)
|
||||
is TreeNode #(left, null) -> replace(node, left)
|
||||
is TreeNode #(left, right) -> {
|
||||
val min = min(node.right)
|
||||
node.value = min.value
|
||||
remove(min)
|
||||
|
||||
@@ -439,7 +439,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BOOLEAN_CONSTANT
|
||||
PsiElement(true)('true')
|
||||
@@ -450,7 +450,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -477,7 +477,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('GT')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -714,7 +714,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BOOLEAN_CONSTANT
|
||||
PsiElement(false)('false')
|
||||
@@ -725,7 +725,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -754,7 +754,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('GT')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -892,7 +892,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
RETURN
|
||||
PsiElement(return)('return')
|
||||
@@ -906,7 +906,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace('\n ')
|
||||
IF
|
||||
PsiElement(if)('if')
|
||||
@@ -992,7 +992,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('GT')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace('\n ')
|
||||
IF
|
||||
PsiElement(if)('if')
|
||||
@@ -1263,7 +1263,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('EQ')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('node')
|
||||
@@ -1274,7 +1274,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('LS')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -1296,7 +1296,7 @@ JetFile: BinaryTree.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('GT')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -1358,10 +1358,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
TUPLE_PATTERN_ENTRY
|
||||
EXPRESSION_PATTERN
|
||||
@@ -1375,7 +1374,7 @@ JetFile: BinaryTree.jet
|
||||
PsiElement(null)('null')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -1399,10 +1398,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
TUPLE_PATTERN_ENTRY
|
||||
EXPRESSION_PATTERN
|
||||
@@ -1418,7 +1416,7 @@ JetFile: BinaryTree.jet
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -1442,10 +1440,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
TUPLE_PATTERN_ENTRY
|
||||
TYPE_PATTERN
|
||||
@@ -1461,7 +1458,7 @@ JetFile: BinaryTree.jet
|
||||
PsiElement(null)('null')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
CALL_EXPRESSION
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -1485,10 +1482,9 @@ JetFile: BinaryTree.jet
|
||||
DECOMPOSER_PATTERN
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('TreeNode')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(AT)('@')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
DECOMPOSER_ARGUMENT_LIST
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
TUPLE_PATTERN_ENTRY
|
||||
TYPE_PATTERN
|
||||
@@ -1506,7 +1502,7 @@ JetFile: BinaryTree.jet
|
||||
PsiElement(IDENTIFIER)('right')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
PsiElement(LBRACE)('{')
|
||||
|
||||
@@ -31,7 +31,7 @@ class AntBuilder {
|
||||
fun classpath(entries : ClassPathEntry/*...*/) { /*...*/ }
|
||||
}
|
||||
|
||||
fun library(initializer : fun Library.() : Library) {
|
||||
fun library(initializer : Library.() -> Library) {
|
||||
val lib = Library()
|
||||
lib.initializer()
|
||||
return lib
|
||||
|
||||
@@ -398,11 +398,9 @@ JetFile: Builder.jet
|
||||
PsiElement(IDENTIFIER)('initializer')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -412,7 +410,7 @@ JetFile: Builder.jet
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
type f1 = fun (T) : X
|
||||
type f1 = (T) -> X
|
||||
// type f1 = {(T) => X}
|
||||
type f2 = fun (T, E) : X
|
||||
type f2 = (T, E) -> X
|
||||
// type f2 = {(T, E) => X}
|
||||
type f_tuple = fun ((T, E)) : X
|
||||
type f_tuple = (#(T, E)) -> X
|
||||
//type f_tuple = {((T, E)) => X}
|
||||
type hof = fun (X) : fun (T) : Y
|
||||
type hof = (X) -> (T) -> Y
|
||||
//type hof = { (X) => {(T) => Y} }
|
||||
type hof2 = fun (fun (X) : Y) : fun (Y) : Z
|
||||
type hof2 = ( (X) -> Y) -> (Y) -> Z
|
||||
//type hof2 = { {(X) => Y} => {(Y) => Z} }
|
||||
|
||||
|
||||
type Comparison<in T> = fun (a : T, b : T) : Int
|
||||
type Comparison<in T> = (a : T, b : T) -> Int
|
||||
//type Comparison<in T> = {(a : T, b : T) => Int}
|
||||
type Equality<in T> = fun (a : T, b : T) : Boolean
|
||||
type Equality<in T> = (a : T, b : T) -> Boolean
|
||||
//type Equality<in T> = {(a : T, b : T) => Boolean}
|
||||
type HashFunction<in T> = fun (obj : T) : Int
|
||||
type HashFunction<in T> = (obj : T) -> Int
|
||||
//type HashFunction<in T> = {(obj : T) => Int}
|
||||
type Runnable = fun () : ()
|
||||
type Runnable = () -> #()
|
||||
//type Runnable = {() => ()}
|
||||
type Function1<in T, out R> = fun (input : T) : R
|
||||
type Function1<in T, out R> = (input : T) -> R
|
||||
//type Function1<in T, out R> = {(input : T) => R}
|
||||
|
||||
|
||||
val f1 = {(t : T) : X => something(t)}
|
||||
val f1 = {(t : T) : X -> something(t)}
|
||||
fun f1(t : T) : X = something(t)
|
||||
|
||||
val f1 = {(t : T) => something(t)}
|
||||
val f1 = {(T) : X => something(it)}
|
||||
val f1 = {t => something(t)}
|
||||
val f1 = {(t : T) -> something(t)}
|
||||
val f1 = {(T) : X -> something(it)}
|
||||
val f1 = {t -> something(t)}
|
||||
val f1 = {something(it)}
|
||||
|
||||
val f1 : fun (T) : X = {X()}
|
||||
val f1 : (T) -> X = {X()}
|
||||
|
||||
|
||||
@@ -10,11 +10,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -24,7 +22,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -41,11 +39,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -62,7 +58,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('E')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -79,16 +75,15 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
TUPLE_TYPE
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -103,7 +98,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(RPAR)(')')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -120,11 +115,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -134,12 +127,10 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -149,7 +140,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -166,18 +157,15 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -187,7 +175,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -195,12 +183,10 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -210,7 +196,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('Y')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -233,11 +219,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -262,7 +246,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -285,11 +269,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -314,7 +296,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -337,11 +319,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -355,7 +335,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -372,19 +352,18 @@ JetFile: FunctionsAndTypes.jet
|
||||
TYPE_PARAMETER_LIST
|
||||
<empty list>
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
TUPLE_TYPE
|
||||
PsiElement(HASH)('#')
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace('\n')
|
||||
@@ -411,11 +390,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -429,7 +406,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -468,7 +445,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
@@ -541,7 +518,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
@@ -578,7 +555,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
REFERENCE_EXPRESSION
|
||||
PsiElement(IDENTIFIER)('X')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
@@ -606,7 +583,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('t')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
CALL_EXPRESSION
|
||||
@@ -648,11 +625,9 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('f1')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -662,7 +637,7 @@ JetFile: FunctionsAndTypes.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
|
||||
@@ -24,11 +24,11 @@ class Graph<V, E> {
|
||||
|
||||
fun neighbours(v : Vertex<V>) = edges.filter{it.from == v}.map{it.to} // type is IIterable<Vertex<V>>
|
||||
|
||||
fun dfs(handler : fun (V) : Unit) {
|
||||
fun dfs(handler : (V) -> Unit) {
|
||||
val visited = HashSet<Vertex<V>>()
|
||||
vertices.foreach{dfs(it, visited, handler)}
|
||||
|
||||
fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) {
|
||||
fun dfs(current : Vertex<V>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) {
|
||||
if (!visited.add(current))
|
||||
return
|
||||
handler(current)
|
||||
@@ -36,7 +36,7 @@ class Graph<V, E> {
|
||||
}
|
||||
}
|
||||
|
||||
public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : fun (V) : Unit) {
|
||||
public fun traverse(pending : IPushPop<Vertex<V>>, visited : ISet<Vertex<V>>, handler : (V) -> Unit) {
|
||||
vertices.foreach {
|
||||
if (!visited.add(it))
|
||||
continue
|
||||
@@ -44,7 +44,7 @@ class Graph<V, E> {
|
||||
while (!pending.isEmpty) {
|
||||
val current = pending.pop()
|
||||
handler(current);
|
||||
neighbours(current).foreach { n =>
|
||||
neighbours(current).foreach { n ->
|
||||
if (visited.add(n)) {
|
||||
pending.push(n)
|
||||
}
|
||||
|
||||
@@ -469,11 +469,9 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('handler')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -483,7 +481,7 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('V')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -612,11 +610,9 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('handler')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -626,7 +622,7 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('V')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -784,11 +780,9 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('handler')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -798,7 +792,7 @@ JetFile: Graph.jet
|
||||
PsiElement(IDENTIFIER)('V')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -935,7 +929,7 @@ JetFile: Graph.jet
|
||||
VALUE_PARAMETER
|
||||
PsiElement(IDENTIFIER)('n')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
IF
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
fun foo() {
|
||||
l filter {it.x} map {it.foo} aggregate {(a, b) => a + b}
|
||||
l filter {it.x} map {it.foo} aggregate {(a, b) -> a + b}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ JetFile: LINQ.jet
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
BLOCK
|
||||
BINARY_EXPRESSION
|
||||
|
||||
@@ -16,7 +16,7 @@ class List<T> {
|
||||
|
||||
}
|
||||
|
||||
fun <E, T, R> Map<E, T>.map(f : fun (E) : R) : T<R> where
|
||||
fun <E, T, R> Map<E, T>.map(f : (E) -> R) : T<R> where
|
||||
T : Iterable<E>,
|
||||
class object T : Buildable<E, T> = {
|
||||
val builder = T.newBuilder()
|
||||
|
||||
@@ -242,11 +242,9 @@ JetFile: PolymorphicClassObjects.jet
|
||||
PsiElement(IDENTIFIER)('f')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -256,7 +254,7 @@ JetFile: PolymorphicClassObjects.jet
|
||||
PsiElement(IDENTIFIER)('E')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[inline] fun with<T>(receiver : T, body : fun T.() : Unit) = receiver.body()
|
||||
[inline] fun with<T>(receiver : T, body : T.() -> Unit) = receiver.body()
|
||||
|
||||
fun example() {
|
||||
|
||||
|
||||
@@ -39,11 +39,9 @@ JetFile: With.jet
|
||||
PsiElement(IDENTIFIER)('body')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
REFERENCE_EXPRESSION
|
||||
@@ -53,7 +51,7 @@ JetFile: With.jet
|
||||
PsiElement(LPAR)('(')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
type Comparison<in T> = fun (T, T) : Int
|
||||
type Comparison<in T> = (T, T) -> Int
|
||||
|
||||
fun naturalOrder<in T : Comparable<T>>(a : T, b : T) : Int = a.compareTo(b)
|
||||
|
||||
@@ -8,9 +8,9 @@ enum class ComparisonResult {
|
||||
LS; EQ; GR
|
||||
}
|
||||
|
||||
type MatchableComparison<in T> = fun (T, T) : ComparisonResult
|
||||
type MatchableComparison<in T> = (T, T) -> ComparisonResult
|
||||
|
||||
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {(a, b) =>
|
||||
fun asMatchableComparison<T>(cmp : Comparison<T>) : MatchableComparison<T> = {(a, b) ->
|
||||
val res = cmp(a, b)
|
||||
if (res == 0) return ComparisonResult.EQ
|
||||
if (res < 0) return ComparisonResult.LS
|
||||
|
||||
@@ -16,11 +16,9 @@ JetFile: Comparison.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -37,7 +35,7 @@ JetFile: Comparison.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -255,11 +253,9 @@ JetFile: Comparison.jet
|
||||
PsiElement(GT)('>')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(EQ)('=')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
FUNCTION_TYPE
|
||||
PsiElement(fun)('fun')
|
||||
PsiWhiteSpace(' ')
|
||||
VALUE_PARAMETER_LIST
|
||||
PsiElement(LPAR)('(')
|
||||
VALUE_PARAMETER
|
||||
@@ -276,7 +272,7 @@ JetFile: Comparison.jet
|
||||
PsiElement(IDENTIFIER)('T')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(COLON)(':')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace(' ')
|
||||
TYPE_REFERENCE
|
||||
USER_TYPE
|
||||
@@ -343,7 +339,7 @@ JetFile: Comparison.jet
|
||||
PsiElement(IDENTIFIER)('b')
|
||||
PsiElement(RPAR)(')')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(DOUBLE_ARROW)('=>')
|
||||
PsiElement(ARROW)('->')
|
||||
PsiWhiteSpace('\n ')
|
||||
BLOCK
|
||||
PROPERTY
|
||||
|
||||
Reference in New Issue
Block a user