From 49f65ea2ee7f6939c9220a32641af202cccb0835 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <pgesang@ix.urz.uni-heidelberg.de>
Date: Mon, 29 Aug 2011 09:29:46 +0200
Subject: Solidified Comment Blocks

Thanks to Philipp A. for the bug report!
---
 mod/tex/context/third/rst/rst_context.lua |  4 ++--
 mod/tex/context/third/rst/rst_parser.lua  | 21 ++++++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)

(limited to 'mod/tex/context/third')

diff --git a/mod/tex/context/third/rst/rst_context.lua b/mod/tex/context/third/rst/rst_context.lua
index 1a86da1..1ce25f0 100644
--- a/mod/tex/context/third/rst/rst_context.lua
+++ b/mod/tex/context/third/rst/rst_context.lua
@@ -889,8 +889,8 @@ end
 function rst_context.block_comment (str)
     return fmt([[
 
-\iffalse
-%s\fi
+\iffalse %% start block comment
+%s\fi %% stop block comment
 ]], str)
 end
 
diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua
index 19f0a10..ab80dc2 100644
--- a/mod/tex/context/third/rst/rst_parser.lua
+++ b/mod/tex/context/third/rst/rst_parser.lua
@@ -1176,20 +1176,21 @@ local parser = P{
 -- Comments
 --------------------------------------------------------------------------------
 
-    comment_block = V"comment"^1
-                  * V"end_block"
+    comment_block = V"comment"
+                  * V"end_block"^-1
                   ,
 
     comment = V"double_dot" / ""
             * (V"block_comment" + V"line_comment")
             ,
 
-    block_comment = V"eol"
-                  * Cs(V"indented_lines")
+    block_comment = V"whitespace"^0
+                  * Cs((1 - V"eol")^0 * V"eol"
+                     * V"indented_lines")
                   / rst.block_comment,
 
     line_comment = V"whitespace"^1
-                 * Cs((1 - V"eol")^0 * V"eol")
+                 * C((1 - V"eol")^0 * V"eol")
                  / rst.line_comment
                  ,
 
@@ -1206,16 +1207,18 @@ local parser = P{
                         warn("idt-f", indent, i)
                         state.currentindent = indent
                         return true
-                    end)
+                    end) / ""
                    * (1 - V"eol")^1
-                   * V"eol",
+                   * V"eol"
+                   ,
 
     indented_other = Cmt(V"space"^1, function (s, i, indent)
                         warn("idt-m", #indent, #state.currentindent, #indent == #state.currentindent, i)
                         return indent == state.currentindent
-                    end)
+                    end) / ""
                    * (1 - V"eol")^1
-                   * V"eol",
+                   * V"eol"
+                   ,
 
 --------------------------------------------------------------------------------
 -- Urls
-- 
cgit v1.2.3