]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
error reporter improvements
authorFlorian Brosch <flo.brosch@gmail.com>
Mon, 11 Jul 2011 21:15:38 +0000 (23:15 +0200)
committerFlorian Brosch <flo.brosch@gmail.com>
Fri, 29 Jul 2011 00:45:25 +0000 (02:45 +0200)
73 files changed:
src/doclets/gtkdoc/commentconverter.vala [changed mode: 0644->0755]
src/doclets/gtkdoc/dbus.vala [changed mode: 0644->0755]
src/doclets/gtkdoc/doclet.vala [changed mode: 0644->0755]
src/doclets/gtkdoc/gcomment.vala [changed mode: 0644->0755]
src/doclets/gtkdoc/generator.vala [changed mode: 0644->0755]
src/doclets/gtkdoc/utils.vala [changed mode: 0644->0755]
src/libvaladoc/api/array.vala [changed mode: 0644->0755]
src/libvaladoc/api/browsable.vala [changed mode: 0644->0755]
src/libvaladoc/api/class.vala [changed mode: 0644->0755]
src/libvaladoc/api/constant.vala [changed mode: 0644->0755]
src/libvaladoc/api/delegate.vala [changed mode: 0644->0755]
src/libvaladoc/api/enum.vala [changed mode: 0644->0755]
src/libvaladoc/api/enumvalue.vala [changed mode: 0644->0755]
src/libvaladoc/api/errorcode.vala [changed mode: 0644->0755]
src/libvaladoc/api/errordomain.vala [changed mode: 0644->0755]
src/libvaladoc/api/field.vala [changed mode: 0644->0755]
src/libvaladoc/api/formalparameter.vala [changed mode: 0644->0755]
src/libvaladoc/api/interface.vala [changed mode: 0644->0755]
src/libvaladoc/api/item.vala [changed mode: 0644->0755]
src/libvaladoc/api/member.vala [changed mode: 0644->0755]
src/libvaladoc/api/method.vala [changed mode: 0644->0755]
src/libvaladoc/api/namespace.vala [changed mode: 0644->0755]
src/libvaladoc/api/node.vala [changed mode: 0644->0755]
src/libvaladoc/api/nodebuilder.vala [changed mode: 0644->0755]
src/libvaladoc/api/package.vala [changed mode: 0644->0755]
src/libvaladoc/api/pointer.vala [changed mode: 0644->0755]
src/libvaladoc/api/property.vala [changed mode: 0644->0755]
src/libvaladoc/api/propertyaccessor.vala [changed mode: 0644->0755]
src/libvaladoc/api/signal.vala [changed mode: 0644->0755]
src/libvaladoc/api/signaturebuilder.vala [changed mode: 0644->0755]
src/libvaladoc/api/struct.vala [changed mode: 0644->0755]
src/libvaladoc/api/symbol.vala [changed mode: 0644->0755]
src/libvaladoc/api/tree.vala [changed mode: 0644->0755]
src/libvaladoc/api/typeparameter.vala [changed mode: 0644->0755]
src/libvaladoc/api/typereference.vala [changed mode: 0644->0755]
src/libvaladoc/api/typesymbol.vala [changed mode: 0644->0755]
src/libvaladoc/charts/chart.vala [changed mode: 0644->0755]
src/libvaladoc/charts/chartfactory.vala [changed mode: 0644->0755]
src/libvaladoc/charts/hierarchychart.vala [changed mode: 0644->0755]
src/libvaladoc/charts/simplechartfactory.vala [changed mode: 0644->0755]
src/libvaladoc/content/embedded.vala
src/libvaladoc/ctyperesolver.vala [changed mode: 0644->0755]
src/libvaladoc/devhelp-markupwriter.vala [changed mode: 0644->0755]
src/libvaladoc/documentation/commentscanner.vala [changed mode: 0644->0755]
src/libvaladoc/documentation/documentationparser.vala [changed mode: 0644->0755]
src/libvaladoc/documentation/girdocumentationscanner.vala [changed mode: 0644->0755]
src/libvaladoc/documentation/wiki.vala
src/libvaladoc/documentation/wikiscanner.vala [changed mode: 0644->0755]
src/libvaladoc/errorreporter.vala
src/libvaladoc/html/htmlchartfactory.vala [changed mode: 0644->0755]
src/libvaladoc/html/linkhelper.vala [changed mode: 0644->0755]
src/libvaladoc/importer/documentationimporter.vala [changed mode: 0644->0755]
src/libvaladoc/importer/girdocumentationbuilder.vala [changed mode: 0644->0755]
src/libvaladoc/importer/girdocumentationimporter.vala [changed mode: 0644->0755]
src/libvaladoc/importer/valadocdocumentationimporter.vala [changed mode: 0644->0755]
src/libvaladoc/importer/valadocdocumentationimporterscanner.vala [changed mode: 0644->0755]
src/libvaladoc/markupwriter.vala [changed mode: 0644->0755]
src/libvaladoc/parser/manyrule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/oneofrule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/optionalrule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/parser.vala [changed mode: 0644->0755]
src/libvaladoc/parser/parsercallback.vala [changed mode: 0644->0755]
src/libvaladoc/parser/rule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/scanner.vala [changed mode: 0644->0755]
src/libvaladoc/parser/sequencerule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/sourcelocation.vala [changed mode: 0644->0755]
src/libvaladoc/parser/stubrule.vala [changed mode: 0644->0755]
src/libvaladoc/parser/token.vala [changed mode: 0644->0755]
src/libvaladoc/parser/tokentype.vala [changed mode: 0644->0755]
src/libvaladoc/taglets/tagletinit.vala [changed mode: 0644->0755]
src/libvaladoc/taglets/tagletlink.vala
src/libvaladoc/taglets/tagletsee.vala
src/libvaladoc/taglets/tagletthrows.vala

