vala: Add dedicated CastExpression.silent() constructor
[vala-gnome.git] / valadoc / driver.vala
blob60d00e599675748554ef5cc4c8d4057c25e5af25
1 /* driver.vala
3 * Copyright (C) 2011 Florian Brosch
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 * Author:
20 * Florian Brosch <flo.brosch@gmail.com>
24 using Valadoc.Api;
26 /**
27 * Creates an simpler, minimized, more abstract AST for valacs AST.
29 public class Valadoc.Drivers.Driver : Object, Valadoc.Driver {
30 private SymbolResolver resolver;
31 private Api.Tree? tree;
33 public void write_gir (Settings settings, ErrorReporter reporter) {
34 var gir_writer = new Drivers.GirWriter (resolver);
36 // put .gir file in current directory unless -d has been explicitly specified
37 string gir_directory = ".";
38 if (settings.gir_directory != null) {
39 gir_directory = settings.gir_directory;
42 gir_writer.write_file ((Vala.CodeContext) tree.data,
43 gir_directory,
44 "%s-%s.gir".printf (settings.gir_namespace, settings.gir_version),
45 settings.gir_namespace,
46 settings.gir_version,
47 settings.pkg_name);
50 public Api.Tree? build (Settings settings, ErrorReporter reporter) {
51 TreeBuilder builder = new TreeBuilder ();
52 tree = builder.build (settings, reporter);
53 if (reporter.errors > 0) {
54 return null;
57 resolver = new SymbolResolver (builder);
58 tree.accept (resolver);
60 return tree;
65 public Type register_plugin (Valadoc.ModuleLoader module_loader) {
66 return typeof (Valadoc.Drivers.Driver);