aboutsummaryrefslogtreecommitdiff
path: root/def_Paragraph.py
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-17 16:34:36 +0200
committerJonas Smedegaard <dr@jones.dk>2025-05-17 16:34:36 +0200
commit8f185d6a88b13eea2f5fdfb6bc34f197b40fb121 (patch)
tree6fd4adcdfcd630df0a7ca7c40ea6f75a4a0d4ef1 /def_Paragraph.py
parentb4125c5a22700f86784b94fdb8587b7cef8d110b (diff)
add chapter on Markdown and annotation
Diffstat (limited to 'def_Paragraph.py')
-rwxr-xr-xdef_Paragraph.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/def_Paragraph.py b/def_Paragraph.py
new file mode 100755
index 0000000..3513315
--- /dev/null
+++ b/def_Paragraph.py
@@ -0,0 +1,29 @@
+#!/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"),
+ NonTerminal("Words"),
+ ZeroOrMore(
+ Choice(0,
+ Sequence(
+ Optional(NonTerminal("SPACE")),
+ NonTerminal("NEWLINE"),
+ NonTerminal("Words")
+ ),
+ Sequence(
+ NonTerminal("HardBreak"),
+ NonTerminal("Words")
+ )
+ )
+ ),
+ NonTerminal("NEWLINE"),
+ OneOrMore(NonTerminal("NEWLINE")),
+ End("complex")
+).writeStandalone(
+ open(splitext(basename(__file__))[0] + ".svg", "w").write)