slash paths and compound stmt
This commit is contained in:
parent
b6f089d115
commit
9059f3b04f
@ -162,7 +162,7 @@ namespace xsk::gsc
|
|||||||
%type <stmt_list::ptr> stmt_list
|
%type <stmt_list::ptr> stmt_list
|
||||||
%type <stmt_list::ptr> stmt_or_dev_list
|
%type <stmt_list::ptr> stmt_or_dev_list
|
||||||
%type <stmt_dev::ptr> stmt_dev
|
%type <stmt_dev::ptr> stmt_dev
|
||||||
%type <stmt_list::ptr> stmt_block
|
%type <stmt_comp::ptr> stmt_comp
|
||||||
%type <stmt_expr::ptr> stmt_expr
|
%type <stmt_expr::ptr> stmt_expr
|
||||||
%type <stmt_call::ptr> stmt_call
|
%type <stmt_call::ptr> stmt_call
|
||||||
%type <stmt_assign::ptr> stmt_assign
|
%type <stmt_assign::ptr> stmt_assign
|
||||||
@ -310,12 +310,12 @@ decl_usingtree
|
|||||||
;
|
;
|
||||||
|
|
||||||
decl_function
|
decl_function
|
||||||
: expr_identifier LPAREN expr_parameters RPAREN stmt_block
|
: expr_identifier LPAREN expr_parameters RPAREN stmt_comp
|
||||||
{ lexer.ban_header(@$); $$ = make_decl_function(@$, std::move($1), std::move($3), std::move($5)); }
|
{ lexer.ban_header(@$); $$ = make_decl_function(@$, std::move($1), std::move($3), std::move($5)); }
|
||||||
;
|
;
|
||||||
|
|
||||||
stmt
|
stmt
|
||||||
: stmt_block { $$.as_list = std::move($1); }
|
: stmt_comp { $$.as_comp = std::move($1); }
|
||||||
| stmt_call { $$.as_call = std::move($1); }
|
| stmt_call { $$.as_call = std::move($1); }
|
||||||
| stmt_assign { $$.as_assign = std::move($1); }
|
| stmt_assign { $$.as_assign = std::move($1); }
|
||||||
| stmt_endon { $$.as_endon = std::move($1); }
|
| stmt_endon { $$.as_endon = std::move($1); }
|
||||||
@ -366,9 +366,9 @@ stmt_dev
|
|||||||
| DEVBEGIN DEVEND { $$ = make_stmt_dev(@$, make_stmt_list(@$)); }
|
| DEVBEGIN DEVEND { $$ = make_stmt_dev(@$, make_stmt_list(@$)); }
|
||||||
;
|
;
|
||||||
|
|
||||||
stmt_block
|
stmt_comp
|
||||||
: LBRACE stmt_or_dev_list RBRACE { $$ = std::move($2); }
|
: LBRACE stmt_or_dev_list RBRACE { $$ = make_stmt_comp(@$, std::move($2)); }
|
||||||
| LBRACE RBRACE { $$ = make_stmt_list(@$); }
|
| LBRACE RBRACE { $$ = make_stmt_comp(@$, make_stmt_list(@$)); }
|
||||||
;
|
;
|
||||||
|
|
||||||
stmt_expr
|
stmt_expr
|
||||||
@ -481,7 +481,7 @@ stmt_foreach
|
|||||||
;
|
;
|
||||||
|
|
||||||
stmt_switch
|
stmt_switch
|
||||||
: SWITCH LPAREN expr RPAREN stmt_block
|
: SWITCH LPAREN expr RPAREN stmt_comp
|
||||||
{ $$ = make_stmt_switch(@$, std::move($3), std::move($5));
|
{ $$ = make_stmt_switch(@$, std::move($3), std::move($5));
|
||||||
parse_switch(*$$);
|
parse_switch(*$$);
|
||||||
}
|
}
|
||||||
@ -930,14 +930,14 @@ void parser::error(location const& loc, std::string const& msg)
|
|||||||
|
|
||||||
auto parse_switch(stmt_switch& stm) -> void
|
auto parse_switch(stmt_switch& stm) -> void
|
||||||
{
|
{
|
||||||
auto body = make_stmt_list(stm.body->loc());
|
auto body = make_stmt_list(stm.body->block->loc());
|
||||||
auto current_case = stmt{ nullptr };
|
auto current_case = stmt{ nullptr };
|
||||||
|
|
||||||
auto num = stm.body->list.size();
|
auto num = stm.body->block->list.size();
|
||||||
|
|
||||||
for (auto i = 0u; i < num; i++)
|
for (auto i = 0u; i < num; i++)
|
||||||
{
|
{
|
||||||
auto& entry = stm.body->list[0];
|
auto& entry = stm.body->block->list[0];
|
||||||
|
|
||||||
if (entry == node::stmt_case || entry == node::stmt_default)
|
if (entry == node::stmt_case || entry == node::stmt_default)
|
||||||
{
|
{
|
||||||
@ -946,8 +946,8 @@ auto parse_switch(stmt_switch& stm) -> void
|
|||||||
body->list.push_back(std::move(current_case));
|
body->list.push_back(std::move(current_case));
|
||||||
}
|
}
|
||||||
|
|
||||||
current_case = std::move(stm.body->list[0]);
|
current_case = std::move(stm.body->block->list[0]);
|
||||||
stm.body->list.erase(stm.body->list.begin());
|
stm.body->block->list.erase(stm.body->block->list.begin());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -956,12 +956,12 @@ auto parse_switch(stmt_switch& stm) -> void
|
|||||||
if (current_case == node::stmt_case)
|
if (current_case == node::stmt_case)
|
||||||
{
|
{
|
||||||
current_case.as_case->body->list.push_back(std::move(entry));
|
current_case.as_case->body->list.push_back(std::move(entry));
|
||||||
stm.body->list.erase(stm.body->list.begin());
|
stm.body->block->list.erase(stm.body->block->list.begin());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
current_case.as_default->body->list.push_back(std::move(entry));
|
current_case.as_default->body->list.push_back(std::move(entry));
|
||||||
stm.body->list.erase(stm.body->list.begin());
|
stm.body->block->list.erase(stm.body->block->list.begin());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -976,7 +976,7 @@ auto parse_switch(stmt_switch& stm) -> void
|
|||||||
body->list.push_back(std::move(current_case));
|
body->list.push_back(std::move(current_case));
|
||||||
}
|
}
|
||||||
|
|
||||||
stm.body = std::move(body);
|
stm.body->block = std::move(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace xsk::gsc
|
} // namespace xsk::gsc
|
||||||
|
@ -967,7 +967,9 @@ expr_identifier
|
|||||||
;
|
;
|
||||||
|
|
||||||
expr_path
|
expr_path
|
||||||
: IDENTIFIER
|
: PATH DIV IDENTIFIER
|
||||||
|
{ $$ = std::make_unique<ast::expr_path>(@$, $1 + "/" + $3); };
|
||||||
|
| IDENTIFIER
|
||||||
{ $$ = std::make_unique<ast::expr_path>(@$, $1); };
|
{ $$ = std::make_unique<ast::expr_path>(@$, $1); };
|
||||||
| PATH
|
| PATH
|
||||||
{ $$ = std::make_unique<ast::expr_path>(@$, $1); };
|
{ $$ = std::make_unique<ast::expr_path>(@$, $1); };
|
||||||
|
@ -123,7 +123,7 @@ auto compiler::emit_decl_function(decl_function const& func) -> void
|
|||||||
auto& scp = scopes_.at(func.body.get());
|
auto& scp = scopes_.at(func.body.get());
|
||||||
|
|
||||||
emit_expr_parameters(*func.params, *scp);
|
emit_expr_parameters(*func.params, *scp);
|
||||||
emit_stmt_list(*func.body, *scp, true);
|
emit_stmt_comp(*func.body, *scp, true);
|
||||||
emit_opcode(opcode::OP_End);
|
emit_opcode(opcode::OP_End);
|
||||||
|
|
||||||
function_->size = index_ - function_->index;
|
function_->size = index_ - function_->index;
|
||||||
@ -137,6 +137,9 @@ auto compiler::emit_stmt(stmt const& stm, scope& scp, bool last) -> void
|
|||||||
case node::stmt_list:
|
case node::stmt_list:
|
||||||
emit_stmt_list(*stm.as_list, scp, last);
|
emit_stmt_list(*stm.as_list, scp, last);
|
||||||
break;
|
break;
|
||||||
|
case node::stmt_comp:
|
||||||
|
emit_stmt_comp(*stm.as_comp, scp, last);
|
||||||
|
break;
|
||||||
case node::stmt_dev:
|
case node::stmt_dev:
|
||||||
emit_stmt_dev(*stm.as_dev, scp, last);
|
emit_stmt_dev(*stm.as_dev, scp, last);
|
||||||
break;
|
break;
|
||||||
@ -228,9 +231,14 @@ auto compiler::emit_stmt_list(stmt_list const& stm, scope& scp, bool last) -> vo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto compiler::emit_stmt_comp(stmt_comp const& stm, scope& scp, bool last) -> void
|
||||||
|
{
|
||||||
|
emit_stmt_list(*stm.block, scp, last);
|
||||||
|
}
|
||||||
|
|
||||||
auto compiler::emit_stmt_dev(stmt_dev const& stm, scope& scp, bool last) -> void
|
auto compiler::emit_stmt_dev(stmt_dev const& stm, scope& scp, bool last) -> void
|
||||||
{
|
{
|
||||||
emit_stmt_list(*stm.body, scp, last);
|
emit_stmt_list(*stm.block, scp, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto compiler::emit_stmt_expr(stmt_expr const& stm, scope& scp) -> void
|
auto compiler::emit_stmt_expr(stmt_expr const& stm, scope& scp) -> void
|
||||||
@ -754,16 +762,16 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void
|
|||||||
can_break_ = true;
|
can_break_ = true;
|
||||||
|
|
||||||
auto data = std::vector<std::string>{};
|
auto data = std::vector<std::string>{};
|
||||||
data.push_back(fmt::format("{}", stm.body->list.size()));
|
data.push_back(fmt::format("{}", stm.body->block->list.size()));
|
||||||
|
|
||||||
auto type = switch_type::none;
|
auto type = switch_type::none;
|
||||||
auto loc_default = std::string{};
|
auto loc_default = std::string{};
|
||||||
auto has_default = false;
|
auto has_default = false;
|
||||||
scope* default_ctx = nullptr;
|
scope* default_ctx = nullptr;
|
||||||
|
|
||||||
for (auto i = 0u; i < stm.body->list.size(); i++)
|
for (auto i = 0u; i < stm.body->block->list.size(); i++)
|
||||||
{
|
{
|
||||||
auto const& entry = stm.body->list[i];
|
auto const& entry = stm.body->block->list[i];
|
||||||
|
|
||||||
if (entry == node::stmt_case)
|
if (entry == node::stmt_case)
|
||||||
{
|
{
|
||||||
@ -860,7 +868,7 @@ auto compiler::emit_stmt_switch(stmt_switch const& stm, scope& scp) -> void
|
|||||||
|
|
||||||
emit_opcode(opcode::OP_endswitch, data);
|
emit_opcode(opcode::OP_endswitch, data);
|
||||||
|
|
||||||
auto offset = static_cast<u32>(((ctx_->engine() == engine::iw9) ? 8 : 7) * stm.body->list.size());
|
auto offset = static_cast<u32>(((ctx_->engine() == engine::iw9) ? 8 : 7) * stm.body->block->list.size());
|
||||||
function_->instructions.back()->size += offset;
|
function_->instructions.back()->size += offset;
|
||||||
index_ += offset;
|
index_ += offset;
|
||||||
|
|
||||||
@ -2258,7 +2266,7 @@ auto compiler::process_function(decl_function const& func) -> void
|
|||||||
auto& scp_body = ins.first->second;
|
auto& scp_body = ins.first->second;
|
||||||
|
|
||||||
process_expr_parameters(*func.params, *scp_body);
|
process_expr_parameters(*func.params, *scp_body);
|
||||||
process_stmt_list(*func.body, *scp_body);
|
process_stmt_comp(*func.body, *scp_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto compiler::process_stmt(stmt const& stm, scope& scp) -> void
|
auto compiler::process_stmt(stmt const& stm, scope& scp) -> void
|
||||||
@ -2268,6 +2276,9 @@ auto compiler::process_stmt(stmt const& stm, scope& scp) -> void
|
|||||||
case node::stmt_list:
|
case node::stmt_list:
|
||||||
process_stmt_list(*stm.as_list, scp);
|
process_stmt_list(*stm.as_list, scp);
|
||||||
break;
|
break;
|
||||||
|
case node::stmt_comp:
|
||||||
|
process_stmt_comp(*stm.as_comp, scp);
|
||||||
|
break;
|
||||||
case node::stmt_dev:
|
case node::stmt_dev:
|
||||||
process_stmt_dev(*stm.as_dev, scp);
|
process_stmt_dev(*stm.as_dev, scp);
|
||||||
break;
|
break;
|
||||||
@ -2336,9 +2347,14 @@ auto compiler::process_stmt_list(stmt_list const& stm, scope& scp) -> void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto compiler::process_stmt_comp(stmt_comp const& stm, scope& scp) -> void
|
||||||
|
{
|
||||||
|
process_stmt_list(*stm.block, scp);
|
||||||
|
}
|
||||||
|
|
||||||
auto compiler::process_stmt_dev(stmt_dev const& stm, scope& scp) -> void
|
auto compiler::process_stmt_dev(stmt_dev const& stm, scope& scp) -> void
|
||||||
{
|
{
|
||||||
process_stmt_list(*stm.body, scp);
|
process_stmt_list(*stm.block, scp);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto compiler::process_stmt_expr(stmt_expr const& stm, scope& scp) -> void
|
auto compiler::process_stmt_expr(stmt_expr const& stm, scope& scp) -> void
|
||||||
@ -2607,9 +2623,9 @@ auto compiler::process_stmt_switch(stmt_switch const& stm, scope& scp) -> void
|
|||||||
auto old_breaks = break_blks_;
|
auto old_breaks = break_blks_;
|
||||||
break_blks_.clear();
|
break_blks_.clear();
|
||||||
|
|
||||||
for (auto i = 0u; i < stm.body->list.size(); i++)
|
for (auto i = 0u; i < stm.body->block->list.size(); i++)
|
||||||
{
|
{
|
||||||
auto& entry = stm.body->list[i];
|
auto& entry = stm.body->block->list[i];
|
||||||
|
|
||||||
if (entry == node::stmt_case)
|
if (entry == node::stmt_case)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@ private:
|
|||||||
auto emit_decl_function(decl_function const& func) -> void;
|
auto emit_decl_function(decl_function const& func) -> void;
|
||||||
auto emit_stmt(stmt const& stm, scope& scp, bool last) -> void;
|
auto emit_stmt(stmt const& stm, scope& scp, bool last) -> void;
|
||||||
auto emit_stmt_list(stmt_list const& stm, scope& scp, bool last) -> void;
|
auto emit_stmt_list(stmt_list const& stm, scope& scp, bool last) -> void;
|
||||||
|
auto emit_stmt_comp(stmt_comp const& stm, scope& scp, bool last) -> void;
|
||||||
auto emit_stmt_dev(stmt_dev const& stm, scope& scp, bool last) -> void;
|
auto emit_stmt_dev(stmt_dev const& stm, scope& scp, bool last) -> void;
|
||||||
auto emit_stmt_expr(stmt_expr const& stm, scope& scp) -> void;
|
auto emit_stmt_expr(stmt_expr const& stm, scope& scp) -> void;
|
||||||
auto emit_stmt_call(stmt_call const& stm, scope& scp) -> void;
|
auto emit_stmt_call(stmt_call const& stm, scope& scp) -> void;
|
||||||
@ -119,6 +120,7 @@ private:
|
|||||||
auto process_function(decl_function const& func) -> void;
|
auto process_function(decl_function const& func) -> void;
|
||||||
auto process_stmt(stmt const& stm, scope& scp) -> void;
|
auto process_stmt(stmt const& stm, scope& scp) -> void;
|
||||||
auto process_stmt_list(stmt_list const& stm, scope& scp) -> void;
|
auto process_stmt_list(stmt_list const& stm, scope& scp) -> void;
|
||||||
|
auto process_stmt_comp(stmt_comp const& stm, scope& scp) -> void;
|
||||||
auto process_stmt_dev(stmt_dev const& stm, scope& scp) -> void;
|
auto process_stmt_dev(stmt_dev const& stm, scope& scp) -> void;
|
||||||
auto process_stmt_expr(stmt_expr const& stm, scope& scp) -> void;
|
auto process_stmt_expr(stmt_expr const& stm, scope& scp) -> void;
|
||||||
auto process_stmt_assign(stmt_assign const& stm, scope& scp) -> void;
|
auto process_stmt_assign(stmt_assign const& stm, scope& scp) -> void;
|
||||||
|
@ -39,7 +39,7 @@ auto decompiler::decompile_function(function const& func) -> void
|
|||||||
auto loc = location{ nullptr, static_cast<location::counter_type>(func.index) };
|
auto loc = location{ nullptr, static_cast<location::counter_type>(func.index) };
|
||||||
auto name = make_expr_identifier(loc, func.name);
|
auto name = make_expr_identifier(loc, func.name);
|
||||||
auto prms = make_expr_parameters(loc);
|
auto prms = make_expr_parameters(loc);
|
||||||
auto body = make_stmt_list(loc);
|
auto body = make_stmt_comp(loc, make_stmt_list(loc));
|
||||||
func_ = make_decl_function(loc, std::move(name), std::move(prms), std::move(body));
|
func_ = make_decl_function(loc, std::move(name), std::move(prms), std::move(body));
|
||||||
|
|
||||||
for (auto const& inst : func.instructions)
|
for (auto const& inst : func.instructions)
|
||||||
@ -53,10 +53,10 @@ auto decompiler::decompile_function(function const& func) -> void
|
|||||||
}
|
}
|
||||||
|
|
||||||
locs_.last = true;
|
locs_.last = true;
|
||||||
locs_.end = func_->body->list.back().label();
|
locs_.end = func_->body->block->list.back().label();
|
||||||
func_->body->list.pop_back();
|
func_->body->block->list.pop_back();
|
||||||
|
|
||||||
decompile_statements(*func_->body);
|
decompile_statements(*func_->body->block);
|
||||||
process_function(*func_);
|
process_function(*func_);
|
||||||
|
|
||||||
program_->declarations.push_back(decl{ move(func_) });
|
program_->declarations.push_back(decl{ move(func_) });
|
||||||
@ -72,13 +72,13 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
{
|
{
|
||||||
case opcode::OP_End:
|
case opcode::OP_End:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_stmt_return(loc, expr{ make_node(loc) }) });
|
func_->body->block->list.push_back(stmt{ make_stmt_return(loc, expr{ make_node(loc) }) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_Return:
|
case opcode::OP_Return:
|
||||||
{
|
{
|
||||||
auto value = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto value = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_stmt_return(value.loc(), std::move(value)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_return(value.loc(), std::move(value)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_GetZero:
|
case opcode::OP_GetZero:
|
||||||
@ -216,13 +216,13 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_create(loc, inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_create(loc, inst.data[0]) });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_RemoveLocalVariables:
|
case opcode::OP_RemoveLocalVariables:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_remove(loc, inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_remove(loc, inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_EvalLocalVariableCached0:
|
case opcode::OP_EvalLocalVariableCached0:
|
||||||
@ -310,7 +310,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto lvalue = expr{ make_expr_array(loc, std::move(obj), std::move(key)) };
|
auto lvalue = expr{ make_expr_array(loc, std::move(obj), std::move(key)) };
|
||||||
auto rvalue = expr{ make_expr_undefined(loc) };
|
auto rvalue = expr{ make_expr_undefined(loc) };
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_AddArray:
|
case opcode::OP_AddArray:
|
||||||
@ -932,7 +932,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
case opcode::OP_DecTop:
|
case opcode::OP_DecTop:
|
||||||
{
|
{
|
||||||
auto exp = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto exp = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_stmt_call(exp.loc(), std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_call(exp.loc(), std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_inc:
|
case opcode::OP_inc:
|
||||||
@ -1062,17 +1062,17 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
case opcode::OP_wait:
|
case opcode::OP_wait:
|
||||||
{
|
{
|
||||||
auto exp = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto exp = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_stmt_wait(exp.loc(), std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_wait(exp.loc(), std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_waittillFrameEnd:
|
case opcode::OP_waittillFrameEnd:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_stmt_waittillframeend(loc) });
|
func_->body->block->list.push_back(stmt{ make_stmt_waittillframeend(loc) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_waitframe:
|
case opcode::OP_waitframe:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_stmt_waitframe(loc) });
|
func_->body->block->list.push_back(stmt{ make_stmt_waitframe(loc) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_waittill:
|
case opcode::OP_waittill:
|
||||||
@ -1098,7 +1098,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
args->list.push_back(std::move(arg));
|
args->list.push_back(std::move(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
func_->body->list.push_back(stmt{ make_stmt_waittillmatch(loc, std::move(obj), std::move(event), std::move(args)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_waittillmatch(loc, std::move(obj), std::move(event), std::move(args)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_clearparams:
|
case opcode::OP_clearparams:
|
||||||
@ -1121,7 +1121,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
in_waittill_ = false;
|
in_waittill_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
func_->body->list.push_back(stmt{ std::move(arg) });
|
func_->body->block->list.push_back(stmt{ std::move(arg) });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1140,14 +1140,14 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
loc = var->loc();
|
loc = var->loc();
|
||||||
}
|
}
|
||||||
|
|
||||||
func_->body->list.push_back(stmt{ make_stmt_notify(loc, std::move(obj), std::move(event), std::move(args)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_notify(loc, std::move(obj), std::move(event), std::move(args)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_endon:
|
case opcode::OP_endon:
|
||||||
{
|
{
|
||||||
auto obj = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto obj = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
auto event = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto event = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_stmt_endon(event.loc(), std::move(obj), std::move(event)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_endon(event.loc(), std::move(obj), std::move(event)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_voidCodepos:
|
case opcode::OP_voidCodepos:
|
||||||
@ -1233,7 +1233,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto field = expr{ make_expr_field(loc, std::move(obj), std::move(name)) };
|
auto field = expr{ make_expr_field(loc, std::move(obj), std::move(name)) };
|
||||||
auto undef = expr{ make_expr_undefined(loc) };
|
auto undef = expr{ make_expr_undefined(loc) };
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(field), std::move(undef)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(field), std::move(undef)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SafeCreateVariableFieldCached:
|
case opcode::OP_SafeCreateVariableFieldCached:
|
||||||
@ -1278,7 +1278,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto field = make_expr_identifier(loc, inst.data[0]);
|
auto field = make_expr_identifier(loc, inst.data[0]);
|
||||||
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SetVariableField:
|
case opcode::OP_SetVariableField:
|
||||||
@ -1288,18 +1288,18 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
|
|
||||||
if (lvalue == node::expr_increment)
|
if (lvalue == node::expr_increment)
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(lvalue)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(lvalue)) });
|
||||||
}
|
}
|
||||||
else if (lvalue == node::expr_decrement)
|
else if (lvalue == node::expr_decrement)
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(lvalue)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(lvalue)) });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
loc = rvalue.loc();
|
loc = rvalue.loc();
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1311,7 +1311,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto field = make_expr_identifier(loc, inst.data[0]);
|
auto field = make_expr_identifier(loc, inst.data[0]);
|
||||||
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SetSelfFieldVariableField:
|
case opcode::OP_SetSelfFieldVariableField:
|
||||||
@ -1322,7 +1322,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto field = make_expr_identifier(loc, inst.data[0]);
|
auto field = make_expr_identifier(loc, inst.data[0]);
|
||||||
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
auto lvalue = expr{ make_expr_field(loc, std::move(obj), std::move(field)) };
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SetLocalVariableFieldCached0:
|
case opcode::OP_SetLocalVariableFieldCached0:
|
||||||
@ -1331,7 +1331,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
loc = rvalue.loc();
|
loc = rvalue.loc();
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SetNewLocalVariableFieldCached0:
|
case opcode::OP_SetNewLocalVariableFieldCached0:
|
||||||
@ -1340,17 +1340,17 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
loc = rvalue.loc();
|
loc = rvalue.loc();
|
||||||
|
|
||||||
if (func_->body->list.size() > 0)
|
if (func_->body->block->list.size() > 0)
|
||||||
{
|
{
|
||||||
std::vector<std::string> vars;
|
std::vector<std::string> vars;
|
||||||
|
|
||||||
while (func_->body->list.back() == node::asm_create)
|
while (func_->body->block->list.back() == node::asm_create)
|
||||||
{
|
{
|
||||||
auto& entry = func_->body->list.back();
|
auto& entry = func_->body->block->list.back();
|
||||||
if (loc.begin.line < entry.loc().begin.line)
|
if (loc.begin.line < entry.loc().begin.line)
|
||||||
{
|
{
|
||||||
vars.push_back(entry.as_asm_create->index);
|
vars.push_back(entry.as_asm_create->index);
|
||||||
func_->body->list.pop_back();
|
func_->body->block->list.pop_back();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1361,7 +1361,7 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_SetLocalVariableFieldCached:
|
case opcode::OP_SetLocalVariableFieldCached:
|
||||||
@ -1370,17 +1370,17 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
loc = rvalue.loc();
|
loc = rvalue.loc();
|
||||||
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
auto exp = expr{ make_expr_assign_equal(loc, std::move(lvalue), std::move(rvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
func_->body->block->list.push_back(stmt{ make_stmt_assign(loc, std::move(exp)) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_ClearLocalVariableFieldCached:
|
case opcode::OP_ClearLocalVariableFieldCached:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_clear(loc, inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_clear(loc, inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_ClearLocalVariableFieldCached0:
|
case opcode::OP_ClearLocalVariableFieldCached0:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_clear(loc, "0") });
|
func_->body->block->list.push_back(stmt{ make_asm_clear(loc, "0") });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_EvalLocalVariableObjectCached:
|
case opcode::OP_EvalLocalVariableObjectCached:
|
||||||
@ -1403,23 +1403,23 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
case opcode::OP_switch:
|
case opcode::OP_switch:
|
||||||
{
|
{
|
||||||
auto test = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto test = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_asm_switch(test.loc(), std::move(test), inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_switch(test.loc(), std::move(test), inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_endswitch:
|
case opcode::OP_endswitch:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_endswitch(loc, inst.data) });
|
func_->body->block->list.push_back(stmt{ make_asm_endswitch(loc, inst.data) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_jump:
|
case opcode::OP_jump:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_jmp(loc, inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_jmp(loc, inst.data[0]) });
|
||||||
if (stack_.size() != 0) tern_labels_.push_back(inst.data[0]);
|
if (stack_.size() != 0) tern_labels_.push_back(inst.data[0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_jumpback:
|
case opcode::OP_jumpback:
|
||||||
{
|
{
|
||||||
func_->body->list.push_back(stmt{ make_asm_jmp_back(loc, inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_jmp_back(loc, inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_JumpOnTrue:
|
case opcode::OP_JumpOnTrue:
|
||||||
@ -1427,13 +1427,13 @@ auto decompiler::decompile_instruction(instruction const& inst) -> void
|
|||||||
auto lvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto lvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
loc = lvalue.loc();
|
loc = lvalue.loc();
|
||||||
auto test = expr{ make_expr_not(loc, std::move(lvalue)) };
|
auto test = expr{ make_expr_not(loc, std::move(lvalue)) };
|
||||||
func_->body->list.push_back(stmt{ make_asm_jmp_cond(loc, std::move(test), inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_jmp_cond(loc, std::move(test), inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_JumpOnFalse:
|
case opcode::OP_JumpOnFalse:
|
||||||
{
|
{
|
||||||
auto test = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto test = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
func_->body->list.push_back(stmt{ make_asm_jmp_cond(test.loc(), std::move(test), inst.data[0]) });
|
func_->body->block->list.push_back(stmt{ make_asm_jmp_cond(test.loc(), std::move(test), inst.data[0]) });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opcode::OP_JumpOnTrueExpr:
|
case opcode::OP_JumpOnTrueExpr:
|
||||||
@ -1548,9 +1548,9 @@ auto decompiler::decompile_expressions(instruction const& inst) -> void
|
|||||||
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto rvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
auto lvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
auto lvalue = expr{ std::move(stack_.top()) }; stack_.pop();
|
||||||
|
|
||||||
func_->body->list.pop_back();
|
func_->body->block->list.pop_back();
|
||||||
auto stm = std::move(func_->body->list.back());
|
auto stm = std::move(func_->body->block->list.back());
|
||||||
func_->body->list.pop_back();
|
func_->body->block->list.pop_back();
|
||||||
|
|
||||||
if (stm == node::asm_jmp_cond)
|
if (stm == node::asm_jmp_cond)
|
||||||
{
|
{
|
||||||
@ -1870,7 +1870,7 @@ auto decompiler::decompile_if(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
|
|
||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_if(loc, std::move(test), stmt{ std::move(body) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_if(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_ifelse(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_ifelse(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -1916,7 +1916,7 @@ auto decompiler::decompile_ifelse(stmt_list& stm, usize begin, usize end) -> voi
|
|||||||
|
|
||||||
decompile_statements(*body_else);
|
decompile_statements(*body_else);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_ifelse(loc, std::move(test), stmt{ std::move(body_if) }, stmt{ std::move(body_else) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_ifelse(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body_if)) }, stmt{ make_stmt_comp(loc, std::move(body_else)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_ifelse_end(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_ifelse_end(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -1946,7 +1946,7 @@ auto decompiler::decompile_ifelse_end(stmt_list& stm, usize begin, usize end) ->
|
|||||||
|
|
||||||
if (begin == stm.list.size())
|
if (begin == stm.list.size())
|
||||||
{
|
{
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_if(loc, std::move(test), stmt{ std::move(body_if) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_if(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body_if)) }) });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1967,7 +1967,7 @@ auto decompiler::decompile_ifelse_end(stmt_list& stm, usize begin, usize end) ->
|
|||||||
|
|
||||||
decompile_statements(*body_else);
|
decompile_statements(*body_else);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_ifelse(loc, std::move(test), stmt{ std::move(body_if) }, stmt{ std::move(body_else) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_ifelse(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body_if)) }, stmt{ make_stmt_comp(loc, std::move(body_else)) }) });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1993,7 +1993,7 @@ auto decompiler::decompile_inf(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
|
|
||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_for(loc, stmt{ make_node(loc) }, expr{ make_node(loc) }, stmt{ make_node(loc) }, stmt{ std::move(body) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_for(loc, stmt{ make_node(loc) }, expr{ make_node(loc) }, stmt{ make_node(loc) }, stmt{ make_stmt_comp(loc, std::move(body)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_loop(stmt_list& stm, usize start, usize end) -> void
|
auto decompiler::decompile_loop(stmt_list& stm, usize start, usize end) -> void
|
||||||
@ -2086,7 +2086,7 @@ auto decompiler::decompile_while(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
|
|
||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_while(loc, std::move(test), stmt{ std::move(body) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_while(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_dowhile(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_dowhile(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -2115,7 +2115,7 @@ auto decompiler::decompile_dowhile(stmt_list& stm, usize begin, usize end) -> vo
|
|||||||
|
|
||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_dowhile(loc, std::move(test), stmt{ std::move(body) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_dowhile(loc, std::move(test), stmt{ make_stmt_comp(loc, std::move(body)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_for(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_for(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -2130,7 +2130,6 @@ auto decompiler::decompile_for(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
|
|
||||||
auto loc = stm.list[begin].loc();
|
auto loc = stm.list[begin].loc();
|
||||||
auto init = make_stmt_list(loc);
|
auto init = make_stmt_list(loc);
|
||||||
init->is_expr = true;
|
|
||||||
|
|
||||||
while (stm.list[begin] != node::asm_jmp_cond)
|
while (stm.list[begin] != node::asm_jmp_cond)
|
||||||
{
|
{
|
||||||
@ -2144,7 +2143,6 @@ auto decompiler::decompile_for(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
end -= 2 + init->list.size();
|
end -= 2 + init->list.size();
|
||||||
|
|
||||||
auto iter = make_stmt_list(loc);
|
auto iter = make_stmt_list(loc);
|
||||||
iter->is_expr = true;
|
|
||||||
iter->list.push_back(std::move(stm.list[end]));
|
iter->list.push_back(std::move(stm.list[end]));
|
||||||
stm.list.erase(stm.list.begin() + end);
|
stm.list.erase(stm.list.begin() + end);
|
||||||
stm.list.erase(stm.list.begin() + end);
|
stm.list.erase(stm.list.begin() + end);
|
||||||
@ -2159,7 +2157,7 @@ auto decompiler::decompile_for(stmt_list& stm, usize begin, usize end) -> void
|
|||||||
|
|
||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_for(loc, stmt { std::move(init) }, std::move(test), stmt {std::move(iter) }, stmt{ std::move(body) }) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_for(loc, stmt { std::move(init) }, std::move(test), stmt { std::move(iter) }, stmt{ make_stmt_comp(loc, std::move(body)) }) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -2244,7 +2242,7 @@ auto decompiler::decompile_foreach(stmt_list& stm, usize begin, usize end) -> vo
|
|||||||
decompile_statements(*body);
|
decompile_statements(*body);
|
||||||
locs_ = save;
|
locs_ = save;
|
||||||
body->list.insert(body->list.begin(), stmt{ std::move(init) });
|
body->list.insert(body->list.begin(), stmt{ std::move(init) });
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_foreach(loc, std::move(container), std::move(value), std::move(index), std::move(array), std::move(key), stmt{ std::move(body) }, (ctx_->props() & props::foreach) ? use_index : use_key) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_foreach(loc, std::move(container), std::move(value), std::move(index), std::move(array), std::move(key), stmt{ make_stmt_comp(loc, std::move(body)) }, (ctx_->props() & props::foreach) ? use_index : use_key) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::decompile_switch(stmt_list& stm, usize begin, usize end) -> void
|
auto decompiler::decompile_switch(stmt_list& stm, usize begin, usize end) -> void
|
||||||
@ -2361,7 +2359,7 @@ auto decompiler::decompile_switch(stmt_list& stm, usize begin, usize end) -> voi
|
|||||||
body->list.push_back(std::move(temp));
|
body->list.push_back(std::move(temp));
|
||||||
}
|
}
|
||||||
|
|
||||||
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_switch(loc, std::move(test), std::move(body)) });
|
stm.list.insert(stm.list.begin() + begin, stmt{ make_stmt_switch(loc, std::move(test), make_stmt_comp(loc, std::move(body))) });
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::find_location_reference(stmt_list const& stm, usize begin, usize end, std::string const& loc) -> bool
|
auto decompiler::find_location_reference(stmt_list const& stm, usize begin, usize end, std::string const& loc) -> bool
|
||||||
@ -2416,7 +2414,7 @@ auto decompiler::process_function(decl_function& func) -> void
|
|||||||
scp_body->create_count++;
|
scp_body->create_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
process_stmt_list(*func.body, *scp_body);
|
process_stmt_comp(*func.body, *scp_body);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decompiler::process_stmt(stmt& stm, scope& scp) -> void
|
auto decompiler::process_stmt(stmt& stm, scope& scp) -> void
|
||||||
@ -2426,6 +2424,12 @@ auto decompiler::process_stmt(stmt& stm, scope& scp) -> void
|
|||||||
case node::stmt_list:
|
case node::stmt_list:
|
||||||
process_stmt_list(*stm.as_list, scp);
|
process_stmt_list(*stm.as_list, scp);
|
||||||
break;
|
break;
|
||||||
|
case node::stmt_comp:
|
||||||
|
process_stmt_comp(*stm.as_comp, scp);
|
||||||
|
break;
|
||||||
|
case node::stmt_dev:
|
||||||
|
process_stmt_dev(*stm.as_dev, scp);
|
||||||
|
break;
|
||||||
case node::stmt_expr:
|
case node::stmt_expr:
|
||||||
process_stmt_expr(*stm.as_expr, scp);
|
process_stmt_expr(*stm.as_expr, scp);
|
||||||
break;
|
break;
|
||||||
@ -2507,6 +2511,16 @@ auto decompiler::process_stmt_list(stmt_list& stm, scope& scp) -> void
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto decompiler::process_stmt_comp(stmt_comp& stm, scope& scp) -> void
|
||||||
|
{
|
||||||
|
process_stmt_list(*stm.block, scp);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto decompiler::process_stmt_dev(stmt_dev& stm, scope& scp) -> void
|
||||||
|
{
|
||||||
|
process_stmt_list(*stm.block, scp);
|
||||||
|
}
|
||||||
|
|
||||||
auto decompiler::process_stmt_expr(stmt_expr& stm, scope& scp) -> void
|
auto decompiler::process_stmt_expr(stmt_expr& stm, scope& scp) -> void
|
||||||
{
|
{
|
||||||
switch (stm.value.kind())
|
switch (stm.value.kind())
|
||||||
@ -2624,9 +2638,9 @@ auto decompiler::process_stmt_if(stmt_if& stm, scope& scp) -> void
|
|||||||
|
|
||||||
process_stmt(stm.body, *scp_then);
|
process_stmt(stm.body, *scp_then);
|
||||||
|
|
||||||
if (stm.body.as_list->list.size() == 1 && !stm.body.as_list->list[0].as_node->is_special_stmt())
|
if (stm.body.as_comp->block->list.size() == 1 && !stm.body.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.body = std::move(stm.body.as_list->list.back());
|
stm.body = std::move(stm.body.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2668,14 +2682,14 @@ auto decompiler::process_stmt_ifelse(stmt_ifelse& stm, scope& scp) -> void
|
|||||||
|
|
||||||
scp.append(childs);
|
scp.append(childs);
|
||||||
|
|
||||||
if (stm.stmt_if.as_list->list.size() == 1 && !stm.stmt_if.as_list->list[0].as_node->is_special_stmt())
|
if (stm.stmt_if.as_comp->block->list.size() == 1 && !stm.stmt_if.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.stmt_if = std::move(stm.stmt_if.as_list->list.back());
|
stm.stmt_if = std::move(stm.stmt_if.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm.stmt_else.as_list->list.size() == 1 && !stm.stmt_else.as_list->list[0].as_node->is_special_stmt_noif())
|
if (stm.stmt_else.as_comp->block->list.size() == 1 && !stm.stmt_else.as_comp->block->list[0].as_node->is_special_stmt_noif())
|
||||||
{
|
{
|
||||||
stm.stmt_else = std::move(stm.stmt_else.as_list->list.back());
|
stm.stmt_else = std::move(stm.stmt_else.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2692,9 +2706,9 @@ auto decompiler::process_stmt_while(stmt_while& stm, scope& scp) -> void
|
|||||||
if (stm.test == node::null)
|
if (stm.test == node::null)
|
||||||
scp.append_dec(scp_body);
|
scp.append_dec(scp_body);
|
||||||
|
|
||||||
if (stm.body.as_list->list.size() == 1 && !stm.body.as_list->list[0].as_node->is_special_stmt())
|
if (stm.body.as_comp->block->list.size() == 1 && !stm.body.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.body = std::move(stm.body.as_list->list.back());
|
stm.body = std::move(stm.body.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2711,9 +2725,9 @@ auto decompiler::process_stmt_dowhile(stmt_dowhile& stm, scope& scp) -> void
|
|||||||
if (stm.test == node::null)
|
if (stm.test == node::null)
|
||||||
scp.append_dec(scp_body);
|
scp.append_dec(scp_body);
|
||||||
|
|
||||||
if (stm.body.as_list->list.size() == 1 && !stm.body.as_list->list[0].as_node->is_special_stmt())
|
if (stm.body.as_comp->block->list.size() == 1 && !stm.body.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.body = std::move(stm.body.as_list->list.back());
|
stm.body = std::move(stm.body.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2723,6 +2737,11 @@ auto decompiler::process_stmt_for(stmt_for& stm, scope& scp) -> void
|
|||||||
|
|
||||||
process_stmt(stm.init, scp);
|
process_stmt(stm.init, scp);
|
||||||
|
|
||||||
|
if (stm.init == node::stmt_list && stm.init.as_list->list[0] == node::stmt_assign)
|
||||||
|
{
|
||||||
|
stm.init = stmt{ make_stmt_expr(stm.init.loc(), std::move(stm.init.as_list->list[0].as_assign->value)) };
|
||||||
|
}
|
||||||
|
|
||||||
scp.transfer_dec(scp_body);
|
scp.transfer_dec(scp_body);
|
||||||
|
|
||||||
process_expr(stm.test, scp);
|
process_expr(stm.test, scp);
|
||||||
@ -2731,12 +2750,17 @@ auto decompiler::process_stmt_for(stmt_for& stm, scope& scp) -> void
|
|||||||
|
|
||||||
process_stmt(stm.iter, scp);
|
process_stmt(stm.iter, scp);
|
||||||
|
|
||||||
|
if (stm.iter == node::stmt_list && stm.iter.as_list->list[0] == node::stmt_assign)
|
||||||
|
{
|
||||||
|
stm.iter = stmt{ make_stmt_expr(stm.iter.loc(), std::move(stm.iter.as_list->list[0].as_assign->value)) };
|
||||||
|
}
|
||||||
|
|
||||||
if (stm.test == node::null)
|
if (stm.test == node::null)
|
||||||
scp.append_dec(scp_body);
|
scp.append_dec(scp_body);
|
||||||
|
|
||||||
if (stm.body.as_list->list.size() == 1 && !stm.body.as_list->list[0].as_node->is_special_stmt())
|
if (stm.body.as_comp->block->list.size() == 1 && !stm.body.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.body = std::move(stm.body.as_list->list.back());
|
stm.body = std::move(stm.body.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2753,18 +2777,18 @@ auto decompiler::process_stmt_foreach(stmt_foreach& stm, scope& scp) -> void
|
|||||||
process_expr(stm.index, scp);
|
process_expr(stm.index, scp);
|
||||||
}
|
}
|
||||||
|
|
||||||
process_stmt(stm.body.as_list->list[0], scp);
|
process_stmt(stm.body.as_comp->block->list[0], scp);
|
||||||
|
|
||||||
stm.body.as_list->list.erase(stm.body.as_list->list.begin());
|
stm.body.as_comp->block->list.erase(stm.body.as_comp->block->list.begin());
|
||||||
|
|
||||||
scp.transfer_dec(scp_body);
|
scp.transfer_dec(scp_body);
|
||||||
|
|
||||||
process_expr(stm.value, *scp_body);
|
process_expr(stm.value, *scp_body);
|
||||||
process_stmt(stm.body, *scp_body);
|
process_stmt(stm.body, *scp_body);
|
||||||
|
|
||||||
if (stm.body.as_list->list.size() == 1 && !stm.body.as_list->list[0].as_node->is_special_stmt())
|
if (stm.body.as_comp->block->list.size() == 1 && !stm.body.as_comp->block->list[0].as_node->is_special_stmt())
|
||||||
{
|
{
|
||||||
stm.body = std::move(stm.body.as_list->list.back());
|
stm.body = std::move(stm.body.as_comp->block->list.back());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2776,11 +2800,10 @@ auto decompiler::process_stmt_switch(stmt_switch& stm, scope& scp) -> void
|
|||||||
|
|
||||||
process_expr(stm.test, scp);
|
process_expr(stm.test, scp);
|
||||||
|
|
||||||
for (auto& entry : stm.body->list)
|
for (auto& entry : stm.body->block->list)
|
||||||
{
|
{
|
||||||
if (entry == node::stmt_case)
|
if (entry == node::stmt_case)
|
||||||
{
|
{
|
||||||
entry.as_case->body->is_case = true;
|
|
||||||
auto scp_case = make_scope();
|
auto scp_case = make_scope();
|
||||||
|
|
||||||
scp.transfer_dec(scp_case);
|
scp.transfer_dec(scp_case);
|
||||||
@ -2796,7 +2819,6 @@ auto decompiler::process_stmt_switch(stmt_switch& stm, scope& scp) -> void
|
|||||||
else if (entry == node::stmt_default)
|
else if (entry == node::stmt_default)
|
||||||
{
|
{
|
||||||
has_default = true;
|
has_default = true;
|
||||||
entry.as_default->body->is_case = true;
|
|
||||||
auto scp_case = make_scope();
|
auto scp_case = make_scope();
|
||||||
|
|
||||||
scp.transfer_dec(scp_case);
|
scp.transfer_dec(scp_case);
|
||||||
|
@ -52,6 +52,8 @@ private:
|
|||||||
auto process_function(decl_function& func) -> void;
|
auto process_function(decl_function& func) -> void;
|
||||||
auto process_stmt(stmt& stm, scope& scp) -> void;
|
auto process_stmt(stmt& stm, scope& scp) -> void;
|
||||||
auto process_stmt_list(stmt_list& stm, scope& scp) -> void;
|
auto process_stmt_list(stmt_list& stm, scope& scp) -> void;
|
||||||
|
auto process_stmt_comp(stmt_comp& stm, scope& scp) -> void;
|
||||||
|
auto process_stmt_dev(stmt_dev& stm, scope& scp) -> void;
|
||||||
auto process_stmt_expr(stmt_expr& stm, scope& scp) -> void;
|
auto process_stmt_expr(stmt_expr& stm, scope& scp) -> void;
|
||||||
auto process_stmt_call(stmt_call& stm, scope& scp) -> void;
|
auto process_stmt_call(stmt_call& stm, scope& scp) -> void;
|
||||||
auto process_stmt_assign(stmt_assign& stm, scope& scp) -> void;
|
auto process_stmt_assign(stmt_assign& stm, scope& scp) -> void;
|
||||||
|
@ -414,7 +414,11 @@ stmt_list::stmt_list(location const& loc) : node{ type::stmt_list, loc }
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt_dev::stmt_dev(location const& loc, stmt_list::ptr body) : node{ type::stmt_dev, loc }, body{ std::move(body) }
|
stmt_comp::stmt_comp(location const& loc, stmt_list::ptr block) : node{ type::stmt_comp, loc }, block{ std::move(block) }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt_dev::stmt_dev(location const& loc, stmt_list::ptr block) : node{ type::stmt_dev, loc }, block{ std::move(block) }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,7 +486,7 @@ stmt_foreach::stmt_foreach(location const& loc, expr container, expr value, expr
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt_switch::stmt_switch(location const& loc, expr test, stmt_list::ptr body) : node{ type::stmt_switch, loc }, test{ std::move(test) }, body{ std::move(body) }
|
stmt_switch::stmt_switch(location const& loc, expr test, stmt_comp::ptr body) : node{ type::stmt_switch, loc }, test{ std::move(test) }, body{ std::move(body) }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -526,7 +530,7 @@ stmt_prof_end::stmt_prof_end(location const& loc, expr_arguments::ptr args) : no
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
decl_function::decl_function(location const& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr body) : node{ type::decl_function, loc }, name{ std::move(name) }, params{ std::move(params) }, body{ std::move(body) }
|
decl_function::decl_function(location const& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_comp::ptr body) : node{ type::decl_function, loc }, name{ std::move(name) }, params{ std::move(params) }, body{ std::move(body) }
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -954,6 +958,7 @@ stmt::~stmt()
|
|||||||
{
|
{
|
||||||
case node::null: as_node.~unique_ptr(); return;
|
case node::null: as_node.~unique_ptr(); return;
|
||||||
case node::stmt_list: as_list.~unique_ptr(); return;
|
case node::stmt_list: as_list.~unique_ptr(); return;
|
||||||
|
case node::stmt_comp: as_comp.~unique_ptr(); return;
|
||||||
case node::stmt_dev: as_dev.~unique_ptr(); return;
|
case node::stmt_dev: as_dev.~unique_ptr(); return;
|
||||||
case node::stmt_expr: as_expr.~unique_ptr(); return;
|
case node::stmt_expr: as_expr.~unique_ptr(); return;
|
||||||
case node::stmt_call: as_call.~unique_ptr(); return;
|
case node::stmt_call: as_call.~unique_ptr(); return;
|
||||||
|
@ -84,6 +84,7 @@ struct node
|
|||||||
expr_assign_bitwise_and,
|
expr_assign_bitwise_and,
|
||||||
expr_assign_bitwise_exor,
|
expr_assign_bitwise_exor,
|
||||||
stmt_list,
|
stmt_list,
|
||||||
|
stmt_comp,
|
||||||
stmt_dev,
|
stmt_dev,
|
||||||
stmt_expr,
|
stmt_expr,
|
||||||
stmt_call,
|
stmt_call,
|
||||||
@ -228,6 +229,7 @@ struct expr_assign_bitwise_or;
|
|||||||
struct expr_assign_bitwise_and;
|
struct expr_assign_bitwise_and;
|
||||||
struct expr_assign_bitwise_exor;
|
struct expr_assign_bitwise_exor;
|
||||||
struct stmt_list;
|
struct stmt_list;
|
||||||
|
struct stmt_comp;
|
||||||
struct stmt_dev;
|
struct stmt_dev;
|
||||||
struct stmt_expr;
|
struct stmt_expr;
|
||||||
struct stmt_call;
|
struct stmt_call;
|
||||||
@ -390,6 +392,7 @@ union stmt
|
|||||||
{
|
{
|
||||||
std::unique_ptr<node> as_node;
|
std::unique_ptr<node> as_node;
|
||||||
std::unique_ptr<stmt_list> as_list;
|
std::unique_ptr<stmt_list> as_list;
|
||||||
|
std::unique_ptr<stmt_comp> as_comp;
|
||||||
std::unique_ptr<stmt_dev> as_dev;
|
std::unique_ptr<stmt_dev> as_dev;
|
||||||
std::unique_ptr<stmt_expr> as_expr;
|
std::unique_ptr<stmt_expr> as_expr;
|
||||||
std::unique_ptr<stmt_call> as_call;
|
std::unique_ptr<stmt_call> as_call;
|
||||||
@ -1058,19 +1061,26 @@ struct stmt_list : public node
|
|||||||
using ptr = std::unique_ptr<stmt_list>;
|
using ptr = std::unique_ptr<stmt_list>;
|
||||||
|
|
||||||
std::vector<stmt> list;
|
std::vector<stmt> list;
|
||||||
bool is_case = false;
|
|
||||||
bool is_expr = false;
|
|
||||||
|
|
||||||
stmt_list(location const& loc);
|
stmt_list(location const& loc);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct stmt_comp : public node
|
||||||
|
{
|
||||||
|
using ptr = std::unique_ptr<stmt_comp>;
|
||||||
|
|
||||||
|
stmt_list::ptr block;
|
||||||
|
|
||||||
|
stmt_comp(location const& loc, stmt_list::ptr block);
|
||||||
|
};
|
||||||
|
|
||||||
struct stmt_dev : public node
|
struct stmt_dev : public node
|
||||||
{
|
{
|
||||||
using ptr = std::unique_ptr<stmt_dev>;
|
using ptr = std::unique_ptr<stmt_dev>;
|
||||||
|
|
||||||
stmt_list::ptr body;
|
stmt_list::ptr block;
|
||||||
|
|
||||||
stmt_dev(location const& loc, stmt_list::ptr body);
|
stmt_dev(location const& loc, stmt_list::ptr block);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stmt_expr : public node
|
struct stmt_expr : public node
|
||||||
@ -1239,9 +1249,9 @@ struct stmt_switch : public node
|
|||||||
using ptr = std::unique_ptr<stmt_switch>;
|
using ptr = std::unique_ptr<stmt_switch>;
|
||||||
|
|
||||||
expr test;
|
expr test;
|
||||||
stmt_list::ptr body;
|
stmt_comp::ptr body;
|
||||||
|
|
||||||
stmt_switch(location const& loc, expr test, stmt_list::ptr body);
|
stmt_switch(location const& loc, expr test, stmt_comp::ptr body);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stmt_case : public node
|
struct stmt_case : public node
|
||||||
@ -1319,9 +1329,9 @@ struct decl_function : public node
|
|||||||
|
|
||||||
expr_identifier::ptr name;
|
expr_identifier::ptr name;
|
||||||
expr_parameters::ptr params;
|
expr_parameters::ptr params;
|
||||||
stmt_list::ptr body;
|
stmt_comp::ptr body;
|
||||||
|
|
||||||
decl_function(location const& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_list::ptr body);
|
decl_function(location const& loc, expr_identifier::ptr name, expr_parameters::ptr params, stmt_comp::ptr body);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct decl_usingtree : public node
|
struct decl_usingtree : public node
|
||||||
@ -1562,6 +1572,7 @@ XSK_GSC_MAKE_GENERIC(expr_assign_bitwise_or)
|
|||||||
XSK_GSC_MAKE_GENERIC(expr_assign_bitwise_and)
|
XSK_GSC_MAKE_GENERIC(expr_assign_bitwise_and)
|
||||||
XSK_GSC_MAKE_GENERIC(expr_assign_bitwise_exor)
|
XSK_GSC_MAKE_GENERIC(expr_assign_bitwise_exor)
|
||||||
XSK_GSC_MAKE_GENERIC(stmt_list)
|
XSK_GSC_MAKE_GENERIC(stmt_list)
|
||||||
|
XSK_GSC_MAKE_GENERIC(stmt_comp)
|
||||||
XSK_GSC_MAKE_GENERIC(stmt_dev)
|
XSK_GSC_MAKE_GENERIC(stmt_dev)
|
||||||
XSK_GSC_MAKE_GENERIC(stmt_expr)
|
XSK_GSC_MAKE_GENERIC(stmt_expr)
|
||||||
XSK_GSC_MAKE_GENERIC(stmt_call)
|
XSK_GSC_MAKE_GENERIC(stmt_call)
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -585,73 +585,75 @@ namespace xsk { namespace gsc {
|
|||||||
// stmt_case
|
// stmt_case
|
||||||
char dummy48[sizeof (stmt_case::ptr)];
|
char dummy48[sizeof (stmt_case::ptr)];
|
||||||
|
|
||||||
|
// stmt_comp
|
||||||
|
char dummy49[sizeof (stmt_comp::ptr)];
|
||||||
|
|
||||||
// stmt_continue
|
// stmt_continue
|
||||||
char dummy49[sizeof (stmt_continue::ptr)];
|
char dummy50[sizeof (stmt_continue::ptr)];
|
||||||
|
|
||||||
// stmt_default
|
// stmt_default
|
||||||
char dummy50[sizeof (stmt_default::ptr)];
|
char dummy51[sizeof (stmt_default::ptr)];
|
||||||
|
|
||||||
// stmt_dev
|
// stmt_dev
|
||||||
char dummy51[sizeof (stmt_dev::ptr)];
|
char dummy52[sizeof (stmt_dev::ptr)];
|
||||||
|
|
||||||
// stmt_dowhile
|
// stmt_dowhile
|
||||||
char dummy52[sizeof (stmt_dowhile::ptr)];
|
char dummy53[sizeof (stmt_dowhile::ptr)];
|
||||||
|
|
||||||
// stmt_endon
|
// stmt_endon
|
||||||
char dummy53[sizeof (stmt_endon::ptr)];
|
char dummy54[sizeof (stmt_endon::ptr)];
|
||||||
|
|
||||||
// stmt_expr
|
// stmt_expr
|
||||||
char dummy54[sizeof (stmt_expr::ptr)];
|
char dummy55[sizeof (stmt_expr::ptr)];
|
||||||
|
|
||||||
// stmt_for
|
// stmt_for
|
||||||
char dummy55[sizeof (stmt_for::ptr)];
|
char dummy56[sizeof (stmt_for::ptr)];
|
||||||
|
|
||||||
// stmt_foreach
|
// stmt_foreach
|
||||||
char dummy56[sizeof (stmt_foreach::ptr)];
|
char dummy57[sizeof (stmt_foreach::ptr)];
|
||||||
|
|
||||||
// stmt_if
|
// stmt_if
|
||||||
char dummy57[sizeof (stmt_if::ptr)];
|
char dummy58[sizeof (stmt_if::ptr)];
|
||||||
|
|
||||||
// stmt_ifelse
|
// stmt_ifelse
|
||||||
char dummy58[sizeof (stmt_ifelse::ptr)];
|
char dummy59[sizeof (stmt_ifelse::ptr)];
|
||||||
|
|
||||||
// stmt_list
|
// stmt_list
|
||||||
// stmt_or_dev_list
|
// stmt_or_dev_list
|
||||||
// stmt_block
|
char dummy60[sizeof (stmt_list::ptr)];
|
||||||
char dummy59[sizeof (stmt_list::ptr)];
|
|
||||||
|
|
||||||
// stmt_notify
|
// stmt_notify
|
||||||
char dummy60[sizeof (stmt_notify::ptr)];
|
char dummy61[sizeof (stmt_notify::ptr)];
|
||||||
|
|
||||||
// stmt_prof_begin
|
// stmt_prof_begin
|
||||||
char dummy61[sizeof (stmt_prof_begin::ptr)];
|
char dummy62[sizeof (stmt_prof_begin::ptr)];
|
||||||
|
|
||||||
// stmt_prof_end
|
// stmt_prof_end
|
||||||
char dummy62[sizeof (stmt_prof_end::ptr)];
|
char dummy63[sizeof (stmt_prof_end::ptr)];
|
||||||
|
|
||||||
// stmt_return
|
// stmt_return
|
||||||
char dummy63[sizeof (stmt_return::ptr)];
|
char dummy64[sizeof (stmt_return::ptr)];
|
||||||
|
|
||||||
// stmt_switch
|
// stmt_switch
|
||||||
char dummy64[sizeof (stmt_switch::ptr)];
|
char dummy65[sizeof (stmt_switch::ptr)];
|
||||||
|
|
||||||
// stmt_wait
|
// stmt_wait
|
||||||
char dummy65[sizeof (stmt_wait::ptr)];
|
char dummy66[sizeof (stmt_wait::ptr)];
|
||||||
|
|
||||||
// stmt_waitframe
|
// stmt_waitframe
|
||||||
char dummy66[sizeof (stmt_waitframe::ptr)];
|
char dummy67[sizeof (stmt_waitframe::ptr)];
|
||||||
|
|
||||||
// stmt_waittill
|
// stmt_waittill
|
||||||
char dummy67[sizeof (stmt_waittill::ptr)];
|
char dummy68[sizeof (stmt_waittill::ptr)];
|
||||||
|
|
||||||
// stmt_waittillframeend
|
// stmt_waittillframeend
|
||||||
char dummy68[sizeof (stmt_waittillframeend::ptr)];
|
char dummy69[sizeof (stmt_waittillframeend::ptr)];
|
||||||
|
|
||||||
// stmt_waittillmatch
|
// stmt_waittillmatch
|
||||||
char dummy69[sizeof (stmt_waittillmatch::ptr)];
|
char dummy70[sizeof (stmt_waittillmatch::ptr)];
|
||||||
|
|
||||||
// stmt_while
|
// stmt_while
|
||||||
char dummy70[sizeof (stmt_while::ptr)];
|
char dummy71[sizeof (stmt_while::ptr)];
|
||||||
};
|
};
|
||||||
|
|
||||||
/// The size of the largest semantic type.
|
/// The size of the largest semantic type.
|
||||||
@ -962,7 +964,7 @@ namespace xsk { namespace gsc {
|
|||||||
S_stmt_list = 125, // stmt_list
|
S_stmt_list = 125, // stmt_list
|
||||||
S_stmt_or_dev_list = 126, // stmt_or_dev_list
|
S_stmt_or_dev_list = 126, // stmt_or_dev_list
|
||||||
S_stmt_dev = 127, // stmt_dev
|
S_stmt_dev = 127, // stmt_dev
|
||||||
S_stmt_block = 128, // stmt_block
|
S_stmt_comp = 128, // stmt_comp
|
||||||
S_stmt_expr = 129, // stmt_expr
|
S_stmt_expr = 129, // stmt_expr
|
||||||
S_stmt_call = 130, // stmt_call
|
S_stmt_call = 130, // stmt_call
|
||||||
S_stmt_assign = 131, // stmt_assign
|
S_stmt_assign = 131, // stmt_assign
|
||||||
@ -1284,6 +1286,10 @@ namespace xsk { namespace gsc {
|
|||||||
value.move< stmt_case::ptr > (std::move (that.value));
|
value.move< stmt_case::ptr > (std::move (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case symbol_kind::S_stmt_comp: // stmt_comp
|
||||||
|
value.move< stmt_comp::ptr > (std::move (that.value));
|
||||||
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_stmt_continue: // stmt_continue
|
case symbol_kind::S_stmt_continue: // stmt_continue
|
||||||
value.move< stmt_continue::ptr > (std::move (that.value));
|
value.move< stmt_continue::ptr > (std::move (that.value));
|
||||||
break;
|
break;
|
||||||
@ -1326,7 +1332,6 @@ namespace xsk { namespace gsc {
|
|||||||
|
|
||||||
case symbol_kind::S_stmt_list: // stmt_list
|
case symbol_kind::S_stmt_list: // stmt_list
|
||||||
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
||||||
case symbol_kind::S_stmt_block: // stmt_block
|
|
||||||
value.move< stmt_list::ptr > (std::move (that.value));
|
value.move< stmt_list::ptr > (std::move (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2069,6 +2074,20 @@ namespace xsk { namespace gsc {
|
|||||||
{}
|
{}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
|
basic_symbol (typename Base::kind_type t, stmt_comp::ptr&& v, location_type&& l)
|
||||||
|
: Base (t)
|
||||||
|
, value (std::move (v))
|
||||||
|
, location (std::move (l))
|
||||||
|
{}
|
||||||
|
#else
|
||||||
|
basic_symbol (typename Base::kind_type t, const stmt_comp::ptr& v, const location_type& l)
|
||||||
|
: Base (t)
|
||||||
|
, value (v)
|
||||||
|
, location (l)
|
||||||
|
{}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 201103L <= YY_CPLUSPLUS
|
#if 201103L <= YY_CPLUSPLUS
|
||||||
basic_symbol (typename Base::kind_type t, stmt_continue::ptr&& v, location_type&& l)
|
basic_symbol (typename Base::kind_type t, stmt_continue::ptr&& v, location_type&& l)
|
||||||
: Base (t)
|
: Base (t)
|
||||||
@ -2612,6 +2631,10 @@ switch (yykind)
|
|||||||
value.template destroy< stmt_case::ptr > ();
|
value.template destroy< stmt_case::ptr > ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case symbol_kind::S_stmt_comp: // stmt_comp
|
||||||
|
value.template destroy< stmt_comp::ptr > ();
|
||||||
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_stmt_continue: // stmt_continue
|
case symbol_kind::S_stmt_continue: // stmt_continue
|
||||||
value.template destroy< stmt_continue::ptr > ();
|
value.template destroy< stmt_continue::ptr > ();
|
||||||
break;
|
break;
|
||||||
@ -2654,7 +2677,6 @@ switch (yykind)
|
|||||||
|
|
||||||
case symbol_kind::S_stmt_list: // stmt_list
|
case symbol_kind::S_stmt_list: // stmt_list
|
||||||
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
||||||
case symbol_kind::S_stmt_block: // stmt_block
|
|
||||||
value.template destroy< stmt_list::ptr > ();
|
value.template destroy< stmt_list::ptr > ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5174,6 +5196,10 @@ switch (yykind)
|
|||||||
value.copy< stmt_case::ptr > (YY_MOVE (that.value));
|
value.copy< stmt_case::ptr > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case symbol_kind::S_stmt_comp: // stmt_comp
|
||||||
|
value.copy< stmt_comp::ptr > (YY_MOVE (that.value));
|
||||||
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_stmt_continue: // stmt_continue
|
case symbol_kind::S_stmt_continue: // stmt_continue
|
||||||
value.copy< stmt_continue::ptr > (YY_MOVE (that.value));
|
value.copy< stmt_continue::ptr > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
@ -5216,7 +5242,6 @@ switch (yykind)
|
|||||||
|
|
||||||
case symbol_kind::S_stmt_list: // stmt_list
|
case symbol_kind::S_stmt_list: // stmt_list
|
||||||
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
||||||
case symbol_kind::S_stmt_block: // stmt_block
|
|
||||||
value.copy< stmt_list::ptr > (YY_MOVE (that.value));
|
value.copy< stmt_list::ptr > (YY_MOVE (that.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5506,6 +5531,10 @@ switch (yykind)
|
|||||||
value.move< stmt_case::ptr > (YY_MOVE (s.value));
|
value.move< stmt_case::ptr > (YY_MOVE (s.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case symbol_kind::S_stmt_comp: // stmt_comp
|
||||||
|
value.move< stmt_comp::ptr > (YY_MOVE (s.value));
|
||||||
|
break;
|
||||||
|
|
||||||
case symbol_kind::S_stmt_continue: // stmt_continue
|
case symbol_kind::S_stmt_continue: // stmt_continue
|
||||||
value.move< stmt_continue::ptr > (YY_MOVE (s.value));
|
value.move< stmt_continue::ptr > (YY_MOVE (s.value));
|
||||||
break;
|
break;
|
||||||
@ -5548,7 +5577,6 @@ switch (yykind)
|
|||||||
|
|
||||||
case symbol_kind::S_stmt_list: // stmt_list
|
case symbol_kind::S_stmt_list: // stmt_list
|
||||||
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
case symbol_kind::S_stmt_or_dev_list: // stmt_or_dev_list
|
||||||
case symbol_kind::S_stmt_block: // stmt_block
|
|
||||||
value.move< stmt_list::ptr > (YY_MOVE (s.value));
|
value.move< stmt_list::ptr > (YY_MOVE (s.value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -5663,7 +5691,7 @@ switch (yykind)
|
|||||||
|
|
||||||
#line 13 "parser.ypp"
|
#line 13 "parser.ypp"
|
||||||
} } // xsk::gsc
|
} } // xsk::gsc
|
||||||
#line 5667 "parser.hpp"
|
#line 5695 "parser.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ auto source::dump_decl_function(decl_function const& dec) -> void
|
|||||||
fmt::format_to(std::back_inserter(buf_), "(");
|
fmt::format_to(std::back_inserter(buf_), "(");
|
||||||
dump_expr_parameters(*dec.params);
|
dump_expr_parameters(*dec.params);
|
||||||
fmt::format_to(std::back_inserter(buf_), ")\n");
|
fmt::format_to(std::back_inserter(buf_), ")\n");
|
||||||
dump_stmt_list(*dec.body);
|
dump_stmt_comp(*dec.body);
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n");
|
fmt::format_to(std::back_inserter(buf_), "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +356,9 @@ auto source::dump_stmt(stmt const& stm) -> void
|
|||||||
case node::stmt_list:
|
case node::stmt_list:
|
||||||
dump_stmt_list(*stm.as_list);
|
dump_stmt_list(*stm.as_list);
|
||||||
break;
|
break;
|
||||||
|
case node::stmt_comp:
|
||||||
|
dump_stmt_comp(*stm.as_comp);
|
||||||
|
break;
|
||||||
case node::stmt_dev:
|
case node::stmt_dev:
|
||||||
dump_stmt_dev(*stm.as_dev);
|
dump_stmt_dev(*stm.as_dev);
|
||||||
break;
|
break;
|
||||||
@ -468,22 +471,7 @@ auto source::dump_stmt(stmt const& stm) -> void
|
|||||||
|
|
||||||
auto source::dump_stmt_list(stmt_list const& stm) -> void
|
auto source::dump_stmt_list(stmt_list const& stm) -> void
|
||||||
{
|
{
|
||||||
if (stm.is_expr)
|
auto last_special = false;
|
||||||
{
|
|
||||||
if (stm.list.size() > 0)
|
|
||||||
{
|
|
||||||
dump_stmt(stm.list[0]);
|
|
||||||
buf_.pop_back();
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool last_special = false;
|
|
||||||
|
|
||||||
if (!stm.is_case)
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1);
|
|
||||||
|
|
||||||
indent_ += 4;
|
indent_ += 4;
|
||||||
|
|
||||||
for (auto const& entry : stm.list)
|
for (auto const& entry : stm.list)
|
||||||
@ -511,39 +499,19 @@ auto source::dump_stmt_list(stmt_list const& stm) -> void
|
|||||||
}
|
}
|
||||||
|
|
||||||
indent_ -= 4;
|
indent_ -= 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (!stm.is_case)
|
auto source::dump_stmt_comp(stmt_comp const& stm) -> void
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1);
|
{
|
||||||
|
fmt::format_to(std::back_inserter(buf_), "{: >{}}\n", "{", indent_ + 1);
|
||||||
|
dump_stmt_list(*stm.block);
|
||||||
|
fmt::format_to(std::back_inserter(buf_), "\n{: >{}}", "}", indent_ + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto source::dump_stmt_dev(stmt_dev const& stm) -> void
|
auto source::dump_stmt_dev(stmt_dev const& stm) -> void
|
||||||
{
|
{
|
||||||
bool last_special = false;
|
|
||||||
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "/#\n");
|
fmt::format_to(std::back_inserter(buf_), "/#\n");
|
||||||
|
dump_stmt_list(*stm.block);
|
||||||
for (auto const& entry : stm.body->list)
|
|
||||||
{
|
|
||||||
if ((&entry != &stm.body->list.front() && entry.as_node->is_special_stmt()) || last_special)
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n");
|
|
||||||
|
|
||||||
if (entry == node::stmt_dev)
|
|
||||||
dump_stmt(entry);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "{: >{}}", "", indent_);
|
|
||||||
dump_stmt(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (&entry != &stm.body->list.back())
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n");
|
|
||||||
|
|
||||||
if (entry.as_node->is_special_stmt())
|
|
||||||
last_special = true;
|
|
||||||
else
|
|
||||||
last_special = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n#/");
|
fmt::format_to(std::back_inserter(buf_), "\n#/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,7 +629,7 @@ auto source::dump_stmt_if(stmt_if const& stm) -> void
|
|||||||
dump_expr(stm.test);
|
dump_expr(stm.test);
|
||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
|
|
||||||
if (stm.body == node::stmt_list)
|
if (stm.body == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.body);
|
dump_stmt(stm.body);
|
||||||
}
|
}
|
||||||
@ -680,7 +648,7 @@ auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void
|
|||||||
dump_expr(stm.test);
|
dump_expr(stm.test);
|
||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
|
|
||||||
if (stm.stmt_if == node::stmt_list)
|
if (stm.stmt_if == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.stmt_if);
|
dump_stmt(stm.stmt_if);
|
||||||
}
|
}
|
||||||
@ -694,7 +662,7 @@ auto source::dump_stmt_ifelse(stmt_ifelse const& stm) -> void
|
|||||||
|
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_);
|
fmt::format_to(std::back_inserter(buf_), "\n{: >{}}else", "", indent_);
|
||||||
|
|
||||||
if (stm.stmt_else == node::stmt_list)
|
if (stm.stmt_else == node::stmt_comp)
|
||||||
{
|
{
|
||||||
fmt::format_to(std::back_inserter(buf_), "\n");
|
fmt::format_to(std::back_inserter(buf_), "\n");
|
||||||
dump_stmt(stm.stmt_else);
|
dump_stmt(stm.stmt_else);
|
||||||
@ -729,7 +697,7 @@ auto source::dump_stmt_while(stmt_while const& stm) -> void
|
|||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm.body == node::stmt_list)
|
if (stm.body == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.body);
|
dump_stmt(stm.body);
|
||||||
}
|
}
|
||||||
@ -746,7 +714,7 @@ auto source::dump_stmt_dowhile(stmt_dowhile const& stm) -> void
|
|||||||
{
|
{
|
||||||
fmt::format_to(std::back_inserter(buf_), "do\n");
|
fmt::format_to(std::back_inserter(buf_), "do\n");
|
||||||
|
|
||||||
if (stm.body == node::stmt_list)
|
if (stm.body == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.body);
|
dump_stmt(stm.body);
|
||||||
}
|
}
|
||||||
@ -787,7 +755,7 @@ auto source::dump_stmt_for(stmt_for const& stm) -> void
|
|||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm.body == node::stmt_list)
|
if (stm.body == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.body);
|
dump_stmt(stm.body);
|
||||||
}
|
}
|
||||||
@ -815,7 +783,7 @@ auto source::dump_stmt_foreach(stmt_foreach const& stm) -> void
|
|||||||
dump_expr(stm.container);
|
dump_expr(stm.container);
|
||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
|
|
||||||
if (stm.body == node::stmt_list)
|
if (stm.body == node::stmt_comp)
|
||||||
{
|
{
|
||||||
dump_stmt(stm.body);
|
dump_stmt(stm.body);
|
||||||
}
|
}
|
||||||
@ -833,7 +801,7 @@ auto source::dump_stmt_switch(stmt_switch const& stm) -> void
|
|||||||
fmt::format_to(std::back_inserter(buf_), "switch ( ");
|
fmt::format_to(std::back_inserter(buf_), "switch ( ");
|
||||||
dump_expr(stm.test);
|
dump_expr(stm.test);
|
||||||
fmt::format_to(std::back_inserter(buf_), " )\n");
|
fmt::format_to(std::back_inserter(buf_), " )\n");
|
||||||
dump_stmt_list(*stm.body);
|
dump_stmt_comp(*stm.body);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto source::dump_stmt_case(stmt_case const& stm) -> void
|
auto source::dump_stmt_case(stmt_case const& stm) -> void
|
||||||
|
@ -40,6 +40,7 @@ private:
|
|||||||
auto dump_decl_function(decl_function const& dec) -> void;
|
auto dump_decl_function(decl_function const& dec) -> void;
|
||||||
auto dump_stmt(stmt const& stm) -> void;
|
auto dump_stmt(stmt const& stm) -> void;
|
||||||
auto dump_stmt_list(stmt_list const& stm) -> void;
|
auto dump_stmt_list(stmt_list const& stm) -> void;
|
||||||
|
auto dump_stmt_comp(stmt_comp const& stm) -> void;
|
||||||
auto dump_stmt_dev(stmt_dev const& stm) -> void;
|
auto dump_stmt_dev(stmt_dev const& stm) -> void;
|
||||||
auto dump_stmt_expr(stmt_expr const& stm) -> void;
|
auto dump_stmt_expr(stmt_expr const& stm) -> void;
|
||||||
auto dump_stmt_call(stmt_call const& stm) -> void;
|
auto dump_stmt_call(stmt_call const& stm) -> void;
|
||||||
|
1678
src/t6/parser.cpp
1678
src/t6/parser.cpp
File diff suppressed because it is too large
Load Diff
@ -5568,7 +5568,7 @@ switch (yykind)
|
|||||||
/// Constants.
|
/// Constants.
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
yylast_ = 3561, ///< Last index in yytable_.
|
yylast_ = 3635, ///< Last index in yytable_.
|
||||||
yynnts_ = 101, ///< Number of nonterminal symbols.
|
yynnts_ = 101, ///< Number of nonterminal symbols.
|
||||||
yyfinal_ = 27 ///< Termination state number.
|
yyfinal_ = 27 ///< Termination state number.
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user