// Skip dummy line we added to make 0-vs-1-based offsets readable
if (curr_lineno != 0)
{
// If it's a Cpp1 line, emit it
if (line.cat != source_line::category::cpp2)
{
++ret.cpp1_lines;
if (flag_cpp2_only &&
!line.text.empty() &&
line.cat != source_line::category::comment &&
line.cat != source_line::category::import
)
{
if (line.cat == source_line::category::preprocessor) {
if (!line.text.ends_with(".h2\"")) {
errors.emplace_back(
source_position(curr_lineno, 1),
"pure-cpp2 switch disables the preprocessor, including #include (except of .h2 files) - use import instead (note: 'import std;' is implicit in -pure-cpp2)"
);
return {};
}
}
else {
errors.emplace_back(
source_position(curr_lineno, 1),
"pure-cpp2 switch disables Cpp1 syntax"
);
return {};
}
}
if (line.cat == source_line::category::preprocessor && line.text.ends_with(".h2\"")) {
// Strip off the 2"
auto h_include = line.text.substr(0, line.text.size()-2);