[valadoc] libvaladoc: gir-reader: accept @...



commit 73bb067185c2f5dd2bf1c285c68f8a8680046a76
Author: Florian Brosch <flo brosch gmail com>
Date:   Thu Jan 5 23:26:08 2012 +0100

    libvaladoc: gir-reader: accept @...

 .../documentation/gtkdoccommentparser.vala         |   12 ++++++++++--
 .../documentation/gtkdoccommentscanner.vala        |   19 ++++++++++++++++---
 2 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/src/libvaladoc/documentation/gtkdoccommentparser.vala b/src/libvaladoc/documentation/gtkdoccommentparser.vala
index 984f56d..b804692 100644
--- a/src/libvaladoc/documentation/gtkdoccommentparser.vala
+++ b/src/libvaladoc/documentation/gtkdoccommentparser.vala
@@ -58,20 +58,28 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
 		int offset = 0;
 		while ((offset = text.content.index_of_char ('.', offset)) >= 0) {
 			if (offset >= 2) {
-				// ignore e.g.
+				// ignore "e.g."
 				unowned string cmp4 = ((string) (((char*) text.content) + offset - 2));
 				if (cmp4.has_prefix (" e.g.") || cmp4.has_prefix ("(e.g.")) {
 					offset = offset + 3;
 					continue;
 				}
 
-				// ignore i.e.
+				// ignore "i.e."
 				if (cmp4.has_prefix (" i.e.") || cmp4.has_prefix ("(i.e.")) {
 					offset = offset + 3;
 					continue;
 				}
 			}
 
+			unowned string cmp0 = ((string) (((char*) text.content) + offset));
+
+			// ignore ... (varargs)
+			if (cmp0.has_prefix ("...")) {
+				offset = offset + 3;
+				continue;
+			}
+
 			Text sec = factory.create_text (text.content.substring (offset+1, -1));
 			text.content = text.content.substring (0, offset+1);
 			return sec;
diff --git a/src/libvaladoc/documentation/gtkdoccommentscanner.vala b/src/libvaladoc/documentation/gtkdoccommentscanner.vala
index ca03b15..5b8793c 100644
--- a/src/libvaladoc/documentation/gtkdoccommentscanner.vala
+++ b/src/libvaladoc/documentation/gtkdoccommentscanner.vala
@@ -179,6 +179,17 @@ public class Valadoc.Gtkdoc.Scanner {
 		return (int) ((char*) a - (char*) b);
 	}
 
+	private inline int vararg_prefix () {
+		if (this.pos.has_prefix ("...")) {
+			next_char ();
+			next_char ();
+			next_char ();
+			return 3;
+		}
+
+		return 0;
+	}
+
 	private inline int id_prefix () {
 		if (!letter (get ())) {
 			return 0;
@@ -252,9 +263,11 @@ public class Valadoc.Gtkdoc.Scanner {
 		int id_len = 0;
 
 		if ((id_len = id_prefix ()) == 0) {
-			this.column = column_start;
-			this.pos = start;
-			return null;
+			if (type == TokenType.GTKDOC_PARAM && (id_len = vararg_prefix ()) == 0) {
+				this.column = column_start;
+				this.pos = start;
+				return null;
+			}
 		}
 
 		unowned string separator = this.pos;



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