diff --git a/build.gradle.kts b/build.gradle.kts index 7c3cb0357..5240b5f8c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,7 +6,7 @@ plugins { group = "vadyushkins" -version = "1.0.7" +version = "1.0.8" repositories { mavenCentral() } diff --git a/src/main/kotlin/org/kotgll/rsm/grammar/RSMRead.kt b/src/main/kotlin/org/kotgll/rsm/grammar/RSMRead.kt index 51d643fdd..843e91b6c 100644 --- a/src/main/kotlin/org/kotgll/rsm/grammar/RSMRead.kt +++ b/src/main/kotlin/org/kotgll/rsm/grammar/RSMRead.kt @@ -18,11 +18,11 @@ fun readRSMFromTXT(pathToTXT: String): RSMState { return rsmStates[y.hashCode]!! } - val nonterminals: HashMap = HashMap() + val nonterminals: HashMap = HashMap() fun makeNonterminal(name: String): Nonterminal { val y = Nonterminal(name) - if (!nonterminals.containsKey(y.hashCode)) nonterminals[y.hashCode] = y - return nonterminals[y.hashCode]!! + if (!nonterminals.contains(y)) nonterminals[y] = y + return nonterminals[y]!! } val startStateRegex = diff --git a/src/test/kotlin/cli/TestCFGReadWriteTXT.kt b/src/test/kotlin/cli/TestCFGReadWriteTXT.kt index 62cb2126b..113b429e0 100644 --- a/src/test/kotlin/cli/TestCFGReadWriteTXT.kt +++ b/src/test/kotlin/cli/TestCFGReadWriteTXT.kt @@ -136,15 +136,13 @@ class TestCFGReadWriteTXT { } @Test - fun `'reg1' cfg`() { + fun `'rdf_reg1' cfg`() { val nonterminalS = Nonterminal("S") nonterminalS.addAlternative(Alternative(listOf())) - nonterminalS.addAlternative(Alternative(listOf(Terminal("type")))) - nonterminalS.addAlternative(Alternative(listOf(Terminal("subClassOf")))) - nonterminalS.addAlternative(Alternative(listOf(nonterminalS, nonterminalS))) + nonterminalS.addAlternative(Alternative(listOf(Terminal("type"), nonterminalS))) - val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/reg1.txt" + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg1.txt" writeCFGToTXT(nonterminalS, pathToTXT) val actualNonterminal = readCFGFromTXT(pathToTXT) @@ -153,17 +151,33 @@ class TestCFGReadWriteTXT { } @Test - fun `'reg2' cfg`() { + fun `'rdf_reg2' cfg`() { val nonterminalS = Nonterminal("S") + val nonterminalA = Nonterminal("A") nonterminalS.addAlternative(Alternative(listOf())) - nonterminalS.addAlternative(Alternative(listOf(Terminal("type")))) - nonterminalS.addAlternative(Alternative(listOf(Terminal("type_r")))) - nonterminalS.addAlternative(Alternative(listOf(Terminal("subClassOf")))) - nonterminalS.addAlternative(Alternative(listOf(Terminal("subClassOf_r")))) - nonterminalS.addAlternative(Alternative(listOf(nonterminalS, nonterminalS))) + nonterminalS.addAlternative(Alternative(listOf(Terminal("type"), nonterminalA))) + + nonterminalA.addAlternative(Alternative(listOf())) + nonterminalA.addAlternative(Alternative(listOf(Terminal("subClassOf"), nonterminalA))) + + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg2.txt" + writeCFGToTXT(nonterminalS, pathToTXT) + val actualNonterminal = readCFGFromTXT(pathToTXT) + + assertEquals(expected = nonterminalS, actual = actualNonterminal) + assertEquals(expected = nonterminalS.alternatives, actual = actualNonterminal.alternatives) + } + + @Test + fun `'rdf_reg3' cfg`() { + val nonterminalS = Nonterminal("S") + + nonterminalS.addAlternative(Alternative(listOf())) + nonterminalS.addAlternative(Alternative(listOf(Terminal("type"), nonterminalS))) + nonterminalS.addAlternative(Alternative(listOf(Terminal("subClassOf"), nonterminalS))) - val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/reg2.txt" + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg3.txt" writeCFGToTXT(nonterminalS, pathToTXT) val actualNonterminal = readCFGFromTXT(pathToTXT) @@ -172,7 +186,7 @@ class TestCFGReadWriteTXT { } @Test - fun `'reg3' cfg`() { + fun `'rdf_reg4' cfg`() { val nonterminalS = Nonterminal("S") val nonterminalA = Nonterminal("A") val nonterminalB = Nonterminal("B") @@ -185,7 +199,22 @@ class TestCFGReadWriteTXT { nonterminalB.addAlternative(Alternative(listOf())) nonterminalB.addAlternative(Alternative(listOf(Terminal("subClassOf"), nonterminalB))) - val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/reg3.txt" + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg4.txt" + writeCFGToTXT(nonterminalS, pathToTXT) + val actualNonterminal = readCFGFromTXT(pathToTXT) + + assertEquals(expected = nonterminalS, actual = actualNonterminal) + assertEquals(expected = nonterminalS.alternatives, actual = actualNonterminal.alternatives) + } + + @Test + fun `'c_analysis_reg1' cfg`() { + val nonterminalS = Nonterminal("S") + + nonterminalS.addAlternative(Alternative(listOf())) + nonterminalS.addAlternative(Alternative(listOf(Terminal("a"), nonterminalS))) + + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg1.txt" writeCFGToTXT(nonterminalS, pathToTXT) val actualNonterminal = readCFGFromTXT(pathToTXT) @@ -194,29 +223,55 @@ class TestCFGReadWriteTXT { } @Test - fun `'reg5' cfg`() { + fun `'c_analysis_reg2' cfg`() { val nonterminalS = Nonterminal("S") val nonterminalA = Nonterminal("A") - val nonterminalB = Nonterminal("B") - val nonterminalC = Nonterminal("C") - val nonterminalD = Nonterminal("D") - nonterminalS.addAlternative( - Alternative(listOf(nonterminalA, nonterminalB, nonterminalC, nonterminalD))) + nonterminalS.addAlternative(Alternative(listOf())) + nonterminalS.addAlternative(Alternative(listOf(Terminal("a"), nonterminalA))) nonterminalA.addAlternative(Alternative(listOf())) - nonterminalA.addAlternative(Alternative(listOf(Terminal("type"), nonterminalA))) + nonterminalA.addAlternative(Alternative(listOf(Terminal("d"), nonterminalA))) - nonterminalB.addAlternative(Alternative(listOf())) - nonterminalB.addAlternative(Alternative(listOf(Terminal("subClassOf"), nonterminalB))) + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg2.txt" + writeCFGToTXT(nonterminalS, pathToTXT) + val actualNonterminal = readCFGFromTXT(pathToTXT) + + assertEquals(expected = nonterminalS, actual = actualNonterminal) + assertEquals(expected = nonterminalS.alternatives, actual = actualNonterminal.alternatives) + } + + @Test + fun `'c_analysis_reg3' cfg`() { + val nonterminalS = Nonterminal("S") + + nonterminalS.addAlternative(Alternative(listOf())) + nonterminalS.addAlternative(Alternative(listOf(Terminal("a"), nonterminalS))) + nonterminalS.addAlternative(Alternative(listOf(Terminal("d"), nonterminalS))) - nonterminalC.addAlternative(Alternative(listOf())) - nonterminalC.addAlternative(Alternative(listOf(Terminal("subClassOf_r"), nonterminalC))) + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg3.txt" + writeCFGToTXT(nonterminalS, pathToTXT) + val actualNonterminal = readCFGFromTXT(pathToTXT) + + assertEquals(expected = nonterminalS, actual = actualNonterminal) + assertEquals(expected = nonterminalS.alternatives, actual = actualNonterminal.alternatives) + } + + @Test + fun `'c_analysis_reg4' cfg`() { + val nonterminalS = Nonterminal("S") + val nonterminalA = Nonterminal("A") + val nonterminalB = Nonterminal("B") + + nonterminalS.addAlternative(Alternative(listOf(nonterminalA, nonterminalB))) + + nonterminalA.addAlternative(Alternative(listOf())) + nonterminalA.addAlternative(Alternative(listOf(Terminal("a"), nonterminalA))) - nonterminalD.addAlternative(Alternative(listOf())) - nonterminalD.addAlternative(Alternative(listOf(Terminal("type_r"), nonterminalD))) + nonterminalB.addAlternative(Alternative(listOf())) + nonterminalB.addAlternative(Alternative(listOf(Terminal("d"), nonterminalB))) - val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/reg4.txt" + val pathToTXT = "src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg4.txt" writeCFGToTXT(nonterminalS, pathToTXT) val actualNonterminal = readCFGFromTXT(pathToTXT) diff --git a/src/test/kotlin/cli/TestRSMReadWriteTXT.kt b/src/test/kotlin/cli/TestRSMReadWriteTXT.kt index 9b66e5f23..066c4c645 100644 --- a/src/test/kotlin/cli/TestRSMReadWriteTXT.kt +++ b/src/test/kotlin/cli/TestRSMReadWriteTXT.kt @@ -366,7 +366,9 @@ class TestRSMReadWriteTXT { rsmState2.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("d"), head = rsmState3)) rsmState4.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a_r"), head = rsmState6)) + rsmState4.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a"), head = rsmState8)) rsmState4.addNonterminalEdge(RSMNonterminalEdge(nonterminal = nonterminalS, head = rsmState5)) + rsmState4.addNonterminalEdge(RSMNonterminalEdge(nonterminal = nonterminalS, head = rsmState7)) rsmState5.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a_r"), head = rsmState6)) @@ -395,16 +397,38 @@ class TestRSMReadWriteTXT { } @Test - fun `'reg1' rsm`() { + fun `'rdf_reg1' rsm`() { val nonterminalS = Nonterminal("S") val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) nonterminalS.startState = rsmState0 rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type"), head = rsmState0)) - rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState0)) - val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/reg1.txt" + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg1.txt" + writeRSMToTXT(rsmState0, pathToTXT) + val actualRSMState = readRSMFromTXT(pathToTXT) + + assertEquals(expected = rsmState0, actual = actualRSMState) + assertEquals( + expected = rsmState0.outgoingTerminalEdges, actual = actualRSMState.outgoingTerminalEdges) + assertEquals( + expected = rsmState0.outgoingNonterminalEdges, + actual = actualRSMState.outgoingNonterminalEdges) + } + + @Test + fun `'rdf_reg2' rsm`() { + val nonterminalS = Nonterminal("S") + val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true) + val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isFinal = true) + + nonterminalS.startState = rsmState0 + + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type"), head = rsmState1)) + rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState1)) + + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg2.txt" writeRSMToTXT(rsmState0, pathToTXT) val actualRSMState = readRSMFromTXT(pathToTXT) @@ -417,19 +441,16 @@ class TestRSMReadWriteTXT { } @Test - fun `'reg2' rsm`() { + fun `'rdf_reg3' rsm`() { val nonterminalS = Nonterminal("S") val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) nonterminalS.startState = rsmState0 rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type"), head = rsmState0)) - rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type_r"), head = rsmState0)) rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState0)) - rsmState0.addTerminalEdge( - RSMTerminalEdge(terminal = Terminal("subClassOf_r"), head = rsmState0)) - val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/reg2.txt" + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg3.txt" writeRSMToTXT(rsmState0, pathToTXT) val actualRSMState = readRSMFromTXT(pathToTXT) @@ -442,10 +463,10 @@ class TestRSMReadWriteTXT { } @Test - fun `'reg3' rsm`() { + fun `'rdf_reg4' rsm`() { val nonterminalS = Nonterminal("S") val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) - val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isStart = true, isFinal = true) + val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isFinal = true) nonterminalS.startState = rsmState0 @@ -454,7 +475,7 @@ class TestRSMReadWriteTXT { rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState1)) - val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/reg3.txt" + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg4.txt" writeRSMToTXT(rsmState0, pathToTXT) val actualRSMState = readRSMFromTXT(pathToTXT) @@ -467,33 +488,85 @@ class TestRSMReadWriteTXT { } @Test - fun `'reg4' rsm`() { + fun `'c_analysis_reg1' rsm`() { val nonterminalS = Nonterminal("S") val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) - val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isStart = true, isFinal = true) - val rsmState2 = RSMState(id = 2, nonterminal = nonterminalS, isStart = true, isFinal = true) - val rsmState3 = RSMState(id = 3, nonterminal = nonterminalS, isStart = true, isFinal = true) nonterminalS.startState = rsmState0 - rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type"), head = rsmState0)) - rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState1)) - rsmState0.addTerminalEdge( - RSMTerminalEdge(terminal = Terminal("subClassOf_r"), head = rsmState2)) - rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type_r"), head = rsmState3)) + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a"), head = rsmState0)) - rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("subClassOf"), head = rsmState1)) - rsmState1.addTerminalEdge( - RSMTerminalEdge(terminal = Terminal("subClassOf_r"), head = rsmState2)) - rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type_r"), head = rsmState3)) + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg1.txt" + writeRSMToTXT(rsmState0, pathToTXT) + val actualRSMState = readRSMFromTXT(pathToTXT) - rsmState2.addTerminalEdge( - RSMTerminalEdge(terminal = Terminal("subClassOf_r"), head = rsmState2)) - rsmState2.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type_r"), head = rsmState3)) + assertEquals(expected = rsmState0, actual = actualRSMState) + assertEquals( + expected = rsmState0.outgoingTerminalEdges, actual = actualRSMState.outgoingTerminalEdges) + assertEquals( + expected = rsmState0.outgoingNonterminalEdges, + actual = actualRSMState.outgoingNonterminalEdges) + } + + @Test + fun `'c_analysis_reg2' rsm`() { + val nonterminalS = Nonterminal("S") + val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true) + val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isFinal = true) + + nonterminalS.startState = rsmState0 + + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a"), head = rsmState1)) + rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("d"), head = rsmState1)) + + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg2.txt" + writeRSMToTXT(rsmState0, pathToTXT) + val actualRSMState = readRSMFromTXT(pathToTXT) + + assertEquals(expected = rsmState0, actual = actualRSMState) + assertEquals( + expected = rsmState0.outgoingTerminalEdges, actual = actualRSMState.outgoingTerminalEdges) + assertEquals( + expected = rsmState0.outgoingNonterminalEdges, + actual = actualRSMState.outgoingNonterminalEdges) + } + + @Test + fun `'c_analysis_reg3' rsm`() { + val nonterminalS = Nonterminal("S") + val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) + + nonterminalS.startState = rsmState0 + + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a"), head = rsmState0)) + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("d"), head = rsmState0)) + + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg3.txt" + writeRSMToTXT(rsmState0, pathToTXT) + val actualRSMState = readRSMFromTXT(pathToTXT) + + assertEquals(expected = rsmState0, actual = actualRSMState) + assertEquals( + expected = rsmState0.outgoingTerminalEdges, actual = actualRSMState.outgoingTerminalEdges) + assertEquals( + expected = rsmState0.outgoingNonterminalEdges, + actual = actualRSMState.outgoingNonterminalEdges) + } + + @Test + fun `'c_analysis_reg4' rsm`() { + val nonterminalS = Nonterminal("S") + val rsmState0 = RSMState(id = 0, nonterminal = nonterminalS, isStart = true, isFinal = true) + val rsmState1 = RSMState(id = 1, nonterminal = nonterminalS, isFinal = true) + + nonterminalS.startState = rsmState0 + + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("a"), head = rsmState0)) + rsmState0.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("d"), head = rsmState1)) - rsmState3.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("type_r"), head = rsmState3)) + rsmState1.addTerminalEdge(RSMTerminalEdge(terminal = Terminal("d"), head = rsmState1)) - val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/reg4.txt" + val pathToTXT = "src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg4.txt" writeRSMToTXT(rsmState0, pathToTXT) val actualRSMState = readRSMFromTXT(pathToTXT) diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg1.txt b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg1.txt new file mode 100644 index 000000000..0d653be32 --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg1.txt @@ -0,0 +1,3 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("a") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg2.txt b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg2.txt new file mode 100644 index 000000000..7d5695f9d --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg2.txt @@ -0,0 +1,5 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("a") Nonterminal("A") +Nonterminal("A") -> +Nonterminal("A") -> Terminal("d") Nonterminal("A") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg3.txt b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg3.txt new file mode 100644 index 000000000..91ab7213f --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg3.txt @@ -0,0 +1,4 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("a") Nonterminal("S") +Nonterminal("S") -> Terminal("d") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg4.txt b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg4.txt new file mode 100644 index 000000000..f58049c21 --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/c_analysis_reg4.txt @@ -0,0 +1,6 @@ +StartNonterminal("S") +Nonterminal("S") -> Nonterminal("A") Nonterminal("B") +Nonterminal("A") -> +Nonterminal("A") -> Terminal("a") Nonterminal("A") +Nonterminal("B") -> +Nonterminal("B") -> Terminal("d") Nonterminal("B") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg1.txt b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg1.txt new file mode 100644 index 000000000..202095205 --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg1.txt @@ -0,0 +1,3 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("type") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg2.txt b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg2.txt new file mode 100644 index 000000000..3f77af871 --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg2.txt @@ -0,0 +1,5 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("type") Nonterminal("A") +Nonterminal("A") -> +Nonterminal("A") -> Terminal("subClassOf") Nonterminal("A") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg3.txt b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg3.txt new file mode 100644 index 000000000..3488f18f8 --- /dev/null +++ b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg3.txt @@ -0,0 +1,4 @@ +StartNonterminal("S") +Nonterminal("S") -> +Nonterminal("S") -> Terminal("type") Nonterminal("S") +Nonterminal("S") -> Terminal("subClassOf") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/reg3.txt b/src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg4.txt similarity index 100% rename from src/test/resources/cli/TestCFGReadWriteTXT/reg3.txt rename to src/test/resources/cli/TestCFGReadWriteTXT/rdf_reg4.txt diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/reg1.txt b/src/test/resources/cli/TestCFGReadWriteTXT/reg1.txt deleted file mode 100644 index fd5b7ec63..000000000 --- a/src/test/resources/cli/TestCFGReadWriteTXT/reg1.txt +++ /dev/null @@ -1,5 +0,0 @@ -StartNonterminal("S") -Nonterminal("S") -> -Nonterminal("S") -> Terminal("type") -Nonterminal("S") -> Terminal("subClassOf") -Nonterminal("S") -> Nonterminal("S") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/reg2.txt b/src/test/resources/cli/TestCFGReadWriteTXT/reg2.txt deleted file mode 100644 index 0eda65795..000000000 --- a/src/test/resources/cli/TestCFGReadWriteTXT/reg2.txt +++ /dev/null @@ -1,7 +0,0 @@ -StartNonterminal("S") -Nonterminal("S") -> -Nonterminal("S") -> Terminal("type") -Nonterminal("S") -> Terminal("type_r") -Nonterminal("S") -> Terminal("subClassOf") -Nonterminal("S") -> Terminal("subClassOf_r") -Nonterminal("S") -> Nonterminal("S") Nonterminal("S") diff --git a/src/test/resources/cli/TestCFGReadWriteTXT/reg4.txt b/src/test/resources/cli/TestCFGReadWriteTXT/reg4.txt deleted file mode 100644 index a739c5b44..000000000 --- a/src/test/resources/cli/TestCFGReadWriteTXT/reg4.txt +++ /dev/null @@ -1,10 +0,0 @@ -StartNonterminal("S") -Nonterminal("S") -> Nonterminal("A") Nonterminal("B") Nonterminal("C") Nonterminal("D") -Nonterminal("A") -> -Nonterminal("A") -> Terminal("type") Nonterminal("A") -Nonterminal("B") -> -Nonterminal("B") -> Terminal("subClassOf") Nonterminal("B") -Nonterminal("C") -> -Nonterminal("C") -> Terminal("subClassOf_r") Nonterminal("C") -Nonterminal("D") -> -Nonterminal("D") -> Terminal("type_r") Nonterminal("D") diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis.txt b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis.txt index 0ea68e364..a8f53a1f1 100644 --- a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis.txt +++ b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis.txt @@ -5,21 +5,23 @@ State(id=2,nonterminal=Nonterminal("S"),isStart=false,isFinal=false) State(id=4,nonterminal=Nonterminal("V"),isStart=true,isFinal=true) State(id=3,nonterminal=Nonterminal("S"),isStart=false,isFinal=true) State(id=6,nonterminal=Nonterminal("V"),isStart=false,isFinal=true) -State(id=5,nonterminal=Nonterminal("V"),isStart=false,isFinal=false) State(id=8,nonterminal=Nonterminal("V"),isStart=false,isFinal=true) +State(id=5,nonterminal=Nonterminal("V"),isStart=false,isFinal=false) State(id=7,nonterminal=Nonterminal("V"),isStart=false,isFinal=true) State(id=9,nonterminal=Nonterminal("V"),isStart=false,isFinal=true) TerminalEdge(tail=0,head=1,terminal=Terminal("d_r")) NonterminalEdge(tail=1,head=2,nonterminal=Nonterminal("V")) TerminalEdge(tail=2,head=3,terminal=Terminal("d")) TerminalEdge(tail=4,head=6,terminal=Terminal("a_r")) +TerminalEdge(tail=4,head=8,terminal=Terminal("a")) NonterminalEdge(tail=4,head=5,nonterminal=Nonterminal("S")) +NonterminalEdge(tail=4,head=7,nonterminal=Nonterminal("S")) TerminalEdge(tail=6,head=8,terminal=Terminal("a")) TerminalEdge(tail=6,head=6,terminal=Terminal("a_r")) NonterminalEdge(tail=6,head=5,nonterminal=Nonterminal("S")) NonterminalEdge(tail=6,head=7,nonterminal=Nonterminal("S")) -TerminalEdge(tail=5,head=6,terminal=Terminal("a_r")) TerminalEdge(tail=8,head=8,terminal=Terminal("a")) NonterminalEdge(tail=8,head=9,nonterminal=Nonterminal("S")) +TerminalEdge(tail=5,head=6,terminal=Terminal("a_r")) TerminalEdge(tail=7,head=8,terminal=Terminal("a")) TerminalEdge(tail=9,head=8,terminal=Terminal("a")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg1.txt b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg1.txt new file mode 100644 index 000000000..2ce711d42 --- /dev/null +++ b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg1.txt @@ -0,0 +1,3 @@ +StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +TerminalEdge(tail=0,head=0,terminal=Terminal("a")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg2.txt b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg2.txt new file mode 100644 index 000000000..0083b84d3 --- /dev/null +++ b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg2.txt @@ -0,0 +1,5 @@ +StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false) +State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false) +State(id=1,nonterminal=Nonterminal("S"),isStart=false,isFinal=true) +TerminalEdge(tail=0,head=1,terminal=Terminal("a")) +TerminalEdge(tail=1,head=1,terminal=Terminal("d")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg3.txt b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg3.txt new file mode 100644 index 000000000..a1a04dcf2 --- /dev/null +++ b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg3.txt @@ -0,0 +1,4 @@ +StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +TerminalEdge(tail=0,head=0,terminal=Terminal("a")) +TerminalEdge(tail=0,head=0,terminal=Terminal("d")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg4.txt b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg4.txt new file mode 100644 index 000000000..b013ce1e2 --- /dev/null +++ b/src/test/resources/cli/TestRSMReadWriteTXT/c_analysis_reg4.txt @@ -0,0 +1,6 @@ +StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +State(id=1,nonterminal=Nonterminal("S"),isStart=false,isFinal=true) +TerminalEdge(tail=0,head=0,terminal=Terminal("a")) +TerminalEdge(tail=0,head=1,terminal=Terminal("d")) +TerminalEdge(tail=1,head=1,terminal=Terminal("d")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/reg2.txt b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg1.txt similarity index 52% rename from src/test/resources/cli/TestRSMReadWriteTXT/reg2.txt rename to src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg1.txt index 7f29eab15..d427dd630 100644 --- a/src/test/resources/cli/TestRSMReadWriteTXT/reg2.txt +++ b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg1.txt @@ -1,6 +1,3 @@ StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) TerminalEdge(tail=0,head=0,terminal=Terminal("type")) -TerminalEdge(tail=0,head=0,terminal=Terminal("type_r")) -TerminalEdge(tail=0,head=0,terminal=Terminal("subClassOf")) -TerminalEdge(tail=0,head=0,terminal=Terminal("subClassOf_r")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg2.txt b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg2.txt new file mode 100644 index 000000000..4a0397dcc --- /dev/null +++ b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg2.txt @@ -0,0 +1,5 @@ +StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false) +State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=false) +State(id=1,nonterminal=Nonterminal("S"),isStart=false,isFinal=true) +TerminalEdge(tail=0,head=1,terminal=Terminal("type")) +TerminalEdge(tail=1,head=1,terminal=Terminal("subClassOf")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/reg1.txt b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg3.txt similarity index 100% rename from src/test/resources/cli/TestRSMReadWriteTXT/reg1.txt rename to src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg3.txt diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/reg3.txt b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg4.txt similarity index 82% rename from src/test/resources/cli/TestRSMReadWriteTXT/reg3.txt rename to src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg4.txt index 0a8caa416..34d8f940d 100644 --- a/src/test/resources/cli/TestRSMReadWriteTXT/reg3.txt +++ b/src/test/resources/cli/TestRSMReadWriteTXT/rdf_reg4.txt @@ -1,6 +1,6 @@ StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -State(id=1,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) +State(id=1,nonterminal=Nonterminal("S"),isStart=false,isFinal=true) TerminalEdge(tail=0,head=0,terminal=Terminal("type")) TerminalEdge(tail=0,head=1,terminal=Terminal("subClassOf")) TerminalEdge(tail=1,head=1,terminal=Terminal("subClassOf")) diff --git a/src/test/resources/cli/TestRSMReadWriteTXT/reg4.txt b/src/test/resources/cli/TestRSMReadWriteTXT/reg4.txt deleted file mode 100644 index b3570925e..000000000 --- a/src/test/resources/cli/TestRSMReadWriteTXT/reg4.txt +++ /dev/null @@ -1,15 +0,0 @@ -StartState(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -State(id=0,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -State(id=1,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -State(id=2,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -State(id=3,nonterminal=Nonterminal("S"),isStart=true,isFinal=true) -TerminalEdge(tail=0,head=0,terminal=Terminal("type")) -TerminalEdge(tail=0,head=1,terminal=Terminal("subClassOf")) -TerminalEdge(tail=0,head=2,terminal=Terminal("subClassOf_r")) -TerminalEdge(tail=0,head=3,terminal=Terminal("type_r")) -TerminalEdge(tail=1,head=1,terminal=Terminal("subClassOf")) -TerminalEdge(tail=1,head=2,terminal=Terminal("subClassOf_r")) -TerminalEdge(tail=1,head=3,terminal=Terminal("type_r")) -TerminalEdge(tail=2,head=2,terminal=Terminal("subClassOf_r")) -TerminalEdge(tail=2,head=3,terminal=Terminal("type_r")) -TerminalEdge(tail=3,head=3,terminal=Terminal("type_r"))