@@ -134,66 +134,77 @@ namespace Sass {
134
134
135
135
}
136
136
137
-
138
- void warn (std::string msg, ParserState pstate)
137
+ std::string warn (std::string msg, ParserState pstate)
139
138
{
140
- std::cerr << " Warning: " << msg << std::endl;
139
+ std::ostringstream sstrm;
140
+ sstrm << " Warning: " << msg << std::endl;
141
+ return sstrm.str ();
141
142
}
142
143
143
- void warning (std::string msg, ParserState pstate)
144
+ std::string warning (std::string msg, ParserState pstate)
144
145
{
145
146
std::string cwd (Sass::File::get_cwd ());
146
147
std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
147
148
std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
148
149
std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
149
150
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 ();
152
158
}
153
159
154
- void warn (std::string msg, ParserState pstate, Backtrace* bt)
160
+ std::string warn (std::string msg, ParserState pstate, Backtrace* bt)
155
161
{
156
- warn (msg, pstate);
162
+ return warn (msg, pstate);
157
163
}
158
164
159
- void deprecated_function (std::string msg, ParserState pstate)
165
+ std::string deprecated_function (std::string msg, ParserState pstate)
160
166
{
161
167
std::string cwd (Sass::File::get_cwd ());
162
168
std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
163
169
std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
164
170
std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
165
171
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 ();
169
177
}
170
178
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)
172
180
{
173
181
std::string cwd (Sass::File::get_cwd ());
174
182
std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
175
183
std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
176
184
std::string output_path (Sass::File::path_for_console (rel_path, pstate.path , pstate.path ));
177
185
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 (output_path.length ()) sstrm << " of " << output_path;
189
+ sstrm << " :" << std::endl;
190
+ sstrm << msg << " and will be an error in future versions of Sass." << std::endl;
191
+ if (msg2.length ()) sstrm << msg2 << std::endl;
192
+ sstrm << std::endl;
193
+ return sstrm.str ();
185
194
}
186
195
187
- void deprecated_bind (std::string msg, ParserState pstate)
196
+ std::string deprecated_bind (std::string msg, ParserState pstate)
188
197
{
189
198
std::string cwd (Sass::File::get_cwd ());
190
199
std::string abs_path (Sass::File::rel2abs (pstate.path , cwd, cwd));
191
200
std::string rel_path (Sass::File::abs2rel (pstate.path , cwd, cwd));
192
201
std::string output_path (Sass::File::path_for_console (rel_path, abs_path, pstate.path ));
193
202
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;
203
+ std::ostringstream sstrm;
204
+ sstrm << " WARNING: " << msg << std::endl;
205
+ sstrm << " on line " << pstate.line +1 << " of " << output_path << std::endl;
206
+ sstrm << " This will be an error in future versions of Sass." << std::endl;
207
+ return sstrm.str ();
197
208
}
198
209
199
210
// should be replaced with error with backtraces
0 commit comments