void parseConfigFile(Options& opts, const string& filename, ErrorReporter& error_reporter)
 {
   ifstream cfgstream(filename.c_str(), ifstream::in);
   if (!cfgstream)
   {
     error_reporter.error(filename) << "Failed to open config file\n";
     return;
   }
   CfgStreamParser csp(filename, opts, error_reporter);
   csp.scanStream(cfgstream);
 }
Esempio n. 2
0
  bool Module::parse(ErrorReporter& reporter)
  {
    ASSERT(ast_.isNull(), "Module is already parsed.");

    gc<String> code = readFile(path_);
    if (code.isNull())
    {
      reporter.error(NULL, "Could not read \"%s\".", path_->cString());
      return false;
    }

    source_ = new SourceFile(path_, code);

    Parser parser(source_, reporter);
    ast_ = parser.parseModule();

    return !ast_.isNull();
  }