]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
libvaladoc: gir-reader: accept @...
authorFlorian Brosch <flo.brosch@gmail.com>
Thu, 5 Jan 2012 22:26:08 +0000 (23:26 +0100)
committerFlorian Brosch <flo.brosch@gmail.com>
Thu, 5 Jan 2012 22:26:08 +0000 (23:26 +0100)
src/libvaladoc/documentation/gtkdoccommentparser.vala
src/libvaladoc/documentation/gtkdoccommentscanner.vala

index 984f56dff91140fab10a7bcbae2ec5289cce71d9..b804692f026e75dc9409af41faae8f2799bcd7b2 100644 (file)
@@ -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;
index ca03b1530db7abae1502a8882bbabb9ea9f728d0..5b8793c5b322b42926e883350e989712dcbeacd7 100644 (file)
@@ -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;