old mode 100644 (file)
new mode 100755 (executable)
index 4192199..e520983
@@ -144,7 +144,7 @@ public class Gtkdoc.CommentConverter : ContentVisitor {
                        break;
 
                default:
-                       reporter.simple_warning ("GtkDoc: unsupported list type: %s".printf (list.bullet.to_string ()));
+                       reporter.simple_warning ("GtkDoc: unsupported list type: %s", list.bullet.to_string ());
                        break;
                }
 
old mode 100644 (file)
new mode 100755 (executable)
index 45c8198..c49560b
@@ -142,7 +142,7 @@ namespace Gtkdoc.DBus {
                        var xml_file = Path.build_filename (xml_dir, "%s.xml".printf (to_docbook_id (name)));
                        var writer = new TextWriter (xml_file, "w");
                        if (!writer.open ()) {
-                               reporter.simple_error ("GtkDoc: unable to open %s for writing".printf (writer.filename));
+                               reporter.simple_error ("GtkDoc: unable to open %s for writing", writer.filename);
                                return false;
                        }
                        writer.write_line (to_string (reporter));
old mode 100644 (file)
new mode 100755 (executable)
index fc9b30f..4845ba6
@@ -57,7 +57,7 @@ namespace Gtkdoc.Config {
                        unowned string[] gtkdoc_args = args;
                        opt_context.parse (ref gtkdoc_args);
                } catch (OptionError e) {
-                       reporter.simple_error ("GtkDoc: Error: %s\nRun '-X --help' to see a full list of available command line options.".printf (e.message));
+                       reporter.simple_error ("GtkDoc: Error: %s\nRun '-X --help' to see a full list of available command line options.", e.message);
                        return false;
                }
 
@@ -155,7 +155,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                }
 
                if (!copy_file (filename, Path.build_filename (comments_dir, Path.get_basename (filename)))) {
-                       reporter.simple_error ("GtkDoc: Can't copy %s".printf (filename));
+                       reporter.simple_error ("GtkDoc: Can't copy %s", filename);
                }
        }
 
@@ -186,7 +186,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        prepared += filename;
 
                        if (!FileUtils.test (filename, FileTest.EXISTS)) {
-                               reporter.simple_error ("GtkDoc: %s not found".printf (relative_filename));
+                               reporter.simple_error ("GtkDoc: %s not found", relative_filename);
                                continue;
                        }
 
