From: Florian Brosch Date: Sun, 29 Jan 2012 03:04:47 +0000 (+0100) Subject: gtkdoc-parser: Add a helper for mixed content X-Git-Tag: 0.37.1~3^2~222 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13be912598131eeaf533fb7d4d60ac0ec1ea8b10;p=thirdparty%2Fvala.git gtkdoc-parser: Add a helper for mixed content --- diff --git a/src/libvaladoc/documentation/gtkdoccommentparser.vala b/src/libvaladoc/documentation/gtkdoccommentparser.vala index c3f24c5b6..c6b16c0eb 100644 --- a/src/libvaladoc/documentation/gtkdoccommentparser.vala +++ b/src/libvaladoc/documentation/gtkdoccommentparser.vala @@ -676,17 +676,10 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator { return p; } - private LinkedList? parse_docbook_para () { - if (!check_xml_open_tag ("para")) { - this.report_unexpected_token (current, ""); - return null; - } - - next (); - - LinkedList content = new LinkedList (); - + private LinkedList parse_mixed_content () { + LinkedList content = new LinkedList (); Token tmp = null; + while (tmp != current) { tmp = current; parse_docbook_spaces (); @@ -706,6 +699,19 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator { } } + return content; + } + + private LinkedList? parse_docbook_para () { + if (!check_xml_open_tag ("para")) { + this.report_unexpected_token (current, ""); + return null; + } + + next (); + + LinkedList content = parse_mixed_content (); + if (!check_xml_close_tag ("para")) { this.report_unexpected_token (current, ""); return content; @@ -896,23 +902,27 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator { parse_docbook_spaces (); } + + content.add_all (parse_mixed_content ()); + + /* while (current.type == TokenType.XML_OPEN) { - if (current.content == "inlinegraphic") { + if (current.type == TokenType.XML_OPEN && current.content == "inlinegraphic") { Paragraph p = factory.create_paragraph (); while (current.type == TokenType.XML_OPEN && current.content == "inlinegraphic") { p.content.add (parse_docbook_inlinegraphic ()); - next (); parse_docbook_spaces (); } - } else if (current.content == "programlisting") { + } else if (current.type == TokenType.XML_OPEN && current.content == "programlisting") { append_block_content_not_null (content, parse_docbook_programlisting ()); - next (); + } else if (current.type == TokenType.XML_OPEN && current.content == "para") { + this.append_block_content_not_null_all (content, parse_docbook_para ()); } else { break; } parse_docbook_spaces (); - } + } */ if (!check_xml_close_tag (tag_name)) { this.report_unexpected_token (current, "".printf (tag_name)); @@ -977,12 +987,10 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator { while (current.type == TokenType.XML_OPEN && current.content == "inlinegraphic") { p.content.add (parse_docbook_inlinegraphic ()); - next (); parse_docbook_spaces (); } } else if (current.content == "graphic") { append_block_content_not_null (content, parse_docbook_graphic ()); - next (); } else { break; } @@ -1012,25 +1020,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator { LinkedList content = new LinkedList (); this.footnotes.add (content); - Token tmp = null; - while (tmp != current) { - tmp = current; - parse_docbook_spaces (); - - Run? run = parse_inline_content (); - if (run != null && run.content.size > 0) { - Paragraph p = factory.create_paragraph (); - p.content.add (run); - content.add (p); - continue; - } - - LinkedList lst = parse_block_content (); - if (lst != null && run.content.size > 0) { - content.add_all (lst); - continue; - } - } + content.add_all (parse_mixed_content ()); Paragraph? first = (content.is_empty)? null : content.first () as Paragraph; if (first == null) {