diff --git a/.gitignore b/.gitignore index c6786af..44d8999 100644 --- a/.gitignore +++ b/.gitignore @@ -13,10 +13,13 @@ .idea/**/sqlDataSources.xml .idea/**/dynamic.xml .idea/**/uiDesigner.xml +.idea/kotlinc.xml # Gradle: .idea/**/gradle.xml .idea/**/libraries +.idea/misc.xml +.idea/rholang-idea.iml # CMake cmake-build-debug/ diff --git a/src/coop/rchain/lang/Rho.bnf b/src/coop/rchain/lang/Rho.bnf index 2f05be7..7e36b08 100644 --- a/src/coop/rchain/lang/Rho.bnf +++ b/src/coop/rchain/lang/Rho.bnf @@ -161,7 +161,7 @@ Name_ ::= "_" | NameVar | AT Proc12 { implements = [ "coop.rchain.lang.psi.RhoNamedElement" ] mixin = "coop.rchain.lang.psi.RhoNamedElementImpl" } -RhoName ::= Name_ ("," Name_)* +RhoName ::= Name_ (COMMA Name_)* // Bundle Bundle ::= "bundle+" | "bundle-" | "bundle0" | "bundle" @@ -188,7 +188,7 @@ Case ::= Case_+ // Name Declarations // Eventually will have IOPairs. -NameDecl ::= NameDecl_ ("," NameDecl_)* +NameDecl ::= NameDecl_ (COMMA NameDecl_)* NameDecl_ ::= NameVar OPEN_PAREN URI CLOSE_PAREN | NameVar // Booleans: @@ -199,14 +199,15 @@ Ground ::= Bool | Integer | StringLit | URI // Collections: private CollectList ::= OPEN_SQUARE_BRACKET [Proc] ProcRemainder CLOSE_SQUARE_BRACKET -private CollectTuple ::= Tuple private CollectSet ::= "Set" "(" [Proc] ")" -private CollectMap ::= "{" [KeyValuePair] "}" + +// we use Proc_ here instead of Proc to avoid confusion of Grammar kit +private CollectTuple ::= OPEN_PAREN Proc_ (COMMA Proc_)+ CLOSE_PAREN | OPEN_PAREN Proc ",)" +CollectMap ::= "{" [KeyValuePair] "}" // important: we use Proc_ here, because if we use Proc, they will all consume COMMA private KeyValuePair_ ::= Proc COLON Proc_ KeyValuePair ::= KeyValuePair_ (COMMA KeyValuePair_)* -private Tuple ::= OPEN_PAREN Proc ",)" | OPEN_PAREN Proc COMMA [Proc] CLOSE_PAREN diff --git a/src/coop/rchain/lang/formatter/RholangSpaceProcessor.kt b/src/coop/rchain/lang/formatter/RholangSpaceProcessor.kt index 6a8778d..157ee9b 100644 --- a/src/coop/rchain/lang/formatter/RholangSpaceProcessor.kt +++ b/src/coop/rchain/lang/formatter/RholangSpaceProcessor.kt @@ -3,15 +3,9 @@ package coop.rchain.lang.formatter import com.intellij.formatting.Block import com.intellij.formatting.Spacing import com.intellij.lang.ASTNode -import com.intellij.openapi.editor.Document -import com.intellij.openapi.util.TextRange -import com.intellij.psi.PsiElement import com.intellij.psi.codeStyle.CommonCodeStyleSettings import com.intellij.psi.formatter.common.AbstractBlock -import com.intellij.psi.tree.IElementType -import com.intellij.psi.util.PsiTreeUtil import coop.rchain.lang.psi.RhoTypes -import coop.rchain.lang.util.PsiTreeHelpUtil class RholangSpaceProcessor(private val myNode: ASTNode, private val mySettings: CommonCodeStyleSettings) { @@ -20,7 +14,6 @@ class RholangSpaceProcessor(private val myNode: ASTNode, private val mySettings: return null } - val elementType = myNode.elementType val parentType = if (myNode.treeParent == null) null else myNode.treeParent.elementType val node1 = child1.node val type1 = node1.elementType @@ -28,7 +21,7 @@ class RholangSpaceProcessor(private val myNode: ASTNode, private val mySettings: val type2 = node2.elementType if (type1 === RhoTypes.OPEN_BRACE && (type2 === RhoTypes.PROC || type2 === RhoTypes.CASE)) { - if(parentType !== RhoTypes.NAME_) { + if (parentType !== RhoTypes.NAME_) { return Spacing.createSpacing(1, 1, 1, false, 0) } } @@ -36,11 +29,11 @@ class RholangSpaceProcessor(private val myNode: ASTNode, private val mySettings: return Spacing.createSpacing(1, 1, 1, false, 0) } - if(type1 === RhoTypes.CASE_ || type2 === RhoTypes.CASE_){ + if (type1 === RhoTypes.CASE_ || type2 === RhoTypes.CASE_) { return Spacing.createSpacing(1, 1, 1, false, 0) } - if(type2 === RhoTypes.CLOSE_BRACE && parentType === RhoTypes.NAME_){ + if (type2 === RhoTypes.CLOSE_BRACE && (parentType === RhoTypes.NAME_ || myNode.elementType === RhoTypes.COLLECT_MAP)) { return null } diff --git a/test/coop/rchain/ide/folding/RholangCodeInsightTest.kt b/test/coop/rchain/ide/folding/RholangCodeInsightTest.kt index 5d8a811..ab56899 100644 --- a/test/coop/rchain/ide/folding/RholangCodeInsightTest.kt +++ b/test/coop/rchain/ide/folding/RholangCodeInsightTest.kt @@ -14,32 +14,39 @@ class RholangCodeInsightTest : LightCodeInsightFixtureTestCase() { } fun testFolding() { - doTestFolding("blockDocComment") doTestFolding("procedure") } - fun testFormatter() { + private fun doFormatterTest(testName: String) { object : WriteCommandAction.Simple(project) { @Throws(Throwable::class) override fun run() { - myFixture.configureByFiles("./ide/formatter/token.rho") + myFixture.configureByFiles("./ide/formatter/$testName.rho") CodeStyleManager.getInstance(project).reformatText(myFixture.file, ContainerUtil.newArrayList(myFixture.file.textRange)) } }.execute() - myFixture.checkResultByFile("./ide/formatter/tokenFormatted.rho") + myFixture.checkResultByFile("./ide/formatter/${testName}Formatted.rho") } - fun testFormatter2() { - object : WriteCommandAction.Simple(project) { - @Throws(Throwable::class) - override fun run() { - myFixture.configureByFiles("./ide/formatter/simpleOne.rho") - CodeStyleManager.getInstance(project).reformatText(myFixture.file, - ContainerUtil.newArrayList(myFixture.file.textRange)) - } - }.execute() - myFixture.checkResultByFile("./ide/formatter/simpleOneFormatted.rho") + fun testComplex() { + doFormatterTest("complex") + } + + fun testUri() { + doFormatterTest("URI") + } + + fun testIfElse() { + doFormatterTest("ifElse") + } + + fun testMapMethod(){ + doFormatterTest("mapMethods") + } + + fun testParens(){ + doFormatterTest("parens") } private fun doTestFolding(testName: String) { diff --git a/testData/ide/formatter/URIFormatted.rho b/testData/ide/formatter/URIFormatted.rho index 9ad827e..fe46ed8 100644 --- a/testData/ide/formatter/URIFormatted.rho +++ b/testData/ide/formatter/URIFormatted.rho @@ -1,12 +1,6 @@ -// A simple Hello World contract -new helloworld in { - contract helloworld( world ) = { - for( msg <- world ) { - print(msg) - } - } | - new world in { - helloworld!(world) | - world!("Hello World") - } +new ack, stdout(`rho:io:stdout`), stdoutAck(`rho:io:stdoutAck`) in { + stdoutAck!("hello, world!", *ack) | + for (_ <- ack) { + stdout!("received") + } } diff --git a/testData/ide/formatter/complexFormatted.rho b/testData/ide/formatter/complexFormatted.rho index daaa2ae..e299b49 100644 --- a/testData/ide/formatter/complexFormatted.rho +++ b/testData/ide/formatter/complexFormatted.rho @@ -1,74 +1,74 @@ new testResult, updateTestResult in { - testResult!(true) | - contract updateTestResult(@bool, return) = { - for(@r <- testResult) { - match [r, bool] { - [true, true] => { - testResult!(true) | - return!(true) - } - _ => { - testResult!(false) | - return!(false) - } + testResult!(true) | + contract updateTestResult(@bool, return) = { + for(@r <- testResult) { + match [r, bool] { + [true, true] => { + testResult!(true) | + return!(true) + } + _ => { + testResult!(false) | + return!(false) + } + } + } + } | + contract @"CoatCheckDemo"(_) = { + new MakeCoatCheck in { + contract MakeCoatCheck(ret) = { + new port, table in { + ret!(*port) | + for(@"new", @arg, ack <= port) { + new ticket in { + ack!(*ticket) | + @{*ticket | *table}!(arg) } + } | + for(@"get", @arg, ack <= port) { + for (@value <- @{arg | *table}) { + @{arg | *table}!(value) | + ack!(value) + } + } | + for(@"set", @arg1, @arg2, ack <= port) { + for (_ <- @{arg1 | *table}) { + @{arg1 | *table}!(arg2) | + ack!(true) + } + } } - } | - contract @"CoatCheckDemo"(_) = { - new MakeCoatCheck in { - contract MakeCoatCheck(ret) = { - new port, table in { - ret!(*port) | - for(@"new", @arg, ack <= port) { - new ticket in { - ack!(*ticket) | - @{*ticket | *table}!(arg) - } - } | - for(@"get", @arg, ack <= port) { - for (@value <- @{arg | *table}) { - @{arg | *table}!(value) | - ack!(value) - } - } | - for(@"set", @arg1, @arg2, ack <= port) { - for (_ <- @{arg1 | *table}) { - @{arg1 | *table}!(arg2) | - ack!(true) - } - } - } + } | + // Usage + new ret, get, set in { + MakeCoatCheck!(*ret) | + for (cc <- ret) { + // Creates new cell with initial value 0 + cc!("new", 0, *ret) | + for (ticket <- ret) { + contract get(return) = { + cc!("get", *ticket, *return) + } | + contract set(@value, return) = { + cc!("set", *ticket, value, *return) } | - // Usage - new ret, get, set in { - MakeCoatCheck!(*ret) | - for (cc <- ret) { - // Creates new cell with initial value 0 - cc!("new", 0, *ret) | - for (ticket <- ret) { - contract get(return) = { - cc!("get", *ticket, *return) - } | - contract set(@value, return) = { - cc!("set", *ticket, value, *return) - } | - get!(*ret) | - for(@r <- ret) { - updateTestResult!(r == 0, *ret) | - for(_ <- ret){ - set!(1, *ret) | - for(_ <- ret) { - get!(*ret) | - for(@r <- ret) { - updateTestResult!(r == 1, *ret) - } - } - } - } - } + get!(*ret) | + for(@r <- ret) { + updateTestResult!(r == 0, *ret) | + for(_ <- ret){ + set!(1, *ret) | + for(_ <- ret) { + get!(*ret) | + for(@r <- ret) { + updateTestResult!(r == 1, *ret) + } } + } } + } } - } | - @"CoatCheckDemo"!(Nil) + } + } + } | + @"CoatCheckDemo"!(Nil) } diff --git a/testData/ide/formatter/ifElse.rho b/testData/ide/formatter/ifElse.rho index e69de29..610af37 100644 --- a/testData/ide/formatter/ifElse.rho +++ b/testData/ide/formatter/ifElse.rho @@ -0,0 +1,7 @@ +new dupe in { + contract dupe(@depth) = { + if (depth <= 0) { Nil } else { + dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) | dupe!(depth - 1) + } + } | dupe!(2) +} diff --git a/testData/ide/formatter/ifElseFormatted.rho b/testData/ide/formatter/ifElseFormatted.rho index e69de29..a6d4bfb 100644 --- a/testData/ide/formatter/ifElseFormatted.rho +++ b/testData/ide/formatter/ifElseFormatted.rho @@ -0,0 +1,19 @@ +new dupe in { + contract dupe(@depth) = { + if (depth <= 0) { + Nil + } else { + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) | + dupe!(depth - 1) + } + } | + dupe!(2) +} diff --git a/testData/ide/formatter/mapMethods.rho b/testData/ide/formatter/mapMethods.rho index e69de29..f09e7c5 100644 --- a/testData/ide/formatter/mapMethods.rho +++ b/testData/ide/formatter/mapMethods.rho @@ -0,0 +1,18 @@ +// all methods modifying the underlying collection return new Map +// prints 1 +new stdout in { stdout!({"one" : 2, "two" : 2, "three" : 3}.get("one")) | + // if element is not present in the map will return Nil -- prints Nil + stdout!({"one" : 1, "two" : 2, "three" : 3}.get("four")) | + // prints false + stdout!({"one" : 1, "two" : 2, "three" : 3}.contains("four")) | + // prints true + stdout!({"one" : 1, "two" : 2, "three" : 3}.contains("three")) | + // prints @{{"three" : 3, "two" : 2}} + stdout!({"one" : 1, "two" : 2, "three" : 3}.delete("one")) | + // doesn't change the collection, prints @{{"one" : 1, "three" : 3, "two" : 2}} + stdout!({"one" : 1, "two" : 2, "three" : 3}.delete("four")) | + // returns new map which is a result of subtracting elements of second map from the base map + stdout!({"one" : 1, "two" : 2, "three" : 3}.diff({"one" : 1, "four": 4})) | + // merges two maps -- returns @{{"four" : 4, "one" : 1, "three" : 3, "two" : 2}} + stdout!({"one" : 1, "two" : 2, "three" : 3}.union({"one" : 1, "four": 4})) +} diff --git a/testData/ide/formatter/mapMethodsFormatted.rho b/testData/ide/formatter/mapMethodsFormatted.rho index 9e7b1ec..fe90e2c 100644 --- a/testData/ide/formatter/mapMethodsFormatted.rho +++ b/testData/ide/formatter/mapMethodsFormatted.rho @@ -1,9 +1,9 @@ // all methods modifying the underlying collection return new Map // prints 1 -new stdout in { stdout!({"one" : 2, "two" : 2, "three" : 3}.get("one")) | +new stdout in { + stdout!({"one" : 2, "two" : 2, "three" : 3}.get("one")) | // if element is not present in the map will return Nil -- prints Nil - stdout!({ - "one" : 1, "two" : 2, "three" : 3}.get("four")) | + stdout!({"one" : 1, "two" : 2, "three" : 3}.get("four")) | // prints false stdout!({"one" : 1, "two" : 2, "three" : 3}.contains("four")) | // prints true diff --git a/testData/ide/formatter/parens.rho b/testData/ide/formatter/parens.rho index e69de29..bfdb963 100644 --- a/testData/ide/formatter/parens.rho +++ b/testData/ide/formatter/parens.rho @@ -0,0 +1,3 @@ +new stdout(`rho:io:stdout`) in {stdout!((2,)) | stdout!(2 * (3 + 5)) | + stdout!(1 + 3) | @(3,)!(2 + 4) | stdout!(3 * (1 + (2 / 2))) +} diff --git a/testData/ide/formatter/parensFormatted.rho b/testData/ide/formatter/parensFormatted.rho index e69de29..af64ef8 100644 --- a/testData/ide/formatter/parensFormatted.rho +++ b/testData/ide/formatter/parensFormatted.rho @@ -0,0 +1,7 @@ +new stdout(`rho:io:stdout`) in { + stdout!((2,)) | + stdout!(2 * (3 + 5)) | + stdout!(1 + 3) | + @(3,)!(2 + 4) | + stdout!(3 * (1 + (2 / 2))) +} diff --git a/testData/lexer/token.txt b/testData/lexer/token.txt index 0c4456c..71b0b36 100644 --- a/testData/lexer/token.txt +++ b/testData/lexer/token.txt @@ -20,10 +20,10 @@ ID_NAME ('token') WHITE_SPACE (' ') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('total_supply') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('return_channel') ) (')') @@ -35,10 +35,10 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('allowed_channel') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balances_channel') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('owner_channel') WHITE_SPACE (' ') @@ -96,7 +96,7 @@ ID_NAME ('balances') ID_NAME ('insert') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('total_supply') ) (')') @@ -110,19 +110,19 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('transfer') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('transfer_from') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('approve') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('allowance') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('contract_owner') WHITE_SPACE (' ') @@ -135,13 +135,13 @@ WHITE_SPACE (' ') ID_NAME ('transfer') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -166,7 +166,7 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('x') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('y') WHITE_SPACE (' ') @@ -182,7 +182,7 @@ ID_NAME ('balances') ID_NAME ('getOrElse') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -198,7 +198,7 @@ ID_NAME ('balances') ID_NAME ('getOrElse') ( ('(') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -239,14 +239,14 @@ WHITE_SPACE (' ') >= ('>=') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE ('\n ') ID_NAME ('amount') WHITE_SPACE (' ') > ('>') WHITE_SPACE (' ') Integer ('0') -comma (',') +, (',') WHITE_SPACE ('\n ') ID_NAME ('balance_of_receiver') WHITE_SPACE (' ') @@ -264,10 +264,10 @@ WHITE_SPACE (' ') WHITE_SPACE ('\n ') [ ('[') true ('true') -comma (',') +, (',') WHITE_SPACE (' ') true ('true') -comma (',') +, (',') WHITE_SPACE (' ') true ('true') ] (']') @@ -287,7 +287,7 @@ WHITE_SPACE ('\n ') ID_NAME ('insert') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_sender') WHITE_SPACE (' ') @@ -301,7 +301,7 @@ WHITE_SPACE ('\n ') ID_NAME ('insert') ( ('(') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_receiver') + ('+') @@ -363,16 +363,16 @@ WHITE_SPACE (' ') ID_NAME ('transfer_from') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('from') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -406,10 +406,10 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('x') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('y') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('z') WHITE_SPACE (' ') @@ -425,7 +425,7 @@ ID_NAME ('balances') ID_NAME ('getOrElse') ( ('(') ID_NAME ('from') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -441,10 +441,10 @@ ID_NAME ('allowed') ID_NAME ('getOrElse') ( ('(') ID_NAME ('from') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -460,7 +460,7 @@ ID_NAME ('balances') ID_NAME ('getOrElse') ( ('(') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -510,21 +510,21 @@ WHITE_SPACE (' ') >= ('>=') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE ('\n ') ID_NAME ('sender_allowed') WHITE_SPACE (' ') >= ('>=') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE ('\n ') ID_NAME ('amount') WHITE_SPACE (' ') > ('>') WHITE_SPACE (' ') Integer ('0') -comma (',') +, (',') WHITE_SPACE ('\n ') ID_NAME ('balance_of_receiver') WHITE_SPACE (' ') @@ -542,13 +542,13 @@ WHITE_SPACE (' ') WHITE_SPACE ('\n ') [ ('[') true ('true') -comma (',') +, (',') WHITE_SPACE (' ') true ('true') -comma (',') +, (',') WHITE_SPACE (' ') true ('true') -comma (',') +, (',') WHITE_SPACE (' ') true ('true') ] (']') @@ -568,7 +568,7 @@ WHITE_SPACE ('\n ') ID_NAME ('insert') ( ('(') ID_NAME ('from') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_sender') WHITE_SPACE (' ') @@ -582,7 +582,7 @@ WHITE_SPACE ('\n ') ID_NAME ('insert') ( ('(') ID_NAME ('to') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_receiver') WHITE_SPACE (' ') @@ -604,10 +604,10 @@ ID_NAME ('allowed') ID_NAME ('insert') ( ('(') ID_NAME ('from') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('sender_allowed') WHITE_SPACE (' ') @@ -683,13 +683,13 @@ WHITE_SPACE (' ') ID_NAME ('approve') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('spender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('amount') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -719,9 +719,9 @@ ID_NAME ('allowed') ID_NAME ('insert') ( ('(') ID_NAME ('message_sender') -comma (',') +, (',') ID_NAME ('spender') -comma (',') +, (',') ID_NAME ('amount') ) (')') ) (')') @@ -745,7 +745,7 @@ WHITE_SPACE (' ') ID_NAME ('balance_of') ( ('(') ID_NAME ('owner') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -775,7 +775,7 @@ ID_NAME ('balances') ID_NAME ('getOrElse') ( ('(') ID_NAME ('owner') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('0') ) (')') @@ -800,10 +800,10 @@ WHITE_SPACE (' ') ID_NAME ('allowance') ( ('(') ID_NAME ('owner') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('spender') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -841,9 +841,9 @@ ID_NAME ('allowed') ID_NAME ('getOrElse') ( ('(') ID_NAME ('owner') -comma (',') +, (',') ID_NAME ('spender') -comma (',') +, (',') Integer ('0') ) (')') ) (')') @@ -909,37 +909,37 @@ ID_NAME ('Map') ID_NAME ('insertMany') ( ('(') StringLit ('"transfer"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('transfer') -comma (',') +, (',') WHITE_SPACE (' ') StringLit ('"transfer_from"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('transfer_from') -comma (',') +, (',') WHITE_SPACE ('\n ') StringLit ('"approve"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('approve') -comma (',') +, (',') WHITE_SPACE (' ') StringLit ('"balance_of"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of') -comma (',') +, (',') WHITE_SPACE (' ') StringLit ('"allowance"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('allowance') -comma (',') +, (',') WHITE_SPACE ('\n ') StringLit ('"contract_owner"') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('contract_owner') ) (')') @@ -958,10 +958,10 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('rtn') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('me') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('they') WHITE_SPACE (' ') @@ -973,10 +973,10 @@ ID_NAME ('token') ! ('!') ( ('(') ID_NAME ('me') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('100') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn') ) (')') @@ -999,7 +999,7 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('unused_rtn') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_rtn') WHITE_SPACE (' ') @@ -1017,13 +1017,13 @@ StringLit ('"transfer"') ! ('!') ( ('(') ID_NAME ('me') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('they') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('50') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('unused_rtn') ) (')') @@ -1040,7 +1040,7 @@ StringLit ('"balance_of"') ! ('!') ( ('(') ID_NAME ('they') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_rtn') ) (')') @@ -1080,10 +1080,10 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('rtn2') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('me2') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('they2') WHITE_SPACE (' ') @@ -1095,10 +1095,10 @@ ID_NAME ('token') ! ('!') ( ('(') ID_NAME ('me2') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('1000') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('rtn2') ) (')') @@ -1121,7 +1121,7 @@ WHITE_SPACE ('\n ') new ('new') WHITE_SPACE (' ') ID_NAME ('unused_rtn2') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_rtn2') WHITE_SPACE (' ') @@ -1139,13 +1139,13 @@ StringLit ('"transfer"') ! ('!') ( ('(') ID_NAME ('me2') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('they2') -comma (',') +, (',') WHITE_SPACE (' ') Integer ('500') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('unused_rtn2') ) (')') @@ -1162,7 +1162,7 @@ StringLit ('"balance_of"') ! ('!') ( ('(') ID_NAME ('they2') -comma (',') +, (',') WHITE_SPACE (' ') ID_NAME ('balance_of_rtn2') ) (')') diff --git a/testData/parser/token.rho b/testData/parser/token.rho index 133f097..ab7df63 100644 --- a/testData/parser/token.rho +++ b/testData/parser/token.rho @@ -15,5 +15,10 @@ new testResult, philosopher1, philosopher2 in { } | for(_ <- philosopher1; _ <- philosopher2) { testResult!(true) - } + } | + for(@(suit1,rank1)<-p1Ch; @{suit2,rank2,rank3,rank4}<-p2ch){ + testResult!(true) + } | + (1,) | (1,2) | (1,2,3) + } diff --git a/testData/parser/token.txt b/testData/parser/token.txt index d1c95e7..4da56c0 100644 --- a/testData/parser/token.txt +++ b/testData/parser/token.txt @@ -1,339 +1,525 @@ Rholang File - RhoPNewImpl(P_NEW) - PsiElement(new)('new') - PsiWhiteSpace(' ') - RhoNameDeclImpl(NAME_DECL) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('testResult') - PsiElement(comma)(',') + RhoProcImpl(PROC) + RhoPNewImpl(P_NEW) + PsiElement(new)('new') PsiWhiteSpace(' ') - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher1') - PsiElement(comma)(',') - PsiWhiteSpace(' ') - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher2') - PsiWhiteSpace(' ') - PsiElement(in)('in') - PsiWhiteSpace(' ') - RhoProc3Impl(PROC_3) - RhoProcBlockImpl(PROC_BLOCK) - PsiElement({)('{') - PsiWhiteSpace('\n ') - RhoPNewImpl(P_NEW) - PsiElement(new)('new') - PsiWhiteSpace(' ') - RhoNameDeclImpl(NAME_DECL) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('north') - PsiElement(comma)(',') - PsiWhiteSpace(' ') + RhoNameDeclImpl(NAME_DECL) + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('south') - PsiElement(comma)(',') - PsiWhiteSpace(' ') + PsiElement(ID_NAME)('testResult') + PsiElement(,)(',') + PsiWhiteSpace(' ') + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('knife') - PsiElement(comma)(',') - PsiWhiteSpace(' ') + PsiElement(ID_NAME)('philosopher1') + PsiElement(,)(',') + PsiWhiteSpace(' ') + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('spoon') - PsiWhiteSpace(' ') - PsiElement(in)('in') - PsiWhiteSpace(' ') - RhoProc3Impl(PROC_3) - RhoProcBlockImpl(PROC_BLOCK) - PsiElement({)('{') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) + PsiElement(ID_NAME)('philosopher2') + PsiWhiteSpace(' ') + PsiElement(in)('in') + PsiWhiteSpace(' ') + RhoProc3Impl(PROC_3) + RhoProcBlockImpl(PROC_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoPNewImpl(P_NEW) + PsiElement(new)('new') + PsiWhiteSpace(' ') + RhoNameDeclImpl(NAME_DECL) + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) PsiElement(ID_NAME)('north') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - PsiElement(*)('*') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('knife') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) + PsiElement(,)(',') + PsiWhiteSpace(' ') + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) PsiElement(ID_NAME)('south') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - PsiElement(*)('*') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('spoon') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoPInputImpl(P_INPUT) - PsiElement(for)('for') + PsiElement(,)(',') PsiWhiteSpace(' ') - PsiElement(()('(') - RhoReceiptImpl(RECEIPT) - RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) - RhoLinearBindImpl(LINEAR_BIND) + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knife') + PsiElement(,)(',') + PsiWhiteSpace(' ') + RhoNameDecl_Impl(NAME_DECL_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spoon') + PsiWhiteSpace(' ') + PsiElement(in)('in') + PsiWhiteSpace(' ') + RhoProc3Impl(PROC_3) + RhoProcBlockImpl(PROC_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) RhoRhoNameImpl(RHO_NAME) RhoName_Impl(NAME_) - PsiElement(@)('@') - RhoProcVarImpl(PROC_VAR) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('knf') - PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('north') - PsiElement(;)(';') - PsiWhiteSpace(' ') + PsiElement(ID_NAME)('north') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + PsiElement(*)('*') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knife') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) RhoRhoNameImpl(RHO_NAME) RhoName_Impl(NAME_) - PsiElement(@)('@') - RhoProcVarImpl(PROC_VAR) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('spn') + PsiElement(ID_NAME)('south') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + PsiElement(*)('*') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spoon') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoPInputImpl(P_INPUT) + PsiElement(for)('for') PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') + PsiElement(()('(') + RhoReceiptImpl(RECEIPT) + RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) + RhoLinearBindImpl(LINEAR_BIND) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knf') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('north') + PsiElement(;)(';') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spn') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('south') + PsiElement())(')') PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) + RhoProcBlockImpl(PROC_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('philosopher1') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + RhoBoolImpl(BOOL) + PsiElement(true)('true') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('north') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knf') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('south') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spn') + PsiElement())(')') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoPInputImpl(P_INPUT) + PsiElement(for)('for') + PsiWhiteSpace(' ') + PsiElement(()('(') + RhoReceiptImpl(RECEIPT) + RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) + RhoLinearBindImpl(LINEAR_BIND) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spn') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('south') + PsiElement(;)(';') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knf') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('north') + PsiElement())(')') + PsiWhiteSpace(' ') + RhoProcBlockImpl(PROC_BLOCK) + PsiElement({)('{') + PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('philosopher2') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + RhoBoolImpl(BOOL) + PsiElement(true)('true') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('north') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('knf') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('south') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('spn') + PsiElement())(')') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoPInputImpl(P_INPUT) + PsiElement(for)('for') + PsiElement(()('(') + RhoReceiptImpl(RECEIPT) + RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) + RhoLinearBindImpl(LINEAR_BIND) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(_)('_') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('south') - PsiElement())(')') - PsiWhiteSpace(' ') + PsiElement(ID_NAME)('philosopher1') + PsiElement(;)(';') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(_)('_') + PsiWhiteSpace(' ') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('philosopher2') + PsiElement())(')') + PsiWhiteSpace(' ') + RhoProcBlockImpl(PROC_BLOCK) PsiElement({)('{') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher1') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoGroundImpl(GROUND) - RhoBoolImpl(BOOL) - PsiElement(true)('true') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('north') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('knf') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('south') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('spn') - PsiElement())(')') PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('testResult') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + RhoBoolImpl(BOOL) + PsiElement(true)('true') + PsiElement())(')') + PsiWhiteSpace('\n ') PsiElement(})('}') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoPInputImpl(P_INPUT) - PsiElement(for)('for') - PsiWhiteSpace(' ') - PsiElement(()('(') - RhoReceiptImpl(RECEIPT) - RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) - RhoLinearBindImpl(LINEAR_BIND) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - PsiElement(@)('@') - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('spn') - PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoPInputImpl(P_INPUT) + PsiElement(for)('for') + PsiElement(()('(') + RhoReceiptImpl(RECEIPT) + RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) + RhoLinearBindImpl(LINEAR_BIND) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoCollectionImpl(COLLECTION) + PsiElement(()('(') + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('suit1') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('rank1') + PsiElement())(')') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('south') - PsiElement(;)(';') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - PsiElement(@)('@') - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('knf') - PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) + PsiElement(ID_NAME)('p1Ch') + PsiElement(;)(';') + PsiWhiteSpace(' ') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + PsiElement(@)('@') + RhoProcBlockImpl(PROC_BLOCK) + PsiElement({)('{') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('suit2') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('rank2') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('rank3') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoProcVarImpl(PROC_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('rank4') + PsiElement(})('}') + RhoNameRemainderImpl(NAME_REMAINDER) + + PsiElement(<)('<') + PsiElement(-)('-') + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) RhoVarImpl(VAR) - PsiElement(ID_NAME)('north') - PsiElement())(')') - PsiWhiteSpace(' ') + PsiElement(ID_NAME)('p2ch') + PsiElement())(')') + RhoProcBlockImpl(PROC_BLOCK) PsiElement({)('{') - PsiWhiteSpace('\n ') + PsiWhiteSpace('\n ') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoRhoNameImpl(RHO_NAME) + RhoName_Impl(NAME_) + RhoNameVarImpl(NAME_VAR) + RhoVarImpl(VAR) + PsiElement(ID_NAME)('testResult') + RhoSendImpl(SEND) + PsiElement(!)('!') + RhoProcParenOptionImpl(PROC_PAREN_OPTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + RhoBoolImpl(BOOL) + PsiElement(true)('true') + PsiElement())(')') + PsiWhiteSpace('\n ') + PsiElement(})('}') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace('\n ') + RhoProc3Impl(PROC_3) + RhoCollectionImpl(COLLECTION) + PsiElement(()('(') + RhoProcImpl(PROC) + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + PsiElement(Integer)('1') + PsiElement(,)(',') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace(' ') + RhoProc3Impl(PROC_3) + RhoCollectionImpl(COLLECTION) + PsiElement(()('(') RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher2') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoGroundImpl(GROUND) - RhoBoolImpl(BOOL) - PsiElement(true)('true') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') + RhoGroundImpl(GROUND) + PsiElement(Integer)('1') + PsiElement(,)(',') RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('north') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('knf') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') + RhoGroundImpl(GROUND) + PsiElement(Integer)('2') + PsiElement())(')') + PsiWhiteSpace(' ') + PsiElement(|)('|') + PsiWhiteSpace(' ') + RhoProc3Impl(PROC_3) + RhoCollectionImpl(COLLECTION) + PsiElement(()('(') RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('south') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoProcVarImpl(PROC_VAR) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('spn') - PsiElement())(')') - PsiWhiteSpace('\n ') - PsiElement(})('}') - PsiWhiteSpace('\n ') - PsiElement(})('}') - PsiWhiteSpace(' ') - PsiElement(|)('|') - PsiWhiteSpace('\n ') - RhoPInputImpl(P_INPUT) - PsiElement(for)('for') - PsiElement(()('(') - RhoReceiptImpl(RECEIPT) - RhoReceiptLinearImplImpl(RECEIPT_LINEAR_IMPL) - RhoLinearBindImpl(LINEAR_BIND) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - PsiElement(_)('_') - PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher1') - PsiElement(;)(';') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - PsiElement(_)('_') - PsiWhiteSpace(' ') - RhoNameRemainderImpl(NAME_REMAINDER) - - PsiElement(<)('<') - PsiElement(-)('-') - PsiWhiteSpace(' ') - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('philosopher2') - PsiElement())(')') - PsiWhiteSpace(' ') - PsiElement({)('{') - PsiWhiteSpace('\n ') - RhoProc3Impl(PROC_3) - RhoRhoNameImpl(RHO_NAME) - RhoName_Impl(NAME_) - RhoVarImpl(VAR) - PsiElement(ID_NAME)('testResult') - RhoSendImpl(SEND) - PsiElement(!)('!') - RhoProcParenOptionImpl(PROC_PAREN_OPTION) - PsiElement(()('(') - RhoProc3Impl(PROC_3) - RhoGroundImpl(GROUND) - RhoBoolImpl(BOOL) - PsiElement(true)('true') - PsiElement())(')') - PsiWhiteSpace('\n ') + RhoGroundImpl(GROUND) + PsiElement(Integer)('1') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + PsiElement(Integer)('2') + PsiElement(,)(',') + RhoProc3Impl(PROC_3) + RhoGroundImpl(GROUND) + PsiElement(Integer)('3') + PsiElement())(')') + PsiWhiteSpace('\n\n') PsiElement(})('}') - PsiWhiteSpace('\n') - PsiElement(})('}')