58 if (_in->fail() && !_in->eof()) {
63 size_t bytes = line.length();
67 }
else if (bytes > 0) {
69 "Missing newline at end of file" <<
emit();
72 _lineno += bytes != 0;
80 size_t bytes = extend();
102 _text.resize(_keyword_posn);
105 _keyword_len = keyword.length();
110 _text.replace(_keyword_posn,_keyword_len,directive);
111 _keyword_len = directive.length();
115 template<>
void parsed_line::keyword_edit<directive_type::HASH_IF>() {
119 template<>
void parsed_line::keyword_edit<directive_type::HASH_IFDEF>() {
123 template<>
void parsed_line::keyword_edit<directive_type::HASH_IFNDEF>() {
127 template<>
void parsed_line::keyword_edit<directive_type::HASH_ELSE>() {
131 template<>
void parsed_line::keyword_edit<directive_type::HASH_ELIF>() {
135 template<>
void parsed_line::keyword_edit<directive_type::HASH_ENDIF>() {
206 _reportable = verdict;
216 for ( ;i < _indent; ++i) {
221 *_out << output <<
'\n';
223 for ( ; _extensions; --_extensions) {
227 for ( ; _extensions; --_extensions) {
228 *_out <<
"//coan <\n";
235 if (!is_simplified()) {
238 *_out <<
"//coan < ";
243 size_t end = _text.find(
'\n');
244 for ( ;end != string::npos;
245 start = end + 1,end = _text.find(
'\n',start)) {
246 *_out <<
"//coan < ";
247 *_out << _text.substr(start,1 + end - start);
251 *_out <<
"//coan < ";
258 if (!is_simplified()) {
273 for ( ; _extensions; --_extensions) {
279 write_commented_out();
289 if (_drop_run_length) {
290 _drop_run_length = 0;
294 *_out <<
"#line " << _lineno <<
'\n';
static bool plaintext()
Are we to omit parsing for C/C++ comments?
void write_slow()
Output the line slowely, when necessary.
void set_reportable()
Record whether the line is reportable for the operative command.
static discard_policy & get_discard_policy()
Get the policy for discarding lines.
static bool list_only_active()
Do we list items only from operative directives?
static bool line_directives()
Do we output #line directives?
static bool list_symbols_in_includes()
Do we list symbols in #include directives?
#define TOK_IFNDEF
Constant denoting the #ifndef directive.
void keyword_lop(std::string const &keyword)
Convert the directive in the line into a another one that has no argument.
static bool list_only_inactive()
Do we list items only from inoperative directives?
void write()
Output the line.
void keyword_swap(std::string const &directive)
Replace the directive keyword in the line with another one.
Encapsulates a directive of a given type.
static command_code get_command()
Get the operative coan command code.
static bool is_unconditional_line()
Is the current line outside any #if scope or in the scope of a satisfied #if?
static bool dead_line()
Is the current line rejected?
#define TOK_ELSE
Constant denoting the #else directive.
static bool complement()
Are we to output lines instead of dropping them and vice versa?
static unsigned & lines_changed()
Get a reference to the count of changed lines.
The commandline, considered as a #define/#undef
#define TOK_ELIF
Constant denoting the #elif directive.
error_msg< 4 > error_eof_too_soon
Report unexpected end of input.
static std::string in_file_name()
Get the name of the current source file.
std::string citable(chewer< std::string > &chew, size_t len=std::string::npos)
Make a citable version of length-delimited text.
bool get()
Try to read a line of input.
#define TOK_IFDEF
Constant denoting the #ifdef directive.
void write_commented_out()
Output the line commented out.
static unsigned & lines_suppressed()
Get a reference to the count of suppressed lines.
abend_msg< 5 > abend_cant_read_input
Report read error on input.
The tag class is inserted in a diagnostic_base to tell it to emit itself.
#define TOK_ENDIF
Constant denoting the #endif directive.
size_t extend() override
Try to read another line of input, returning the number of bytes read.
static bool list_symbols_in_defs()
Do we list symbols in #define directives?
void write_fast()
Output the line fast, when possible.
warning_msg< 11 > warning_missing_eof_newline
Report a newline is missing at end of input.
void drop()
Drop the line.
static bool list_symbols_in_ifs()
Do we list items only from inoperative directives?
command_code
Sequential symbolic constants for coan commands.
static bool list_symbols_in_lines()
Do we list symbols in #line directives?
void output()
Output the line.
void set_dropping()
Record whether we are dropping the line.
#define TOK_IF
Constant denoting the if directive.
static bool list_symbols_in_undefs()
Do we list symbols in #undef directives?