ext/libsass/src/sass_interface.cpp in sassc-1.8.1 vs ext/libsass/src/sass_interface.cpp in sassc-1.8.2
- old
+ new
@@ -67,49 +67,32 @@
}
}
else {
output_path = c_ctx->output_path;
}
- Context cpp_ctx(
- Context::Data().source_c_str(c_ctx->source_string)
- .output_path(output_path)
- .output_style((Output_Style) c_ctx->options.output_style)
- .is_indented_syntax_src(c_ctx->options.is_indented_syntax_src)
- .source_comments(c_ctx->options.source_comments)
- .source_map_file(safe_str(c_ctx->options.source_map_file))
- .source_map_root(safe_str(c_ctx->options.source_map_root))
- .source_map_embed(c_ctx->options.source_map_embed)
- .source_map_contents(c_ctx->options.source_map_contents)
- .omit_source_map_url(c_ctx->options.omit_source_map_url)
- .include_paths_c_str(c_ctx->options.include_paths)
- .plugin_paths_c_str(c_ctx->options.plugin_paths)
- // .include_paths_array(0)
- // .plugin_paths_array(0)
- .include_paths(std::vector<std::string>())
- .plugin_paths(std::vector<std::string>())
- .precision(c_ctx->options.precision ? c_ctx->options.precision : 5)
- .indent(c_ctx->options.indent ? c_ctx->options.indent : " ")
- .linefeed(c_ctx->options.linefeed ? c_ctx->options.linefeed : LFEED)
+ Data_Context cpp_ctx(
+ (Sass_Data_Context*) 0
);
if (c_ctx->c_functions) {
Sass_Function_List this_func_data = c_ctx->c_functions;
while ((this_func_data) && (*this_func_data)) {
cpp_ctx.c_functions.push_back(*this_func_data);
++this_func_data;
}
}
- c_ctx->output_string = cpp_ctx.compile_string();
- c_ctx->source_map_string = cpp_ctx.generate_source_map();
+ Block* root = cpp_ctx.parse();
+ c_ctx->output_string = cpp_ctx.render(root);
+ c_ctx->source_map_string = cpp_ctx.render_srcmap();
c_ctx->error_message = 0;
c_ctx->error_status = 0;
if (copy_strings(cpp_ctx.get_included_files(true), &c_ctx->included_files, 1) == NULL)
throw(std::bad_alloc());
}
- catch (Error_Invalid& e) {
+ catch (Exception::InvalidSass& e) {
std::stringstream msg_stream;
- msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.message << std::endl;
+ msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.what() << std::endl;
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
c_ctx->error_status = 1;
c_ctx->output_string = 0;
c_ctx->source_map_string = 0;
}
@@ -160,48 +143,31 @@
output_path = (lastindex > -1 ? input_path.substr(0, lastindex) : input_path) + ".css";
}
else {
output_path = c_ctx->output_path;
}
- Context cpp_ctx(
- Context::Data().entry_point(input_path)
- .output_path(output_path)
- .output_style((Output_Style) c_ctx->options.output_style)
- .is_indented_syntax_src(c_ctx->options.is_indented_syntax_src)
- .source_comments(c_ctx->options.source_comments)
- .source_map_file(safe_str(c_ctx->options.source_map_file))
- .source_map_root(safe_str(c_ctx->options.source_map_root))
- .source_map_embed(c_ctx->options.source_map_embed)
- .source_map_contents(c_ctx->options.source_map_contents)
- .omit_source_map_url(c_ctx->options.omit_source_map_url)
- .include_paths_c_str(c_ctx->options.include_paths)
- .plugin_paths_c_str(c_ctx->options.plugin_paths)
- // .include_paths_array(0)
- // .plugin_paths_array(0)
- .include_paths(std::vector<std::string>())
- .plugin_paths(std::vector<std::string>())
- .precision(c_ctx->options.precision ? c_ctx->options.precision : 5)
- .indent(c_ctx->options.indent ? c_ctx->options.indent : " ")
- .linefeed(c_ctx->options.linefeed ? c_ctx->options.linefeed : LFEED)
+ File_Context cpp_ctx(
+ (Sass_File_Context*) 0
);
if (c_ctx->c_functions) {
Sass_Function_List this_func_data = c_ctx->c_functions;
while ((this_func_data) && (*this_func_data)) {
cpp_ctx.c_functions.push_back(*this_func_data);
++this_func_data;
}
}
- c_ctx->output_string = cpp_ctx.compile_file();
- c_ctx->source_map_string = cpp_ctx.generate_source_map();
+ Block* root = cpp_ctx.parse();
+ c_ctx->output_string = cpp_ctx.render(root);
+ c_ctx->source_map_string = cpp_ctx.render_srcmap();
c_ctx->error_message = 0;
c_ctx->error_status = 0;
if (copy_strings(cpp_ctx.get_included_files(false), &c_ctx->included_files) == NULL)
throw(std::bad_alloc());
}
- catch (Error_Invalid& e) {
+ catch (Exception::InvalidSass& e) {
std::stringstream msg_stream;
- msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.message << std::endl;
+ msg_stream << e.pstate.path << ":" << e.pstate.line << ": " << e.what() << std::endl;
c_ctx->error_message = sass_strdup(msg_stream.str().c_str());
c_ctx->error_status = 1;
c_ctx->output_string = 0;
c_ctx->source_map_string = 0;
}