Selaa lähdekoodia

Add test files for transition target parsing

Joeri Exelmans 5 vuotta sitten
vanhempi
commit
ddba3e3a80

+ 3 - 1
test/render.py

@@ -4,6 +4,7 @@ import subprocess
 import multiprocessing
 from lib.os_tools import *
 from lib.builder import *
+from lib.loader import *
 from sccd.compiler.utils import FormattedWriter
 from sccd.runtime.statechart_syntax import *
 
@@ -19,7 +20,8 @@ if __name__ == '__main__':
     args = parser.parse_args()
 
 
-    builder = Builder(args.build_dir)
+    # builder = Builder(args.build_dir)
+    builder = Loader()
     srcs = get_files(args.path, filter=filter_xml)
 
     if len(srcs):

+ 46 - 0
test/test_files/compiler/stateref/flat_absolute+c.svg

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: state transitions Pages: 1 -->
+<svg width="64pt" height="147pt"
+ viewBox="0.00 0.00 64.00 147.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 143)">
+<title>state transitions</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-143 60,-143 60,4 -4,4"/>
+<!-- __initial -->
+<g id="node1" class="node">
+<title>__initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="28" cy="-133.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a -->
+<g id="node2" class="node">
+<title>_a</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="56,-100 0,-100 0,-64 56,-64 56,-100"/>
+<text text-anchor="start" x="24.6646" y="-78.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">a</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M12.3333,-65C12.3333,-65 43.6667,-65 43.6667,-65 49.3333,-65 55,-70.6667 55,-76.3333 55,-76.3333 55,-87.6667 55,-87.6667 55,-93.3333 49.3333,-99 43.6667,-99 43.6667,-99 12.3333,-99 12.3333,-99 6.6667,-99 1,-93.3333 1,-87.6667 1,-87.6667 1,-76.3333 1,-76.3333 1,-70.6667 6.6667,-65 12.3333,-65"/>
+</g>
+<!-- __initial&#45;&gt;_a -->
+<g id="edge1" class="edge">
+<title>__initial&#45;&gt;_a</title>
+<path fill="none" stroke="#000000" d="M28,-127.9886C28,-123.6293 28,-117.1793 28,-110.4801"/>
+<polygon fill="#000000" stroke="#000000" points="31.5001,-110.0122 28,-100.0122 24.5001,-110.0122 31.5001,-110.0122"/>
+<text text-anchor="middle" x="29.3895" y="-111" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _b -->
+<g id="node3" class="node">
+<title>_b</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="56,-36 0,-36 0,0 56,0 56,-36"/>
+<text text-anchor="start" x="24.6646" y="-14.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">b</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M12.3333,-1C12.3333,-1 43.6667,-1 43.6667,-1 49.3333,-1 55,-6.6667 55,-12.3333 55,-12.3333 55,-23.6667 55,-23.6667 55,-29.3333 49.3333,-35 43.6667,-35 43.6667,-35 12.3333,-35 12.3333,-35 6.6667,-35 1,-29.3333 1,-23.6667 1,-23.6667 1,-12.3333 1,-12.3333 1,-6.6667 6.6667,-1 12.3333,-1"/>
+</g>
+<!-- _a&#45;&gt;_b -->
+<g id="edge2" class="edge">
+<title>_a&#45;&gt;_b</title>
+<path fill="none" stroke="#000000" d="M28,-63.8314C28,-58.4728 28,-52.4735 28,-46.6262"/>
+<polygon fill="#000000" stroke="#000000" points="31.5001,-46.4363 28,-36.4363 24.5001,-46.4363 31.5001,-46.4363"/>
+<text text-anchor="middle" x="29.3895" y="-47" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+</g>
+</svg>

+ 29 - 0
test/test_files/compiler/stateref/flat_absolute.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" ?>
+<diagram
+  xmlns="msdl.uantwerpen.be/sccd"
+  author="Joeri Exelmans"
+  name="take_one">
+  <description>
+    Transition target reference: absolute path
+  </description>
+  <outport name="out"/>
+  <class name="c" default="true">
+    <scxml initial="a">
+      <state id="a">
+        <transition target="/b"/>
+      </state>
+      <state id="b">
+        <onentry>
+          <raise event="done" port="out"/>
+        </onentry>
+      </state>
+    </scxml>
+  </class>
+  <test>
+    <expected>
+      <slot>
+        <event name="done" port="out"/>
+      </slot>
+    </expected>
+  </test>
+</diagram>

