22#include <boost/algorithm/string.hpp>
41 using Line_Nos = std::vector<Raw_Strings::size_type>;
42 using Keys = std::vector<std::string>;
56 using Vars = std::vector<Var>;
62 bool fail_fast =
false,
bool add_comment =
false,
bool add_semicolon =
true,
ALG_Opt opt =
ALG_Opt::NONE);
70 const Error&
error(Errors::size_type index)
const;
78 bool write(std::ofstream& f, const std::
string& lang);
80 std::
string inlineCalc(const std::
string& s, const std::
string& lang);
82 void setIndent(
bool use_space = true,
unsigned indent_size = 4);
85 std::ofstream&
_wComment(std::ofstream& f, const std::
string& lang, const std::
string& before = "");
87 std::
string _indent(
size_t indent_size) const noexcept;
118 assert((index <
_lines.size() &&
"Check Alg::line index range."));
125 assert((index <
_errors.size() &&
"Check Alg::error index range."));
132 assert((index <
_warnings.size() &&
"Check Alg::warning index range."));
144 if (
_use_space)
return std::string(indent_size,
' ');
145 else return std::string(indent_size,
'\t');
152 for (
decltype(keys.size()) i = 0; i !=
line.
params().size(); ++i) {
ALG_Opt
ALG export options.
Definition: alg_opt.h:20
@ NONE
Definition: alg_opt.h:20
Process line of Alg into standard formats.
Definition: alg_line.h:36
const std::vector< Param_Type > & params() const noexcept
Parameter variables.
Definition: alg_line.h:283
bool setKey(std::vector< Param_Type >::size_type index, const std::string &key)
Set parameter variable key.
Definition: alg_line.h:348
Errors _errors
Definition: alg.h:94
bool _add_comment
Definition: alg.h:102
bool _add_semicolon
Definition: alg.h:101
int _branch_line
Definition: alg.h:110
std::ofstream & _wComment(std::ofstream &f, const std::string &lang, const std::string &before="")
Definition: alg.cpp:782
int _recover_cnt
Definition: alg.h:108
Warnings _warnings
Definition: alg.h:95
bool hasError() const noexcept
Definition: alg.h:136
std::string inlineCalc(const std::string &s, const std::string &lang)
Definition: alg.cpp:771
std::vector< std::string > Keys
Definition: alg.h:42
int _alg_cnt
Definition: alg.h:106
Macro _macro
Definition: alg.h:105
Vars _vars
Definition: alg.h:98
std::vector< Var > Vars
Definition: alg.h:56
unsigned _indent_size
Definition: alg.h:103
int _job_cnt
Definition: alg.h:107
const Warnings & warnings() const
Definition: alg.h:129
static const int max_length
Definition: alg.h:112
bool _failed
Definition: alg.h:99
std::vector< Alg_Line > Alg_Lines
Definition: alg.h:39
const Error & error(Errors::size_type index) const
Definition: alg.h:124
void _recoverPrint() const
std::stack< std::string > _contents_at_end
Definition: alg.h:104
std::vector< Raw_Strings::size_type > Line_Nos
Definition: alg.h:41
std::string _indent(size_t indent_size) const noexcept
Definition: alg.h:143
std::vector< Error > Errors
Definition: alg.h:37
Line_Nos _line_nos
Definition: alg.h:97
std::vector< Warning > Warnings
Definition: alg.h:38
void setIndent(bool use_space=true, unsigned indent_size=4)
Definition: alg.h:138
Alg_Lines _lines
Definition: alg.h:93
bool write(std::ofstream &f, const std::string &lang)
Definition: alg.cpp:115
const Warning & warning(Errors::size_type index) const
Definition: alg.h:131
const Alg_Lines & lines() const
Definition: alg.h:115
std::vector< std::string > Raw_Strings
Definition: alg.h:40
bool _use_space
Definition: alg.h:100
const Alg_Line & line(Alg_Lines::size_type index) const
Definition: alg.h:117
Raw_Strings _raw_strings
Definition: alg.h:96
bool _applyKey(Alg_Line &line, const Keys &keys) const
Definition: alg.h:148
const Errors & errors() const
Definition: alg.h:122
std::vector< std::string > _recover_cnt_var
Definition: alg.h:109
static const Macro macro_none
Definition: macro.h:168
str
Definition: version_bump.py:14
std::string msg
Definition: alg.h:32
size_t line
Definition: alg.h:34
std::string raw_str
Definition: alg.h:33
int8_t dim
Definition: alg.h:54
std::string name
Definition: alg.h:45
Type Specification in Alg.