summaryrefslogtreecommitdiff
path: root/rst_parser.lua
diff options
context:
space:
mode:
Diffstat (limited to 'rst_parser.lua')
-rw-r--r--rst_parser.lua67
1 files changed, 40 insertions, 27 deletions
diff --git a/rst_parser.lua b/rst_parser.lua
index 5b6a1e9..6466b81 100644
--- a/rst_parser.lua
+++ b/rst_parser.lua
@@ -193,11 +193,12 @@ local parser = P{
--------------------------------------------------------------------------------
block = V"target_block"
+ + V"comment"
+ Cs(V"section") / rst.escape
+ Cs(V"transition") --/ rst.escape
+ Cs(V"list") / rst.escape
+ Cs(V"paragraph") / rst.escape
- + V"comment",
+ ,
--------------------------------------------------------------------------------
-- Lists
@@ -232,29 +233,6 @@ local parser = P{
field_body = C(V"rest_of_line" * V"eol"
* V"indented_lines"^-1),
- indented_lines = V"indented_first"
- * (V"indented_other"
- - V"field_marker")^0,
-
- indented_first = Cmt(V"space"^1, function (s, i, indent)
- warn("idt-f", indent, i)
- if not indent or
- indent == "" then
- return false
- end
- tracklists.currentindent = indent
- return true
- end)
- * V"rest_of_line"
- * V"eol",
-
- indented_other = Cmt(V"space"^1, function (s, i, indent)
- warn("idt-m", indent, tracklists.currentindent, indent == tracklists.currentindent, i)
- return indent == tracklists.currentindent
- end)
- * V"rest_of_line"
- * V"eol",
-
--------------------------------------------------------------------------------
-- Definition lists
--------------------------------------------------------------------------------
@@ -600,9 +578,44 @@ local parser = P{
-- Comments
--------------------------------------------------------------------------------
- comment = Cs(V"doubledot"
- * (1 - V"eol")^0
- * V"eol") / ">>comment<<",
+ comment = V"block_comment" + V"line_comment",
+
+ block_comment = V"doubledot" * V"whitespace"^0 * V"eol"
+ * Cs(V"indented_lines")
+ * V"eol"^0
+ --* V"blank_line"^0
+ / rst.block_comment,
+
+ line_comment = V"doubledot" * V"whitespace"^0
+ * Cs((1 - V"eol")^0 * V"eol")
+ / rst.line_comment,
+
+--------------------------------------------------------------------------------
+-- Generic indented block
+--------------------------------------------------------------------------------
+
+ indented_lines = V"indented_first"
+ * (V"indented_other"
+ - V"blank_line" - V"field_marker")^0,
+
+ indented_first = Cmt(V"space"^1, function (s, i, indent)
+ warn("idt-f", indent, i)
+ if not indent or
+ indent == "" then
+ return false
+ end
+ tracklists.currentindent = indent
+ return true
+ end)
+ * V"rest_of_line"
+ * V"eol",
+
+ indented_other = Cmt(V"space"^1, function (s, i, indent)
+ warn("idt-m", indent, tracklists.currentindent, indent == tracklists.currentindent, i)
+ return indent == tracklists.currentindent
+ end)
+ * V"rest_of_line"
+ * V"eol",
--------------------------------------------------------------------------------
-- Urls