aboutsummaryrefslogtreecommitdiff
path: root/def_List.py
diff options
context:
space:
mode:
Diffstat (limited to 'def_List.py')
-rwxr-xr-xdef_List.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/def_List.py b/def_List.py
new file mode 100755
index 0000000..f5e8058
--- /dev/null
+++ b/def_List.py
@@ -0,0 +1,28 @@
+#!/usr/bin/python3
+
+# Copyright 2025, Jonas Smedegaard <dr@jones.dk>
+# SPDX-License-Identifier: GPL-3+
+
+from os.path import basename, splitext
+from railroad import *
+
+Diagram(
+ Start("complex"),
+ Choice(0,
+ "[-*]",
+ Sequence(
+ "[[:digit:]]+",
+ "[).]",
+ )
+ ),
+ Optional(
+ OneOrMore(NonTerminal("SPACE")),
+ Choice(0,
+ NonTerminal("List"),
+ NonTerminal("Words")
+ )
+ ),
+ NonTerminal("NEWLINE"),
+ End("complex")
+).writeStandalone(
+ open(splitext(basename(__file__))[0] + ".svg", "w").write)