mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-11 01:18:46 +00:00
printing fixes
This commit is contained in:
parent
0bb72e0b10
commit
469cb3581f
23 changed files with 318 additions and 151 deletions
|
|
@ -11,7 +11,7 @@ public:
|
|||
bool print_words_instead_of_symbols)
|
||||
: output_(output), tab_width_(tab_width), width_limit_(width_limit),
|
||||
print_words_instead_of_symbols_(print_words_instead_of_symbols),
|
||||
current_position_(0), current_indentation_level_(0) {}
|
||||
current_position_(0), indentation_level_(0) {}
|
||||
|
||||
void print_converted(const std::string &value) {
|
||||
for (auto &ch : value) {
|
||||
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
void new_indent_line() {
|
||||
end_line();
|
||||
print_spaces(current_indentation_level_ * tab_width_);
|
||||
print_spaces(indentation_level_);
|
||||
}
|
||||
|
||||
void new_line(size_t indentation) {
|
||||
|
|
@ -42,9 +42,9 @@ public:
|
|||
print_spaces(indentation);
|
||||
}
|
||||
|
||||
void indent() { current_indentation_level_ += tab_width_; }
|
||||
void indent() { indentation_level_ += tab_width_; }
|
||||
|
||||
void deindent() { current_indentation_level_ -= tab_width_; }
|
||||
void deindent() { indentation_level_ -= tab_width_; }
|
||||
|
||||
void tab() { print_spaces(tab_width_); }
|
||||
|
||||
|
|
@ -66,12 +66,10 @@ public:
|
|||
|
||||
size_t get_current_position() const { return current_position_; }
|
||||
|
||||
size_t get_current_indentation_level() const {
|
||||
return current_indentation_level_;
|
||||
}
|
||||
size_t get_indentation_level() const { return indentation_level_; }
|
||||
|
||||
size_t set_current_indentation_level(size_t indentation_level) {
|
||||
current_indentation_level_ = indentation_level;
|
||||
void set_indentation_level(size_t indentation_level) {
|
||||
indentation_level_ = indentation_level;
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
@ -117,7 +115,7 @@ private:
|
|||
bool print_words_instead_of_symbols_ = false;
|
||||
|
||||
size_t current_position_ = 0;
|
||||
size_t current_indentation_level_ = 0;
|
||||
size_t indentation_level_ = 0;
|
||||
};
|
||||
|
||||
void print_literal(const nodes::Literal &literal, Printer &printer);
|
||||
|
|
@ -126,4 +124,6 @@ void print_identifier(const nodes::Identifier &identifier, Printer &printer);
|
|||
|
||||
void print_annotation(const std::string &annotation, Printer &printer);
|
||||
|
||||
void print_empty_lines(const nodes::EmptyLines &empty_lines, Printer &printer);
|
||||
|
||||
} // namespace printers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue