From 4e0e3ac9de16f0cfd60f6666fd942e74a104b7d5 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Sun, 11 Sep 2011 14:45:50 +0200 Subject: fixed quoted included literal block behavior --- mod/tex/context/third/rst/rst_parser.lua | 36 +++++++++++++------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'mod/tex') diff --git a/mod/tex/context/third/rst/rst_parser.lua b/mod/tex/context/third/rst/rst_parser.lua index 43694ce..77d07ef 100644 --- a/mod/tex/context/third/rst/rst_parser.lua +++ b/mod/tex/context/third/rst/rst_parser.lua @@ -641,15 +641,16 @@ local parser = P{ literal_block_marker = V"double_colon" * V"whitespace"^0 * V"eol" * V"blank_line", literal_block_lines = V"unquoted_literal_block_lines" - + V"quoted_literal_block_lines", + + V"quoted_literal_block_lines" + , unquoted_literal_block_lines = V"literal_block_first" * (V"blank_line"^-1 * V"literal_block_other")^0 , - quoted_literal_block_lines = V"quoted_literal_block_first" - * (V"blank_line"^-1 * V"quoted_literal_block_other")^0 - , + quoted_literal_block_lines = V"quoted_literal_block_first" + * V"quoted_literal_block_other"^0 -- no blank lines allowed + , literal_block_first = Cmt(V"space"^1, function (s, i, indent) warn("lbk-f", #indent, "", "", i) @@ -677,10 +678,11 @@ local parser = P{ return #indent >= #state.currentindent end) * V"rest_of_line" - * V"eol", + * V"eol" + , quoted_literal_block_first = Cmt(V"adornment_char", function (s, i, indent) - warn("lbk-f", #indent, "", "", i) + warn("qlb-f", #indent, indent, "", i) if not indent or indent == "" then return false @@ -689,10 +691,11 @@ local parser = P{ return true end) * V"rest_of_line" - * V"eol", + * V"eol" + , quoted_literal_block_other = Cmt(V"adornment_char", function (s, i, indent) - warn("lbk-m", + warn("qlb-m", #indent, #state.currentindent, #indent >= #state.currentindent, @@ -1125,14 +1128,6 @@ local parser = P{ return state.currentindent == indent end), - link_standalone = C(V"uri") - / rst.link_standalone, - - reference = Cs(V"_reference") - / rst.reference, - - _reference = (1 - V"underscore" - V"spacing" - V"eol" - V"punctuation" - V"groupchars")^1 * V"underscore", - included_literal_block = V"literal_block_shorthand" * V"literal_block_markerless" * Cmt(Cp(), function (s, i, _) @@ -1142,8 +1137,8 @@ local parser = P{ end) , - literal_block_shorthand = Cs(((V"colon" * V"space" * V"double_colon") - + V"double_colon") + literal_block_shorthand = Cs((V"colon" * V"space" * V"double_colon" + + V"double_colon") * V"whitespace"^0 * V"eol" * V"blank_line") @@ -1159,8 +1154,7 @@ local parser = P{ / "\\\\unskip:" , - literal_block_markerless = Cs(V"literal_block_lines" - * (V"blank_line"^1 * V"literal_block_lines")^0) + literal_block_markerless = Cs(V"literal_block_lines") * V"blank_line" / rst.included_literal_block , @@ -1172,6 +1166,7 @@ local parser = P{ -- should be safe because this pattern always matches last. reset_depth = Cmt(Cc("nothing") / "", function (s,i, something) state.depth = 0 + warn("reset", "", state.depth, #state.currentindent, i) return true end) , @@ -1242,7 +1237,6 @@ local parser = P{ word = (1 - V"punctuation" - V"end_block" - V"spacing" - V"eol")^1, -- TODO : no punctuation (later) asterisk = P"*", - double_asterisk = V"asterisk" * V"asterisk", bareia = P"`", double_bareia = V"bareia" * V"bareia", -- cgit v1.2.3