+ 46 - 0
test/test_files/compiler/stateref/flat_relative+c.svg

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: state transitions Pages: 1 -->
+<svg width="64pt" height="147pt"
+ viewBox="0.00 0.00 64.00 147.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 143)">
+<title>state transitions</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-143 60,-143 60,4 -4,4"/>
+<!-- __initial -->
+<g id="node1" class="node">
+<title>__initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="28" cy="-133.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a -->
+<g id="node2" class="node">
+<title>_a</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="56,-100 0,-100 0,-64 56,-64 56,-100"/>
+<text text-anchor="start" x="24.6646" y="-78.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">a</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M12.3333,-65C12.3333,-65 43.6667,-65 43.6667,-65 49.3333,-65 55,-70.6667 55,-76.3333 55,-76.3333 55,-87.6667 55,-87.6667 55,-93.3333 49.3333,-99 43.6667,-99 43.6667,-99 12.3333,-99 12.3333,-99 6.6667,-99 1,-93.3333 1,-87.6667 1,-87.6667 1,-76.3333 1,-76.3333 1,-70.6667 6.6667,-65 12.3333,-65"/>
+</g>
+<!-- __initial&#45;&gt;_a -->
+<g id="edge1" class="edge">
+<title>__initial&#45;&gt;_a</title>
+<path fill="none" stroke="#000000" d="M28,-127.9886C28,-123.6293 28,-117.1793 28,-110.4801"/>
+<polygon fill="#000000" stroke="#000000" points="31.5001,-110.0122 28,-100.0122 24.5001,-110.0122 31.5001,-110.0122"/>
+<text text-anchor="middle" x="29.3895" y="-111" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _b -->
+<g id="node3" class="node">
+<title>_b</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="56,-36 0,-36 0,0 56,0 56,-36"/>
+<text text-anchor="start" x="24.6646" y="-14.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">b</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M12.3333,-1C12.3333,-1 43.6667,-1 43.6667,-1 49.3333,-1 55,-6.6667 55,-12.3333 55,-12.3333 55,-23.6667 55,-23.6667 55,-29.3333 49.3333,-35 43.6667,-35 43.6667,-35 12.3333,-35 12.3333,-35 6.6667,-35 1,-29.3333 1,-23.6667 1,-23.6667 1,-12.3333 1,-12.3333 1,-6.6667 6.6667,-1 12.3333,-1"/>
+</g>
+<!-- _a&#45;&gt;_b -->
+<g id="edge2" class="edge">
+<title>_a&#45;&gt;_b</title>
+<path fill="none" stroke="#000000" d="M28,-63.8314C28,-58.4728 28,-52.4735 28,-46.6262"/>
+<polygon fill="#000000" stroke="#000000" points="31.5001,-46.4363 28,-36.4363 24.5001,-46.4363 31.5001,-46.4363"/>
+<text text-anchor="middle" x="29.3895" y="-47" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+</g>
+</svg>

+ 29 - 0
test/test_files/compiler/stateref/flat_relative.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" ?>
+<diagram
+  xmlns="msdl.uantwerpen.be/sccd"
+  author="Joeri Exelmans"
+  name="take_one">
+  <description>
+    Transition target reference: relative path
+  </description>
+  <outport name="out"/>
+  <class name="c" default="true">
+    <scxml initial="a">
+      <state id="a">
+        <transition target="../b"/>
+      </state>
+      <state id="b">
+        <onentry>
+          <raise event="done" port="out"/>
+        </onentry>
+      </state>
+    </scxml>
+  </class>
+  <test>
+    <expected>
+      <slot>
+        <event name="done" port="out"/>
+      </slot>
+    </expected>
+  </test>
+</diagram>

