commit 38052372387b8eb9fd73c5d2e1c6c1aad1bbd2d6
parent 5ba278807f952ad58765cb7bba149991cd35c8cd
Author: gearsix <gearsix@tuta.io>
Date: Sat, 28 Aug 2021 11:30:00 +0100
Merge branch 'master' of https://notabug.org/gearsix/txt2html
Diffstat:
M | ast.txt | | | 25 | ++++++++++++------------- |
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/ast.txt b/ast.txt
@@ -2,26 +2,25 @@
ast
===
-pseudo-code to help remember the parsing rules
-for the ast, should try convert to to LARL when
-there's time.
+pseudo regex to help remember the syntax rules.
\u = unicode character (note utf-x currently just using std c ascii support)
\t = horizintal tab
\n = newline
+{x} = see rule x, 'x' must be the name of a rule or it's just regex syntax
node{
- "\n\n" = '<//>'
- "\u." = '<ol>', '<li>' = {list}
- "[*-] " = '<ul>', '<li>' = {list}
- "\t\u" = '<pre>'
- "\u\n==={=}\n" = '<h1>'
- "\u\n---{-}\n" = '<h2>'
- "\u[\u\n\t]\n\n" = '<p>'
+ "\n\n" = close open tag
+ "\u." = ol,li,{list}
+ "[*-] " = ul,li,{list}
+ "\t\u+" = pre/
+ "\u\n={3,}\n" = h1/
+ "\u\n-{3,}\n" = h2/
+ "\u(\u|\n|\t)+\n\n" = p/
}
list{
- "\n[\n\0]" = '</li>','</ol>'
- "\n\u." = '</li>','<li>'
- "\n\u[^.]" = (hardbreaks) ? '<br/>' : ' '
+ "\n\n" = '/li','/ol'
+ "\n\u." = '/li','li'
+ "\n\u[^.]" = (hardbreaks) ? 'br/' : ' '
}