diff options
Diffstat (limited to 'libvaladoc/documentation')
-rw-r--r-- | libvaladoc/documentation/documentationparser.vala | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/libvaladoc/documentation/documentationparser.vala b/libvaladoc/documentation/documentationparser.vala index a03480c73..4a9c0c9bd 100644 --- a/libvaladoc/documentation/documentationparser.vala +++ b/libvaladoc/documentation/documentationparser.vala @@ -548,6 +548,16 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator { // Block rules + Rule.Action reduce_paragraph = () => { + var head = (Paragraph) pop (); + ((BlockContent) peek ()).content.add (head); + + Text last_element = head.content.last () as Text; + if (last_element != null) { + last_element.content._chomp (); + } + }; + Rule paragraph = Rule.seq ({ Rule.option ({ @@ -563,15 +573,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator { }) .set_name ("Paragraph") .set_start (() => { push (_factory.create_paragraph ()); }) - .set_reduce (() => { - var head = (Paragraph) pop (); - ((BlockContent) peek ()).content.add (head); - - Text last_element = head.content.last () as Text; - if (last_element != null) { - last_element.content._chomp (); - } - }); + .set_reduce (reduce_paragraph); Rule warning = Rule.seq ({ @@ -876,7 +878,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator { ((Comment) peek ()).taglets.add (head); }); - Rule comment = + Rule ml_comment = Rule.seq ({ TokenType.EOL, Rule.option ({ @@ -886,6 +888,21 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator { Rule.many ({ taglet }) }) }) + .set_name ("MultiLineComment"); + + Rule sl_comment = + Rule.seq ({ + run + }) + .set_start (() => { push (_factory.create_paragraph ()); }) + .set_reduce (reduce_paragraph) + .set_name ("SingleLineComment"); + + Rule comment = + Rule.one_of ({ + ml_comment, + sl_comment + }) .set_name ("Comment") .set_start (() => { push (_factory.create_comment ()); }); |