+ 118 - 0
test/test_files/compiler/stateref/nested_absolute+c.svg

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: state transitions Pages: 1 -->
+<svg width="208pt" height="510pt"
+ viewBox="0.00 0.00 208.00 510.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 506)">
+<title>state transitions</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-506 204,-506 204,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster__a</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M20,-88C20,-88 84,-88 84,-88 90,-88 96,-94 96,-100 96,-100 96,-451 96,-451 96,-457 90,-463 84,-463 84,-463 20,-463 20,-463 14,-463 8,-457 8,-451 8,-451 8,-100 8,-100 8,-94 14,-88 20,-88"/>
+<text text-anchor="start" x="48.6646" y="-444.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">a</text>
+</g>
+<g id="clust2" class="cluster">
+<title>cluster__a_b</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M28,-96C28,-96 76,-96 76,-96 82,-96 88,-102 88,-108 88,-108 88,-318.5 88,-318.5 88,-324.5 82,-330.5 76,-330.5 76,-330.5 28,-330.5 28,-330.5 22,-330.5 16,-324.5 16,-318.5 16,-318.5 16,-108 16,-108 16,-102 22,-96 28,-96"/>
+<text text-anchor="start" x="48.6646" y="-311.7" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">b</text>
+</g>
+<g id="clust3" class="cluster">
+<title>cluster__d</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M116,-8C116,-8 180,-8 180,-8 186,-8 192,-14 192,-20 192,-20 192,-385 192,-385 192,-391 186,-397 180,-397 180,-397 116,-397 116,-397 110,-397 104,-391 104,-385 104,-385 104,-20 104,-20 104,-14 110,-8 116,-8"/>
+<text text-anchor="start" x="144.6646" y="-378.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">d</text>
+</g>
+<g id="clust4" class="cluster">
+<title>cluster__d_e</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M124,-16C124,-16 172,-16 172,-16 178,-16 184,-22 184,-28 184,-28 184,-252 184,-252 184,-258 178,-264 172,-264 172,-264 124,-264 124,-264 118,-264 112,-258 112,-252 112,-252 112,-28 112,-28 112,-22 118,-16 124,-16"/>
+<text text-anchor="start" x="144.6646" y="-245.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">e</text>
+</g>
+<!-- __initial -->
+<g id="node1" class="node">
+<title>__initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="88" cy="-496.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a -->
+<!-- __initial&#45;&gt;_a -->
+<g id="edge1" class="edge">
+<title>__initial&#45;&gt;_a</title>
+<path fill="none" stroke="#000000" d="M88,-490.9623C88,-486.7143 88,-480.3733 88,-473.1925"/>
+<polygon fill="#000000" stroke="#000000" points="91.5001,-472.9976 88,-462.9976 84.5001,-472.9976 91.5001,-472.9976"/>
+<text text-anchor="middle" x="89.3895" y="-474" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _a_initial -->
+<g id="node3" class="node">
+<title>_a_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="60" cy="-419.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a_b -->
+<!-- _a_initial&#45;&gt;_a_b -->
+<g id="edge2" class="edge">
+<title>_a_initial&#45;&gt;_a_b</title>
+<path fill="none" stroke="#000000" d="M60.3867,-413.8066C61.2487,-401.1164 63.4046,-369.3763 65.3438,-340.828"/>
+<polygon fill="#000000" stroke="#000000" points="68.8598,-340.71 66.0456,-330.4958 61.8758,-340.2356 68.8598,-340.71"/>
+<text text-anchor="middle" x="65.3895" y="-350.5" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _a_b_initial -->
+<g id="node5" class="node">
+<title>_a_b_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="41" cy="-287" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a_b_c -->
+<g id="node6" class="node">
+<title>_a_b_c</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="80,-140 24,-140 24,-104 80,-104 80,-140"/>
+<text text-anchor="start" x="49" y="-118.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">c</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M36.3333,-105C36.3333,-105 67.6667,-105 67.6667,-105 73.3333,-105 79,-110.6667 79,-116.3333 79,-116.3333 79,-127.6667 79,-127.6667 79,-133.3333 73.3333,-139 67.6667,-139 67.6667,-139 36.3333,-139 36.3333,-139 30.6667,-139 25,-133.3333 25,-127.6667 25,-127.6667 25,-116.3333 25,-116.3333 25,-110.6667 30.6667,-105 36.3333,-105"/>
+</g>
+<!-- _a_b_initial&#45;&gt;_a_b_c -->
+<g id="edge3" class="edge">
+<title>_a_b_initial&#45;&gt;_a_b_c</title>
+<path fill="none" stroke="#000000" d="M42.1124,-281.5094C44.3105,-270.1647 49,-243.2916 49,-220.5 49,-220.5 49,-220.5 49,-163 49,-158.9408 49.1481,-154.6615 49.3784,-150.4603"/>
+<polygon fill="#000000" stroke="#000000" points="52.8794,-150.567 50.0831,-140.3478 45.8963,-150.0803 52.8794,-150.567"/>
+<text text-anchor="middle" x="50.3895" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d_e_f -->
+<g id="node11" class="node">
+<title>_d_e_f</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="176,-60 120,-60 120,-24 176,-24 176,-60"/>
+<text text-anchor="start" x="146.3326" y="-38.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">f</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M132.3333,-25C132.3333,-25 163.6667,-25 163.6667,-25 169.3333,-25 175,-30.6667 175,-36.3333 175,-36.3333 175,-47.6667 175,-47.6667 175,-53.3333 169.3333,-59 163.6667,-59 163.6667,-59 132.3333,-59 132.3333,-59 126.6667,-59 121,-53.3333 121,-47.6667 121,-47.6667 121,-36.3333 121,-36.3333 121,-30.6667 126.6667,-25 132.3333,-25"/>
+</g>
+<!-- _a_b_c&#45;&gt;_d_e_f -->
+<g id="edge4" class="edge">
+<title>_a_b_c&#45;&gt;_d_e_f</title>
+<path fill="none" stroke="#000000" d="M73.7839,-103.8468C87.04,-92.8 104.1443,-78.5464 118.5911,-66.5075"/>
+<polygon fill="#000000" stroke="#000000" points="120.8607,-69.1721 126.3023,-60.0814 116.3794,-63.7945 120.8607,-69.1721"/>
+<text text-anchor="middle" x="115.3895" y="-71" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d -->
+<!-- _d_initial -->
+<g id="node8" class="node">
+<title>_d_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="156" cy="-353.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _d_e -->
+<!-- _d_initial&#45;&gt;_d_e -->
+<g id="edge5" class="edge">
+<title>_d_initial&#45;&gt;_d_e</title>
+<path fill="none" stroke="#000000" d="M156.3867,-347.7852C157.254,-334.9688 159.4312,-302.7952 161.3795,-274.0036"/>
+<polygon fill="#000000" stroke="#000000" points="164.8733,-274.2116 162.0565,-263.998 157.8893,-273.7389 164.8733,-274.2116"/>
+<text text-anchor="middle" x="161.3895" y="-284" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d_e_initial -->
+<g id="node10" class="node">
+<title>_d_e_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="137" cy="-220.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _d_e_initial&#45;&gt;_d_e_f -->
+<g id="edge6" class="edge">
+<title>_d_e_initial&#45;&gt;_d_e_f</title>
+<path fill="none" stroke="#000000" d="M139.357,-215.3687C141.7168,-209.7542 145,-200.4282 145,-192 145,-192 145,-192 145,-122 145,-104.8884 145.6939,-85.7324 146.4142,-70.4562"/>
+<polygon fill="#000000" stroke="#000000" points="149.9281,-70.266 146.9339,-60.1031 142.9369,-69.9151 149.9281,-70.266"/>
+<text text-anchor="middle" x="146.3895" y="-160" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+</g>
+</svg>

