cleanup
This commit is contained in:
parent
9b7eb28b84
commit
613c033b24
@ -27,7 +27,7 @@ void resolver::cleanup()
|
|||||||
|
|
||||||
auto resolver::opcode_id(const std::string& name) -> std::uint8_t
|
auto resolver::opcode_id(const std::string& name) -> std::uint8_t
|
||||||
{
|
{
|
||||||
const auto itr = opcode_map_rev.find(name);
|
const auto& itr = opcode_map_rev.find(name);
|
||||||
|
|
||||||
if (itr != opcode_map_rev.end())
|
if (itr != opcode_map_rev.end())
|
||||||
{
|
{
|
||||||
@ -39,7 +39,7 @@ auto resolver::opcode_id(const std::string& name) -> std::uint8_t
|
|||||||
|
|
||||||
auto resolver::opcode_name(std::uint8_t id) -> std::string
|
auto resolver::opcode_name(std::uint8_t id) -> std::string
|
||||||
{
|
{
|
||||||
const auto itr = opcode_map.find(id);
|
const auto& itr = opcode_map.find(id);
|
||||||
|
|
||||||
if (itr != opcode_map.end())
|
if (itr != opcode_map.end())
|
||||||
{
|
{
|
||||||
|
@ -984,6 +984,7 @@ auto stmt_list::print() const -> std::string
|
|||||||
|
|
||||||
std::string data;
|
std::string data;
|
||||||
bool last_special = false;
|
bool last_special = false;
|
||||||
|
bool last_devblock = false;
|
||||||
auto block_pad = indented(indent_);
|
auto block_pad = indented(indent_);
|
||||||
indent_ += 4;
|
indent_ += 4;
|
||||||
|
|
||||||
@ -994,13 +995,19 @@ auto stmt_list::print() const -> std::string
|
|||||||
|
|
||||||
for (const auto& stmt : list)
|
for (const auto& stmt : list)
|
||||||
{
|
{
|
||||||
if (&stmt != &list.front() && stmt.as_node->is_special_stmt() || last_special)
|
if ((&stmt != &list.front() && stmt.as_node->is_special_stmt() || last_special) && stmt != kind::stmt_dev && !last_devblock)
|
||||||
data += "\n";
|
data += "\n";
|
||||||
|
|
||||||
if (stmt == kind::stmt_dev)
|
if (stmt == kind::stmt_dev)
|
||||||
|
{
|
||||||
data += stmt.print();
|
data += stmt.print();
|
||||||
|
last_devblock = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
data += stmts_pad + stmt.print();
|
data += stmts_pad + stmt.print();
|
||||||
|
last_devblock = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (&stmt != &list.back())
|
if (&stmt != &list.back())
|
||||||
data += "\n";
|
data += "\n";
|
||||||
@ -1033,10 +1040,7 @@ auto stmt_dev::print() const -> std::string
|
|||||||
if (&stmt != &list->list.front() && stmt.as_node->is_special_stmt() || last_special)
|
if (&stmt != &list->list.front() && stmt.as_node->is_special_stmt() || last_special)
|
||||||
data += "\n";
|
data += "\n";
|
||||||
|
|
||||||
if (stmt == kind::stmt_dev)
|
data += stmts_pad + stmt.print();
|
||||||
data += stmt.print();
|
|
||||||
else
|
|
||||||
data += stmts_pad + stmt.print();
|
|
||||||
|
|
||||||
if (&stmt != &list->list.back())
|
if (&stmt != &list->list.back())
|
||||||
data += "\n";
|
data += "\n";
|
||||||
|
@ -249,7 +249,7 @@ auto string::float_string(float value) -> std::string
|
|||||||
std::string p_dec;
|
std::string p_dec;
|
||||||
std::string p_exp;
|
std::string p_exp;
|
||||||
|
|
||||||
if(flags & integer)
|
if (flags & integer)
|
||||||
{
|
{
|
||||||
auto i = (flags & negative) ? 1 : 0;
|
auto i = (flags & negative) ? 1 : 0;
|
||||||
|
|
||||||
@ -268,7 +268,7 @@ auto string::float_string(float value) -> std::string
|
|||||||
|
|
||||||
while (offset--)
|
while (offset--)
|
||||||
{
|
{
|
||||||
if((flags & exp_neg))
|
if ((flags & exp_neg))
|
||||||
p_int.insert(p_int.begin(), '0');
|
p_int.insert(p_int.begin(), '0');
|
||||||
else
|
else
|
||||||
p_int.push_back('0');
|
p_int.push_back('0');
|
||||||
@ -299,7 +299,7 @@ auto string::float_string(float value) -> std::string
|
|||||||
|
|
||||||
while (offset--)
|
while (offset--)
|
||||||
{
|
{
|
||||||
if(flags & exp_neg)
|
if (flags & exp_neg)
|
||||||
p_int.insert(p_int.begin(), '0');
|
p_int.insert(p_int.begin(), '0');
|
||||||
else
|
else
|
||||||
p_dec.push_back('0');
|
p_dec.push_back('0');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user