@@ -195,7 +195,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        } else if (filename.has_suffix (".h")) {
                                prepare_h_file (filename);
                        } else {
-                               reporter.simple_error ("GtkDoc: %s is not a supported source file type. Only .h, and .c files are supported.".printf (relative_filename));
+                               reporter.simple_error ("GtkDoc: %s is not a supported source file type. Only .h, and .c files are supported.", relative_filename);
                        }
                }
 
@@ -235,7 +235,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                try {
                        Process.spawn_sync (settings.path, args, null, SpawnFlags.SEARCH_PATH, null, null, null);
                } catch (Error e) {
-                       reporter.simple_error ("gtkdoc-scan: %s".printf (e.message));
+                       reporter.simple_error ("gtkdoc-scan: %s", e.message);
                        return false;
                }
 
@@ -277,7 +277,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        string cflags;
                        Process.spawn_sync (null, pc_cflags, null, SpawnFlags.SEARCH_PATH, null, out cflags, out stderr, out status);
                        if (status != 0) {
-                               reporter.simple_error ("GtkDoc: pkg-config cflags error: %s".printf (stderr));
+                               reporter.simple_error ("GtkDoc: pkg-config cflags error: %s", stderr);
                                return false;
                        }
                        cflags = cflags.strip ();
@@ -285,7 +285,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        string libs;
                        Process.spawn_sync (null, pc_libs, null, SpawnFlags.SEARCH_PATH, null, out libs, out stderr, out status);
                        if (status != 0) {
-                               reporter.simple_error ("GtkDoc: pkg-config libs error: %s".printf (stderr));
+                               reporter.simple_error ("GtkDoc: pkg-config libs error: %s", stderr);
                                return false;
                        }
 
@@ -309,7 +309,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
 
                        Process.spawn_sync (settings.path, args, env, SpawnFlags.SEARCH_PATH, null, null, null);
                } catch (Error e) {
-                       reporter.simple_error ("gtkdoc-scangobj: %s".printf (e.message));
+                       reporter.simple_error ("gtkdoc-scangobj: %s", e.message);
                        return false;
                }
 
@@ -332,7 +332,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                try {
                        Process.spawn_sync (settings.path, args, null, SpawnFlags.SEARCH_PATH, null, null, null);
                } catch (Error e) {
-                       reporter.simple_error ("gtkdoc-mkdb: %s".printf (e.message));
+                       reporter.simple_error ("gtkdoc-mkdb: %s", e.message);
                        return false;
                }
 
@@ -342,7 +342,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        try {
                                FileUtils.get_contents (main_file, out contents);
                        } catch (Error e) {
-                               reporter.simple_error ("GtkDoc: Error while reading main file '%s' contents: %s".printf (main_file, e.message));
+                               reporter.simple_error ("GtkDoc: Error while reading main file '%s' contents: %s", main_file, e.message);
                                return false;
                        }
 
@@ -374,7 +374,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                        try {
                                FileUtils.set_contents (main_file, contents);
                        } catch (Error e) {
-                               reporter.simple_error ("GtkDoc: Error while writing main file '%s' contents: %s".printf (main_file, e.message));
+                               reporter.simple_error ("GtkDoc: Error while writing main file '%s' contents: %s", main_file, e.message);
                                return false;
                        }
                }
@@ -396,7 +396,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                                                  settings.pkg_name, "../%s-docs.xml".printf (settings.pkg_name)},
                                                null, SpawnFlags.SEARCH_PATH, null, null, null);
                } catch (Error e) {
-                       reporter.simple_error ("gtkdoc-mkhtml: %s".printf (e.message));
+                       reporter.simple_error ("gtkdoc-mkhtml: %s", e.message);
                        return false;
                }
 
@@ -409,7 +409,7 @@ public class Gtkdoc.Director : Valadoc.Doclet, Object {
                                                  "--html-dir", html_dir },
                                                null, SpawnFlags.SEARCH_PATH, null, null, null);
                } catch (Error e) {
-                       reporter.simple_error ("gtkdoc-fixxref: %s".printf (e.message));
+                       reporter.simple_error ("gtkdoc-fixxref: %s", e.message);
                        return false;
                }
 