+ 37 - 0
test/test_files/compiler/stateref/nested_absolute.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" ?>
+<diagram
+  xmlns="msdl.uantwerpen.be/sccd"
+  author="Joeri Exelmans"
+  name="take_one">
+  <description>
+    Transition target reference: relative path
+  </description>
+  <outport name="out"/>
+  <class name="c" default="true">
+    <scxml initial="a">
+      <state id="a">
+        <state id="b">
+          <state id="c">
+            <transition target="/d/e/f"/>
+          </state>
+        </state>
+      </state>
+      <state id="d">
+        <state id="e">
+          <state id="f">
+            <onentry>
+              <raise event="done" port="out"/>
+            </onentry>
+          </state>
+        </state>
+      </state>
+    </scxml>
+  </class>
+  <test>
+    <expected>
+      <slot>
+        <event name="done" port="out"/>
+      </slot>
+    </expected>
+  </test>
+</diagram>

+ 118 - 0
test/test_files/compiler/stateref/nested_relative+c.svg

@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Generated by graphviz version 2.40.1 (20161225.0304)
+ -->
+<!-- Title: state transitions Pages: 1 -->
+<svg width="208pt" height="510pt"
+ viewBox="0.00 0.00 208.00 510.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 506)">
+<title>state transitions</title>
+<polygon fill="#ffffff" stroke="transparent" points="-4,4 -4,-506 204,-506 204,4 -4,4"/>
+<g id="clust1" class="cluster">
+<title>cluster__a</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M20,-88C20,-88 84,-88 84,-88 90,-88 96,-94 96,-100 96,-100 96,-451 96,-451 96,-457 90,-463 84,-463 84,-463 20,-463 20,-463 14,-463 8,-457 8,-451 8,-451 8,-100 8,-100 8,-94 14,-88 20,-88"/>
+<text text-anchor="start" x="48.6646" y="-444.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">a</text>
+</g>
+<g id="clust2" class="cluster">
+<title>cluster__a_b</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M28,-96C28,-96 76,-96 76,-96 82,-96 88,-102 88,-108 88,-108 88,-318.5 88,-318.5 88,-324.5 82,-330.5 76,-330.5 76,-330.5 28,-330.5 28,-330.5 22,-330.5 16,-324.5 16,-318.5 16,-318.5 16,-108 16,-108 16,-102 22,-96 28,-96"/>
+<text text-anchor="start" x="48.6646" y="-311.7" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">b</text>
+</g>
+<g id="clust3" class="cluster">
+<title>cluster__d</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M116,-8C116,-8 180,-8 180,-8 186,-8 192,-14 192,-20 192,-20 192,-385 192,-385 192,-391 186,-397 180,-397 180,-397 116,-397 116,-397 110,-397 104,-391 104,-385 104,-385 104,-20 104,-20 104,-14 110,-8 116,-8"/>
+<text text-anchor="start" x="144.6646" y="-378.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">d</text>
+</g>
+<g id="clust4" class="cluster">
+<title>cluster__d_e</title>
+<path fill="none" stroke="#000000" stroke-width="2" d="M124,-16C124,-16 172,-16 172,-16 178,-16 184,-22 184,-28 184,-28 184,-252 184,-252 184,-258 178,-264 172,-264 172,-264 124,-264 124,-264 118,-264 112,-258 112,-252 112,-252 112,-28 112,-28 112,-22 118,-16 124,-16"/>
+<text text-anchor="start" x="144.6646" y="-245.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">e</text>
+</g>
+<!-- __initial -->
+<g id="node1" class="node">
+<title>__initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="88" cy="-496.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a -->
+<!-- __initial&#45;&gt;_a -->
+<g id="edge1" class="edge">
+<title>__initial&#45;&gt;_a</title>
+<path fill="none" stroke="#000000" d="M88,-490.9623C88,-486.7143 88,-480.3733 88,-473.1925"/>
+<polygon fill="#000000" stroke="#000000" points="91.5001,-472.9976 88,-462.9976 84.5001,-472.9976 91.5001,-472.9976"/>
+<text text-anchor="middle" x="89.3895" y="-474" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _a_initial -->
+<g id="node3" class="node">
+<title>_a_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="60" cy="-419.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a_b -->
+<!-- _a_initial&#45;&gt;_a_b -->
+<g id="edge2" class="edge">
+<title>_a_initial&#45;&gt;_a_b</title>
+<path fill="none" stroke="#000000" d="M60.3867,-413.8066C61.2487,-401.1164 63.4046,-369.3763 65.3438,-340.828"/>
+<polygon fill="#000000" stroke="#000000" points="68.8598,-340.71 66.0456,-330.4958 61.8758,-340.2356 68.8598,-340.71"/>
+<text text-anchor="middle" x="65.3895" y="-350.5" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _a_b_initial -->
+<g id="node5" class="node">
+<title>_a_b_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="41" cy="-287" rx="5.5" ry="5.5"/>
+</g>
+<!-- _a_b_c -->
+<g id="node6" class="node">
+<title>_a_b_c</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="80,-140 24,-140 24,-104 80,-104 80,-140"/>
+<text text-anchor="start" x="49" y="-118.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">c</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M36.3333,-105C36.3333,-105 67.6667,-105 67.6667,-105 73.3333,-105 79,-110.6667 79,-116.3333 79,-116.3333 79,-127.6667 79,-127.6667 79,-133.3333 73.3333,-139 67.6667,-139 67.6667,-139 36.3333,-139 36.3333,-139 30.6667,-139 25,-133.3333 25,-127.6667 25,-127.6667 25,-116.3333 25,-116.3333 25,-110.6667 30.6667,-105 36.3333,-105"/>
+</g>
+<!-- _a_b_initial&#45;&gt;_a_b_c -->
+<g id="edge3" class="edge">
+<title>_a_b_initial&#45;&gt;_a_b_c</title>
+<path fill="none" stroke="#000000" d="M42.1124,-281.5094C44.3105,-270.1647 49,-243.2916 49,-220.5 49,-220.5 49,-220.5 49,-163 49,-158.9408 49.1481,-154.6615 49.3784,-150.4603"/>
+<polygon fill="#000000" stroke="#000000" points="52.8794,-150.567 50.0831,-140.3478 45.8963,-150.0803 52.8794,-150.567"/>
+<text text-anchor="middle" x="50.3895" y="-189" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d_e_f -->
+<g id="node11" class="node">
+<title>_d_e_f</title>
+<polygon fill="transparent" stroke="transparent" stroke-width="2" points="176,-60 120,-60 120,-24 176,-24 176,-60"/>
+<text text-anchor="start" x="146.3326" y="-38.2" font-family="Helvetica,sans-Serif" font-size="12.00" fill="#000000">f</text>
+<path fill="none" stroke="#000000" stroke-width="2" d="M132.3333,-25C132.3333,-25 163.6667,-25 163.6667,-25 169.3333,-25 175,-30.6667 175,-36.3333 175,-36.3333 175,-47.6667 175,-47.6667 175,-53.3333 169.3333,-59 163.6667,-59 163.6667,-59 132.3333,-59 132.3333,-59 126.6667,-59 121,-53.3333 121,-47.6667 121,-47.6667 121,-36.3333 121,-36.3333 121,-30.6667 126.6667,-25 132.3333,-25"/>
+</g>
+<!-- _a_b_c&#45;&gt;_d_e_f -->
+<g id="edge4" class="edge">
+<title>_a_b_c&#45;&gt;_d_e_f</title>
+<path fill="none" stroke="#000000" d="M73.7839,-103.8468C87.04,-92.8 104.1443,-78.5464 118.5911,-66.5075"/>
+<polygon fill="#000000" stroke="#000000" points="120.8607,-69.1721 126.3023,-60.0814 116.3794,-63.7945 120.8607,-69.1721"/>
+<text text-anchor="middle" x="115.3895" y="-71" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d -->
+<!-- _d_initial -->
+<g id="node8" class="node">
+<title>_d_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="156" cy="-353.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _d_e -->
+<!-- _d_initial&#45;&gt;_d_e -->
+<g id="edge5" class="edge">
+<title>_d_initial&#45;&gt;_d_e</title>
+<path fill="none" stroke="#000000" d="M156.3867,-347.7852C157.254,-334.9688 159.4312,-302.7952 161.3795,-274.0036"/>
+<polygon fill="#000000" stroke="#000000" points="164.8733,-274.2116 162.0565,-263.998 157.8893,-273.7389 164.8733,-274.2116"/>
+<text text-anchor="middle" x="161.3895" y="-284" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+<!-- _d_e_initial -->
+<g id="node10" class="node">
+<title>_d_e_initial</title>
+<ellipse fill="#000000" stroke="#000000" stroke-width="2" cx="137" cy="-220.5" rx="5.5" ry="5.5"/>
+</g>
+<!-- _d_e_initial&#45;&gt;_d_e_f -->
+<g id="edge6" class="edge">
+<title>_d_e_initial&#45;&gt;_d_e_f</title>
+<path fill="none" stroke="#000000" d="M139.357,-215.3687C141.7168,-209.7542 145,-200.4282 145,-192 145,-192 145,-192 145,-122 145,-104.8884 145.6939,-85.7324 146.4142,-70.4562"/>
+<polygon fill="#000000" stroke="#000000" points="149.9281,-70.266 146.9339,-60.1031 142.9369,-69.9151 149.9281,-70.266"/>
+<text text-anchor="middle" x="146.3895" y="-160" font-family="Helvetica,sans-Serif" font-size="10.00" fill="#000000"> </text>
+</g>
+</g>
+</svg>

+ 37 - 0
test/test_files/compiler/stateref/nested_relative.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" ?>
+<diagram
+  xmlns="msdl.uantwerpen.be/sccd"
+  author="Joeri Exelmans"
+  name="take_one">
+  <description>
+    Transition target reference: relative path
+  </description>
+  <outport name="out"/>
+  <class name="c" default="true">
+    <scxml initial="a">
+      <state id="a">
+        <state id="b">
+          <state id="c">
+            <transition target="../../../d/e/f"/>
+          </state>
+        </state>
+      </state>
+      <state id="d">
+        <state id="e">
+          <state id="f">
+            <onentry>
+              <raise event="done" port="out"/>
+            </onentry>
+          </state>
+        </state>
+      </state>
+    </scxml>
+  </class>
+  <test>
+    <expected>
+      <slot>
+        <event name="done" port="out"/>
+      </slot>
+    </expected>
+  </test>
+</diagram>