@@ -134,66 +134,78 @@ namespace Sass {
134134
135135 }
136136
137-
138- void warn (std::string msg, ParserState pstate)
137+ std::string warn (std::string msg, ParserState pstate)
139138 {
140- std::cerr << " Warning: " << msg << std::endl;
139+ std::ostringstream sstrm;
140+ sstrm << " Warning: " << msg << std::endl;
141+ return sstrm.str ();
141142 }
142143
143- void warning (std::string msg, ParserState pstate)
144+ std::string warning (std::string msg, ParserState pstate)
144145 {
145146 std::string cwd (Sass::File::get_cwd ());
146147 std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
147148 std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
148149 std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
149150
150- std::cerr << " WARNING on line " << pstate.line +1 << " , column " << pstate.column +1 << " of " << output_path << " :" << std::endl;
151- std::cerr << msg << std::endl << std::endl;
151+ std::ostringstream sstrm;
152+ sstrm << " WARNING on line " << pstate.line + 1 ;
153+ sstrm << " , column " << pstate.column + 1 ;
154+ sstrm << " of " << output_path << std::endl;
155+ sstrm << msg << std::endl;
156+ sstrm << std::endl;
157+ return sstrm.str ();
152158 }
153159
154- void warn (std::string msg, ParserState pstate, Backtrace* bt)
160+ std::string warn (std::string msg, ParserState pstate, Backtrace* bt)
155161 {
156- warn (msg, pstate);
162+ return warn (msg, pstate);
157163 }
158164
159- void deprecated_function (std::string msg, ParserState pstate)
165+ std::string deprecated_function (std::string msg, ParserState pstate)
160166 {
161167 std::string cwd (Sass::File::get_cwd ());
162168 std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
163169 std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
164170 std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
165171
166- std::cerr << " DEPRECATION WARNING: " << msg << std::endl;
167- std::cerr << " will be an error in future versions of Sass." << std::endl;
168- std::cerr << " on line " << pstate.line +1 << " of " << output_path << std::endl;
172+ std::ostringstream sstrm;
173+ sstrm << " DEPRECATION WARNING: " << msg << std::endl;
174+ sstrm << " will be an error in future versions of Sass." << std::endl;
175+ sstrm << " on line " << pstate.line +1 << " of " << output_path << std::endl;
176+ return sstrm.str ();
169177 }
170178
171- void deprecated (std::string msg, std::string msg2, bool with_column, ParserState pstate)
179+ std::string deprecated (std::string msg, std::string msg2, bool with_column, ParserState pstate)
172180 {
173181 std::string cwd (Sass::File::get_cwd ());
174182 std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
175183 std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
176184 std::string output_path (Sass::File::path_for_console (rel_path, pstate.path , pstate.path ));
177185
178- std::cerr << " DEPRECATION WARNING on line " << pstate.line + 1 ;
179- if (with_column) std::cerr << " , column " << pstate.column + pstate.offset .column + 1 ;
180- if (output_path.length ()) std::cerr << " of " << output_path;
181- std::cerr << " :" << std::endl;
182- std::cerr << msg << std::endl;
183- if (msg2.length ()) std::cerr << msg2 << std::endl;
184- std::cerr << std::endl;
186+ std::ostringstream sstrm;
187+ sstrm << " DEPRECATION WARNING on line " << pstate.line + 1 ;
188+ if (with_column) sstrm << " , column " << pstate.column + pstate.offset .column + 1 ;
189+ if (output_path.length ()) sstrm << " of " << output_path;
190+ sstrm << " :" << std::endl;
191+ sstrm << msg << std::endl;
192+ if (msg2.length ()) sstrm << msg2 << std::endl;
193+ sstrm << std::endl;
194+ return sstrm.str ();
185195 }
186196
187- void deprecated_bind (std::string msg, ParserState pstate)
197+ std::string deprecated_bind (std::string msg, ParserState pstate)
188198 {
189199 std::string cwd (Sass::File::get_cwd ());
190200 std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
191201 std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
192202 std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
193203
194- std::cerr << " WARNING: " << msg << std::endl;
195- std::cerr << " on line " << pstate.line +1 << " of " << output_path << std::endl;
196- std::cerr << " This will be an error in future versions of Sass." << std::endl;
204+ std::ostringstream sstrm;
205+ sstrm << " WARNING: " << msg << std::endl;
206+ sstrm << " on line " << pstate.line +1 << " of " << output_path << std::endl;
207+ sstrm << " This will be an error in future versions of Sass." << std::endl;
208+ return sstrm.str ();
197209 }
198210
199211 // should be replaced with error with backtraces
0 commit comments