summaryrefslogtreecommitdiff
path: root/examples/statemachine/trafficLightDemo.py
diff options
context:
space:
mode:
authorptmcg <ptmcg@austin.rr.com>2018-12-28 14:42:07 -0600
committerptmcg <ptmcg@austin.rr.com>2018-12-28 14:42:07 -0600
commit45b78401e8c224619e1b18b9cf43fc02b196676e (patch)
treefd4c4db17624f48d8efb275946240794c7f059cf /examples/statemachine/trafficLightDemo.py
parent3288d48409269b404e24888ec90e76ee751251e3 (diff)
downloadpyparsing-git-45b78401e8c224619e1b18b9cf43fc02b196676e.tar.gz
Fix partial named results when And embedded in named MatchFirst or Or
Diffstat (limited to 'examples/statemachine/trafficLightDemo.py')
-rw-r--r--examples/statemachine/trafficLightDemo.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/examples/statemachine/trafficLightDemo.py b/examples/statemachine/trafficLightDemo.py
new file mode 100644
index 0000000..30fe934
--- /dev/null
+++ b/examples/statemachine/trafficLightDemo.py
@@ -0,0 +1,12 @@
+import statemachine
+import trafficlight
+
+tl = trafficLight.Red()
+for i in range(10):
+ print(tl, end='')
+ print(("STOP", "GO")[tl.carsCanGo])
+ tl.crossingSignal()
+ tl.delay()
+ print()
+
+ tl = tl.nextState()