mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2026-03-11 20:27:10 +00:00
most part of statement printers done
This commit is contained in:
parent
c176d1b11d
commit
0bb72e0b10
7 changed files with 208 additions and 25 deletions
|
|
@ -42,9 +42,9 @@ public:
|
|||
print_spaces(indentation);
|
||||
}
|
||||
|
||||
void indent() { ++current_indentation_level_; }
|
||||
void indent() { current_indentation_level_ += tab_width_; }
|
||||
|
||||
void deindent() { --current_indentation_level_; }
|
||||
void deindent() { current_indentation_level_ -= tab_width_; }
|
||||
|
||||
void tab() { print_spaces(tab_width_); }
|
||||
|
||||
|
|
@ -64,7 +64,15 @@ public:
|
|||
return print_words_instead_of_symbols_;
|
||||
}
|
||||
|
||||
size_t get_current_position() { return current_position_; }
|
||||
size_t get_current_position() const { return current_position_; }
|
||||
|
||||
size_t get_current_indentation_level() const {
|
||||
return current_indentation_level_;
|
||||
}
|
||||
|
||||
size_t set_current_indentation_level(size_t indentation_level) {
|
||||
current_indentation_level_ = indentation_level;
|
||||
}
|
||||
|
||||
private:
|
||||
void end_line() {
|
||||
|
|
|
|||
10
include/doc_printers.hpp
Normal file
10
include/doc_printers.hpp
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "basic_printers.hpp"
|
||||
#include "doc_nodes.hpp"
|
||||
|
||||
namespace printers {
|
||||
|
||||
void print_docs(const nodes::SymbolDocs &docs, Printer &printer);
|
||||
|
||||
} // namespace printers
|
||||
|
|
@ -72,7 +72,7 @@ public:
|
|||
std::vector<std::optional<std::string>> &&annotations,
|
||||
std::vector<Identifier> &&arguments,
|
||||
std::vector<Modifier> &&reference_types,
|
||||
std::vector<std::optional<TypeProxy>> &&types,
|
||||
std::vector<TypeProxy> &&types,
|
||||
std::vector<bool> &&optional_arguments,
|
||||
std::vector<bool> &&result_arguments,
|
||||
std::optional<ExpressionProxy> expression)
|
||||
|
|
@ -101,7 +101,7 @@ public:
|
|||
|
||||
//
|
||||
|
||||
ModifierType get_modifier() { return modifier_; }
|
||||
ModifierType get_modifier() const { return modifier_; }
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ public:
|
|||
|
||||
//
|
||||
|
||||
Modifier get_argument_reference_type(size_t id) {
|
||||
Modifier get_argument_reference_type(size_t id) const {
|
||||
return reference_types_.at(id);
|
||||
}
|
||||
|
||||
|
|
@ -143,19 +143,9 @@ public:
|
|||
|
||||
size_t get_argument_types_size() const { return types_.size(); }
|
||||
|
||||
std::optional<Type *> get_argument_type(size_t id) {
|
||||
if (types_.at(id).has_value()) {
|
||||
return types_[id].value().get();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
Type *get_argument_type(size_t id) { return types_.at(id).get(); }
|
||||
|
||||
std::optional<const Type *> get_argument_type(size_t id) const {
|
||||
if (types_.at(id).has_value()) {
|
||||
return types_[id].value().get();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
const Type *get_argument_type(size_t id) const { return types_.at(id).get(); }
|
||||
|
||||
//
|
||||
|
||||
|
|
@ -191,7 +181,7 @@ private:
|
|||
std::vector<std::optional<std::string>> annotations_;
|
||||
std::vector<Identifier> arguments_;
|
||||
std::vector<Modifier> reference_types_;
|
||||
std::vector<std::optional<TypeProxy>> types_;
|
||||
std::vector<TypeProxy> types_;
|
||||
std::vector<bool> optional_arguments_;
|
||||
std::vector<bool> result_arguments_;
|
||||
std::optional<ExpressionProxy> expression_;
|
||||
|
|
@ -215,7 +205,7 @@ public:
|
|||
|
||||
//
|
||||
|
||||
bool is_on_heap() { return is_on_heap_; }
|
||||
bool is_on_heap() const { return is_on_heap_; }
|
||||
|
||||
//
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue