2
0
mirror of https://github.com/boostorg/wave.git synced 2026-01-30 20:32:16 +00:00

Added partial error recovery support to Wave.

[SVN r31924]
This commit is contained in:
Hartmut Kaiser
2005-12-06 00:17:59 +00:00
parent 5e458d3eee
commit a8db57d4e6
4 changed files with 108 additions and 15 deletions

View File

@@ -543,16 +543,34 @@ boost::wave::util::file_position_type current_position;
// >>>>>>>>>>>>> Here happens the actual preprocessing. <<<<<<<<<<<<<<<<<<<
// loop over all generated tokens outputting the generated text
while (first != last) {
// store the last known good token position
current_position = (*first).get_position();
bool finished = false;
do {
try {
while (first != last) {
// store the last known good token position
current_position = (*first).get_position();
// print out the current token value
output << (*first).get_value();
// print out the current token value
output << (*first).get_value();
// advance to the next token
++first;
}
// advance to the next token
++first;
}
finished = true;
}
catch (boost::wave::cpp_exception const &e) {
// some preprocessing error
if (!boost::wave::is_recoverable(e)) {
cerr
<< e.file_name() << "(" << e.line_no() << "): "
<< e.description() << endl;
}
else {
throw; // re-throw for non-recoverable errors
}
}
} while (!finished);
}
catch (boost::wave::cpp_exception const &e) {
// some preprocessing error