diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-13 18:46:11 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2009-09-13 18:46:11 +0200 |
commit | cb65012eb524eb57b00249f1dee0f245e947cda4 (patch) | |
tree | 9706e59d98f2208ec110d84a5aaef14e45b49542 /cli/cli.cxx | |
parent | a1686fdeabe24823225cfb4cf79646e12cf98b2c (diff) |
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.
Diffstat (limited to 'cli/cli.cxx')
-rw-r--r-- | cli/cli.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
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 <memory> // std::auto_ptr #include <fstream> #include <iostream> #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<semantics::cli_unit> 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&) |