old mode 100644 (file)
new mode 100755 (executable)
index 6e686fa..3b5c8b6
@@ -1,24 +1,24 @@
 /* gcomment.vala
-*
-* Copyright (C) 2010 Luca Bruno
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Lesser General Public
-* License as published by the Free Software Foundation; either
-* version 2.1 of the License, or (at your option) any later version.
-*
-* This library is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this library; if not, write to the Free Software
-* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
-*
-* Author:
-     Luca Bruno <lethalman88@gmail.com>
-*/
+ *
+ * Copyright (C) 2010 Luca Bruno
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+ *
+ * Author:
+ *     Luca Bruno <lethalman88@gmail.com>
+ */
 
 public class Gtkdoc.Header {
        public string name;
@@ -149,7 +149,7 @@ public class Gtkdoc.GComment {
                        } else if (header.name == "Since") {
                                since = header.value;
                        } else {
-                               reporter.simple_warning ("GtkDoc: Unknown versioning tag '%s'".printf (header.name));
+                               reporter.simple_warning ("GtkDoc: Unknown versioning tag '%s'", header.name);
                        }
                }
 
old mode 100644 (file)
new mode 100755 (executable)
index 950d57e..7b4974e
@@ -68,7 +68,7 @@ public class Gtkdoc.Generator : Api.Visitor {
 
                var sections_writer = new TextWriter (sections, "a");
                if (!sections_writer.open ()) {
-                       reporter.simple_error ("GtkDoc: unable to open %s for writing".printf (sections_writer.filename));
+                       reporter.simple_error ("GtkDoc: unable to open %s for writing", sections_writer.filename);
                        return false;
                }
 
@@ -78,7 +78,7 @@ public class Gtkdoc.Generator : Api.Visitor {
                        var cwriter = new TextWriter (Path.build_filename (code_dir, "%s.c".printf (basename)), "w");
 
                        if (!cwriter.open ()) {
-                               reporter.simple_error ("GtkDoc: unable to open %s for writing".printf (cwriter.filename));
+                               reporter.simple_error ("GtkDoc: unable to open %s for writing", cwriter.filename);
                                return false;
                        }
 
old mode 100644 (file)
new mode 100755 (executable)
index 250331e..942df9e
@@ -172,7 +172,7 @@ namespace Gtkdoc {
                        Process.spawn_command_line_sync (pc, null, null, out exit_status);
                        return (0 == exit_status);
                } catch (SpawnError e) {
-                       reporter.simple_warning ("GtkDoc: Error pkg-config --exists %s: %s".printf (package_name, e.message));
+                       reporter.simple_warning ("GtkDoc: Error pkg-config --exists %s: %s", package_name, e.message);
                        return false;
                }
        }
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 527e9ca8b2af4647b3355be132c1642d3179a370..e3be516d0d9a6baf68e7049a965838f2a8fe6884 100755 (executable)
@@ -44,7 +44,7 @@ public class Valadoc.Content.Embedded : ContentElement, Inline, StyleAttributes
 
        public override void check (Api.Tree api_root, Api.Node container, ErrorReporter reporter, Settings settings) {
                if (!FileUtils.test (url, FileTest.EXISTS | FileTest.IS_REGULAR)) {
-                       reporter.simple_error ("%s does not exist".printf (url));
+                       reporter.simple_error ("%s does not exist", url);
                } else {
                        package = container.package;
                }
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 2753874..9de199b
@@ -218,7 +218,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
                                        ((InlineContent) peek ()).content.add (_factory.create_text (" "));
                                        return;
                                } else if (list.bullet != bullet) {
-                                       _parser.error ("Invalid bullet type '%s': expected '%s'".printf (bullet_type_string (bullet), bullet_type_string (list.bullet)));
+                                       _parser.error (null, "Invalid bullet type '%s': expected '%s'", bullet_type_string (bullet), bullet_type_string (list.bullet));
                                        return;
                                }
 
@@ -278,7 +278,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
        private void gir_append_link (Token token) throws ParserError {
                var taglet = _factory.create_taglet ("link") as Taglets.Link;
                if (!(taglet is Inline)) {
-                       _parser.error ("Invalid taglet in this context: link");
+                       _parser.error (null, "Invalid taglet in this context: link");
                }
                taglet.symbol_name = "c::"+token.to_string ();
                push (taglet);
@@ -864,7 +864,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
                                        TokenType.any_word ().action ((token) => {
                                                var taglet = _factory.create_taglet (token.to_string ());
                                                if (!(taglet is Inline)) {
-                                                       _parser.error ("Invalid taglet in this context: %s".printf (token.to_string ()));
+                                                       _parser.error (null, "Invalid taglet in this context: %s".printf (token.to_string ()));
                                                }
                                                push (taglet);
                                                Rule? taglet_rule = taglet.get_parser_rule (multiline_run);
@@ -1229,7 +1229,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
                                TokenType.any_word ().action ((token) => {
                                        var taglet = _factory.create_taglet (token.to_string ());
                                        if (!(taglet is Block)) {
-                                               _parser.error ("Invalid taglet in this context", token);
+                                               _parser.error (token, "Invalid taglet in this context");
                                        }
                                        push (taglet);
                                        Rule? taglet_rule = taglet.get_parser_rule (multiline_run);
index 33f77adda772ad3cd04ae22900af3205d8fe79c4..7ac946101bafe974c24ef98a76c3dbe07e5ee4e4 100755 (executable)
@@ -68,7 +68,7 @@ public class Valadoc.WikiPage : Object, Documentation {
                        FileUtils.get_contents (this.path, out content);
                        this.documentation_str = content;
                } catch (FileError err) {
-                       reporter.simple_error ("Unable to read file `%s': %s".printf (this.path, err.message));
+                       reporter.simple_error ("Unable to read file `%s': %s", this.path, err.message);
                }
        }
 
@@ -122,7 +122,7 @@ public class Valadoc.WikiPageTree : Object {
                                }
                        }
                } catch (FileError err) {
-                       reporter.simple_error ("Unable to open directory `%s': %s".printf (path, err.message));
+                       reporter.simple_error ("Unable to open directory `%s': %s", path, err.message);
                }
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index cb88aa19e11874df0159e4c31c383431c42e2c63..454d087f8034104087f9dbfd25a184368b5276fe 100755 (executable)
@@ -55,11 +55,26 @@ public class Valadoc.ErrorReporter : Object {
 
        private enum ErrorType {
                WARNING,
-               ERROR
+               ERROR;
+
+               public string to_string () {
+                       switch (this) {
+                       case ErrorType.WARNING:
+                               return "warning";
+
+                       case ErrorType.ERROR:
+                               return "error";
+                       }
+
+                       assert_not_reached ();
+               }
        }
 
-       private inline void msg (ErrorType type, string file, long line, long startpos, long endpos, string errline, string msg) {
-               this.stream.printf ("%s:%lu.%lu-%lu.%lu: %s: %s\n", file, line, startpos, line, endpos, (type == ErrorType.ERROR)? "error" : "warning", msg);
+       private inline void msg (ErrorType type, string file, long line, long startpos, long endpos, string errline, string msg_format, va_list args) {
+               this.stream.printf ("%s:%lu.%lu-%lu.%lu: %s: ", file, line, startpos, line, endpos, type.to_string ());
+               this.stream.vprintf (msg_format, args);
+               this.stream.putc ('\n');
+
                if (startpos <= endpos) {
                        this.stream.printf ("%s\n", errline);
                        for (int i = 0; i < errline.char_count ()+1; i++) {
@@ -75,25 +90,31 @@ public class Valadoc.ErrorReporter : Object {
                }
        }
 
-       public void simple_warning (string msg) {
-               this.stream.puts (msg);
+       public void simple_warning (string msg_format, ...) {
+               var args = va_list();
+               this.stream.vprintf (msg_format, args);
                this.stream.putc ('\n');
                this._warnings++;
        }
 
-       public void simple_error (string msg) {
-               this.stream.puts (msg);
+       public void simple_error (string msg_format, ...) {
+               var args = va_list();
+               this.stream.vprintf (msg_format, args);
                this.stream.putc ('\n');
                this._errors++;
        }
 
-       public void error (string file, long line, long startpos, long endpos, string errline, string msg) {
-               this.msg (ErrorType.ERROR, file, line, startpos, endpos, errline, msg);
+       //TODO
+       public void error (string file, long line, long startpos, long endpos, string errline, string msg_format, ...) {
+               var args = va_list();
+               this.msg (ErrorType.ERROR, file, line, startpos, endpos, errline, msg_format, args);
                this._errors++;
        }
 
-       public void warning (string file, long line, long startpos, long endpos, string errline, string msg) {
-               this.msg (ErrorType.WARNING, file, line, startpos, endpos, errline, msg);
+       //TODO
+       public void warning (string file, long line, long startpos, long endpos, string errline, string msg_format, ...) {
+               var args = va_list();
+               this.msg (ErrorType.WARNING, file, line, startpos, endpos, errline, msg_format, args);
                this._warnings++;
        }
 }
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index c35bd37..189acf7
@@ -121,7 +121,7 @@ public class Valadoc.Importer.ValadocDocumentationImporter : DocumentationImport
                }
 
                if (symbol == null) {
-                       reporter.simple_warning ("%s does not exist".printf (symbol_name));
+                       reporter.simple_warning ("%s does not exist", symbol_name);
                        return ;
                }
 
@@ -142,7 +142,7 @@ public class Valadoc.Importer.ValadocDocumentationImporter : DocumentationImport
                                _parser.parse ((string) content, filename, 0, 0);
                        }
                } catch (FileError err) {
-                       reporter.simple_error ("Unable to map file `%s': %s".printf (filename, err.message));
+                       reporter.simple_error ("Unable to map file `%s': %s", filename, err.message);
                } catch (ParserError err) {
                }
        }
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 9543c4f..40bf627
@@ -78,9 +78,9 @@ internal class Valadoc.ManyRule : Rule {
                }
 
                if (_scheme is TokenType) {
-                       parser.error ("expected %s".printf (((TokenType) _scheme).to_pretty_string ()), token);
+                       parser.error (null, "expected %s", ((TokenType) _scheme).to_pretty_string ());
                } else {
-                       parser.error ("unexpected token", token);
+                       parser.error (token, "unexpected token");
                }
                assert_not_reached ();
        }
old mode 100644 (file)
new mode 100755 (executable)
index 4d4a793..19e9419
@@ -70,7 +70,7 @@ internal class Valadoc.OneOfRule : Rule {
                        return false;
                }
 
-               parser.error ("unexpected token", token);
+               parser.error (token, "unexpected token");
                assert_not_reached ();
        }
 
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 6bc0167..49147e2
@@ -69,7 +69,7 @@ public class Valadoc.Parser : ParserCallback {
                        _scanner.end ();
 
                        if (rule_stack.size != 0) {
-                               error ("Rule stack is not empty!");
+                               error (null, "Rule stack is not empty!");
                        }
                } catch (ParserError e) {
                        #if DEBUG
@@ -100,7 +100,7 @@ public class Valadoc.Parser : ParserCallback {
 
                        // Check for invalid recursion
                        if (rule_depth != rule_stack.size && peek_rule () == rule) {
-                               error ("Parser state error");
+                               error (null, "Parser state error");
                                break;
                        }
                        rule = peek_rule ();
@@ -224,8 +224,16 @@ public class Valadoc.Parser : ParserCallback {
                return false;
        }
 
-       public void warning (string message, Token? token = null) {
-               string error_message = message + (token != null ? ": " + token.to_pretty_string () : "");
+       public void warning (Token? token, string message, ...) {
+               va_list args = va_list ();
+               string error_message;
+
+               if (token == null) {
+                       error_message = message.vprintf (args) + ": " + token.to_pretty_string ();
+               } else {
+                       error_message = message;
+               }
+
                _reporter.warning (_filename,
                                   get_line (token),
                                   get_start_column (token),
@@ -234,13 +242,23 @@ public class Valadoc.Parser : ParserCallback {
                                   error_message);
        }
 
-       public void error (string message, Token? token = null) throws ParserError {
-               string error_message = message + (token != null ? ": " + token.to_pretty_string () : "");
-               _reporter.error (_filename, get_line (token),
+       public void error (Token? token, string message, ...) throws ParserError {
+               va_list args = va_list ();
+               string error_message;
+
+               if (token == null) {
+                       error_message = message.vprintf (args) + ": " + token.to_pretty_string ();
+               } else {
+                       error_message = message;
+               }
+
+               _reporter.error (_filename,
+                                                get_line (token),
                                 get_start_column (token),
                                 get_end_column (token),
                                 _scanner.get_line_content (),
                                 error_message);
+
                throw new ParserError.UNEXPECTED_TOKEN (error_message);
        }
 
old mode 100644 (file)
new mode 100755 (executable)
index a0526e2..a3d6792
@@ -32,6 +32,6 @@ public interface Valadoc.ParserCallback {
        public abstract bool would_parent_accept_token (Token token);
        public abstract bool would_parent_reduce_to_rule (Token token, Rule rule);
 
-       public abstract void warning (string message, Token? token = null);
-       public abstract void error (string message, Token? token = null) throws ParserError;
+       public abstract void warning (Token? token, string message, ...);
+       public abstract void error (Token? token, string message, ...) throws ParserError;
 }
old mode 100644 (file)
new mode 100755 (executable)
index 76cffc2..b75e39a
@@ -84,7 +84,9 @@ public abstract class Valadoc.Rule : Object {
        }
 
        public enum Forward {
-               NONE, PARENT, CHILD
+               NONE,
+               PARENT,
+               CHILD
        }
 
        public abstract bool is_optional ();
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index b2f9d5a..39bc620
@@ -103,9 +103,9 @@ internal class Valadoc.SequenceRule : Rule {
                }
 
                if (scheme_element is TokenType) {
-                       parser.error ("expected %s".printf (((TokenType) scheme_element).to_pretty_string ()), token);
+                       parser.error (token, "expected %s", ((TokenType) scheme_element).to_pretty_string ());
                } else {
-                       parser.error ("unexpected token", token);
+                       parser.error (token, "unexpected token");
                }
                assert_not_reached ();
        }
old mode 100644 (file)
new mode 100755 (executable)
index 3418e71..51b5bc1
@@ -6,12 +6,12 @@
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
-
+ *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
old mode 100644 (file)
new mode 100755 (executable)
index 871cf0b..9d98b1c
@@ -256,7 +256,11 @@ public class Valadoc.TokenType : Object {
        private TokenType (string string_value, int basic_value, Action? action) {
                _string_value = string_value;
                _basic_value = basic_value;
-               _action = action;
+               if (_action != null) {
+                       _action = (token) => { action (token); };
+               } else {
+                       _action = null;
+               }
        }
 
        private TokenType.basic (string string_value, string? pretty_string = null) {
old mode 100644 (file)
new mode 100755 (executable)
index d7fba14974206313b7abc6bc24a05147316fe6ed..0d61bc33ab64583957061d8207d99107d32f84bb 100755 (executable)
@@ -48,7 +48,7 @@ public class Valadoc.Taglets.Link : InlineTaglet {
 
                if (_symbol == null) {
                        // TODO use ContentElement's source reference
-                       reporter.simple_warning ("%s does not exist".printf (symbol_name));
+                       reporter.simple_warning ("%s does not exist", symbol_name);
                }
 
                base.check (api_root, container, reporter, settings);
index bea41d5c1d745bcd9ae1c93e237224aee2894252..b33e52271d9d94181757cda1942900bc09ad0910 100755 (executable)
@@ -47,7 +47,7 @@ public class Valadoc.Taglets.See : ContentElement, Taglet, Block {
 
                if (symbol == null) {
                        // TODO use ContentElement's source reference
-                       reporter.simple_warning ("%s does not exist".printf (symbol_name));
+                       reporter.simple_warning ("%s does not exist", symbol_name);
                }
        }
 
index 25b652549d158121b5c9b2470929dcd0b5c0ae5d..b58e4e33ef73ba6f2f6c3a3d8284ab33636a54b6 100755 (executable)
@@ -39,7 +39,7 @@ public class Valadoc.Taglets.Throws : InlineContent, Taglet, Block {
                error_domain = api_root.search_symbol_str (container, error_domain_name);
                if (error_domain == null) {
                        // TODO use ContentElement's source reference
-                       reporter.simple_error ("%s does not exist".printf (error_domain_name));
+                       reporter.simple_error ("%s does not exist", error_domain_name);
                }
 
                base.check (api_root, container, reporter, settings);