70 unsigned num()
const {
91 void replace(std::string
const & replacement) {
113 template<directive_type DirectiveType>
165 if (
at(off) ==
'\\') {
166 auto advance =
eol(++off);
167 if (advance &&
overshoot(advance + off)) {
177 size_t extend(
size_t skip)
override;
216 void write(
bool keep);
void mark_keyword(size_t off, size_t len)
Record the offset and length of a directive keyword in the line.
bool is_simplified() const
Say whether the line has been simplified.
void write_slow()
Output the line slowely, when necessary.
void set_reportable()
Record whether the line is reportable for the operative command.
unsigned & indent()
Get a reference to the line's indentation amount.
void set_directive_type(directive_type dtype)
Set the directive type of the line.
std::istream * _in
The input stream from which this line is read.
parsed_line(std::istream *in, std::ostream *out)
Construct given pointers to input and output streams.
void keyword_lop(std::string const &keyword)
Convert the directive in the line into a another one that has no argument.
void write()
Output the line.
bool dropping() const
Are we dropping the line?
void keyword_swap(std::string const &directive)
Replace the directive keyword in the line with another one.
std::string _text
The data.
Encapsulates a directive of a given type.
directive_type _dtype
The directive type of this line.
bool overshoot(size_t off=0) const
Say whether an offset is out of tange.
unsigned eol(size_t offset) const
Say whether there is a newline sequence at an offset.
size_t _keyword_posn
Offset to directive keyword, if any.
void replace(std::string const &replacement)
Replace the line with another string.
bool _simplified
Has the line been simplified?
unsigned num() const
Get the greatest source line number spanned by this line.
void write_commented_out()
Output the line commented out.
directive_type
Symbolic constants denoting types of directives.
unsigned _indent
Amount by which the line is indented.
unsigned _extensions
The number of linefeeds embedded in the line.
struct parse_buffer is a polymorphic base for classes representing possibly extensible lines of parse...
bool _dropping
Are we dropping this line.
std::istream * file()
Get a pointer to the input stream from which this parsed_line reads.
size_t extend() override
Try to read another line of input, returning the number of bytes read.
unsigned _drop_run_length
Count of contiguous lines that are dropped together.
size_t _keyword_len
Length of directive keyword, if any.
bool reportable()
Is the line reportable for the operative command.
unsigned extensions() const
Get the number of linefeeds embedded in this line.
bool _reportable
Is this line reportable?
size_t extension_pending(size_t off) const override
Say whether a line extension is pending at an offset in the line.
void set_simplified(bool value=true)
Classifiy the line as simplified or not.
directive_type get_directive_type() const
Get Set the directive type of the line.
void keyword_edit()
Replace the directive in the line.
std::ostream * _out
The output stream to which this line is written.
void write_fast()
Output the line fast, when possible.
void drop()
Drop the line.
unsigned _lineno
The greatest source line number spanned by this line.
void output()
Output the line.
void set_dropping()
Record whether we are dropping the line.
parse_buffer()=default
Default constuctor.
char at(size_t off) const
Get the character indexed by an offset. Not range-checked.