예제 #1
0
파일: package.c 프로젝트: dleonard0/ponyc
// Attempt to parse the specified source code and add it to the given AST
// @return true on success, false on error
static bool parse_source_code(ast_t* package, const char* src,
  pass_opt_t* options)
{
  assert(src != NULL);
  source_t* source = source_open_string(src);
  assert(source != NULL);

  return module_passes(package, options, source);
}
예제 #2
0
파일: package.c 프로젝트: lzpfmh/ponyc
// Attempt to parse the specified source code and add it to the given AST
// @return true on success, false on error
static bool parse_source_code(ast_t* package, const char* src,
  pass_opt_t* options)
{
  assert(src != NULL);
  assert(options != NULL);

  if(options->print_filenames)
    printf("Opening magic source\n");

  source_t* source = source_open_string(src);
  assert(source != NULL);

  return module_passes(package, options, source);
}
예제 #3
0
파일: package.c 프로젝트: dleonard0/ponyc
// Attempt to parse the specified source file and add it to the given AST
// @return true on success, false on error
static bool parse_source_file(ast_t* package, const char* file_path,
  pass_opt_t* options)
{
  assert(package != NULL);
  assert(file_path != NULL);
  source_t* source = source_open(file_path);

  if(source == NULL)
  {
    errorf(file_path, "couldn't open file %s", file_path);
    return false;
  }

  return module_passes(package, options, source);
}
예제 #4
0
파일: package.c 프로젝트: dipinhora/ponyc
// Attempt to parse the specified source file and add it to the given AST
// @return true on success, false on error
static bool parse_source_file(ast_t* package, const char* file_path,
  pass_opt_t* opt)
{
  pony_assert(package != NULL);
  pony_assert(file_path != NULL);
  pony_assert(opt != NULL);

  if(opt->print_filenames)
    printf("Opening %s\n", file_path);

  const char* error_msg = NULL;
  source_t* source = source_open(file_path, &error_msg);

  if(source == NULL)
  {
    if(error_msg == NULL)
      error_msg = "couldn't open file";

    errorf(opt->check.errors, file_path, "%s %s", error_msg, file_path);
    return false;
  }

  return module_passes(package, opt, source);
}