]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
Parser: Make {{{ source code }}} acceptable inline
authorDidier 'Ptitjes <ptitjes at free dot fr>
Sat, 31 Oct 2009 12:33:01 +0000 (13:33 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Sat, 31 Oct 2009 12:33:01 +0000 (13:33 +0100)
src/libvaladoc/content/sourcecode.vala
src/libvaladoc/documentation/documentationparser.vala

index f0ff3edf55db211d8a9d765e1dc4e8d957aecb90..1841413a0b823d9dc0286517ca24b729202f0824 100755 (executable)
@@ -22,8 +22,7 @@
 
 using Gee;
 
-
-public class Valadoc.Content.SourceCode : ContentElement, Block {
+public class Valadoc.Content.SourceCode : ContentElement, Inline {
        public enum Language {
                GENIE,
                VALA,
index 48e92146b8a45bb49bd60be0e6656df8d40ba813..7da33e6b2db16a0f5219ea94bcbeb2ea725a639a 100644 (file)
@@ -329,10 +329,19 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
                        .set_name ("Link")
                        .set_start (() => { push (_factory.create_link ()); });
 
+               Rule source_code =
+                       Rule.seq ({
+                               TokenType.TRIPLE_OPEN_BRACE.action ((token) => { _scanner.set_code_escape_mode (true); }),
+                               TokenType.any_word ().action ((token) => { ((SourceCode) peek ()).code = token.to_string (); }),
+                               TokenType.TRIPLE_CLOSED_BRACE.action ((token) => { _scanner.set_code_escape_mode (false); })
+                       })
+                       .set_name ("SourceCode")
+                       .set_start (() => { push (_factory.create_source_code ()); });
+
                run.set_rule (
                        Rule.many ({
                                Rule.one_of ({
-                                       text, inline_taglet, bold, italic, underlined, monospace, embedded, link
+                                       text, inline_taglet, bold, italic, underlined, monospace, embedded, link, source_code
                                })
                                .set_reduce (() => { ((InlineContent) peek ()).content.add ((Inline) pop ()); }),
                                Rule.option ({ space })
@@ -360,17 +369,6 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
                        .set_start (() => { push (_factory.create_paragraph ()); })
                        .set_reduce (() => { ((BlockContent) peek ()).content.add ((Block) pop ()); });
 
-               Rule source_code =
-                       Rule.seq ({
-                               TokenType.TRIPLE_OPEN_BRACE.action ((token) => { _scanner.set_code_escape_mode (true); }),
-                               TokenType.any_word ().action ((token) => { ((SourceCode) peek ()).code = token.to_string (); }),
-                               TokenType.TRIPLE_CLOSED_BRACE.action ((token) => { _scanner.set_code_escape_mode (false); }),
-                               TokenType.EOL
-                       })
-                       .set_name ("SourceCode")
-                       .set_start (() => { push (_factory.create_source_code ()); })
-                       .set_reduce (() => { ((BlockContent) peek ()).content.add ((Block) pop ()); });
-
                Rule indented_item =
                        Rule.seq ({
                                Rule.many ({
@@ -516,7 +514,6 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
 
                Rule blocks =
                        Rule.one_of ({
-                               source_code,
                                indented_blocks,
                                table,
                                headline,