[valadoc] Parser: Make {{{ source code }}} acceptable inline



commit 2f277141d208ff5b3ba8ba209cb46d81d0449754
Author: Didier 'Ptitjes <ptitjes at free dot fr>
Date:   Sat Oct 31 13:33:01 2009 +0100

    Parser: Make {{{ source code }}} acceptable inline

 src/libvaladoc/content/sourcecode.vala             |    3 +-
 .../documentation/documentationparser.vala         |   23 ++++++++-----------
 2 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/src/libvaladoc/content/sourcecode.vala b/src/libvaladoc/content/sourcecode.vala
index f0ff3ed..1841413 100755
--- a/src/libvaladoc/content/sourcecode.vala
+++ b/src/libvaladoc/content/sourcecode.vala
@@ -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,
diff --git a/src/libvaladoc/documentation/documentationparser.vala b/src/libvaladoc/documentation/documentationparser.vala
index 48e9214..7da33e6 100644
--- a/src/libvaladoc/documentation/documentationparser.vala
+++ b/src/libvaladoc/documentation/documentationparser.vala
@@ -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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]