From cb65012eb524eb57b00249f1dee0f245e947cda4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sun, 13 Sep 2009 18:46:11 +0200 Subject: Use new path class, add context and generator classes Use cutl::fs::path instead of std::string in the semantic graph. Add context and generator stubs, to be filled next. Connect everything in the compiler driver. --- cli/cli.cxx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'cli/cli.cxx') diff --git a/cli/cli.cxx b/cli/cli.cxx index 39fff16..3d54452 100644 --- a/cli/cli.cxx +++ b/cli/cli.cxx @@ -3,10 +3,12 @@ // copyright : Copyright (c) 2009 Code Synthesis Tools CC // license : MIT; see accompanying LICENSE file +#include // std::auto_ptr #include #include #include "parser.hxx" +#include "generator.hxx" using namespace std; @@ -20,21 +22,32 @@ int main (int argc, char* argv[]) try { - ifstream ifs (argv[1]); + semantics::path path (argv[1]); + + ifstream ifs (path.string ().c_str ()); if (!ifs.is_open ()) { - wcerr << argv[1] << ": error: unable to open in read mode" << endl; + cerr << path << ": error: unable to open in read mode" << endl; return 1; } ifs.exceptions (ifstream::failbit | ifstream::badbit); parser p; - p.parse (ifs, argv[1]); + auto_ptr unit (p.parse (ifs, path)); + + generator g; + g.generate (*unit, path); + } + catch (semantics::invalid_path const&) + { + cerr << "error: '" << argv[1] << "' is not a valid filesystem path" + << endl; + return 1; } catch (std::ios_base::failure const&) { - wcerr << argv[1] << ": error: read failure" << endl; + cerr << argv[1] << ": error: read failure" << endl; return 1; } catch (parser::invalid_input const&) -- cgit v1.1