Decompiler fixes + decompiling (#276)

* decomp pad

* more decompilation

* update

* fix test name
This commit is contained in:
water111
2021-02-22 09:36:30 -05:00
committed by GitHub
parent ac24b2ab15
commit 5ec9a91eb9
48 changed files with 2567 additions and 530 deletions
+32
View File
@@ -68,6 +68,13 @@ Matcher Matcher::integer(std::optional<int> value) {
return m;
}
Matcher Matcher::any_integer(int match_id) {
Matcher m;
m.m_kind = Kind::ANY_INT;
m.m_int_out_id = match_id;
return m;
}
Matcher Matcher::any_quoted_symbol(int match_id) {
Matcher m;
m.m_kind = Kind::ANY_QUOTED_SYMBOL;
@@ -272,6 +279,31 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out) const {
return false;
} break;
case Kind::ANY_INT: {
auto as_simple_atom = dynamic_cast<SimpleAtomElement*>(input->try_as_single_element());
if (as_simple_atom) {
if (as_simple_atom->atom().is_int()) {
if (m_int_out_id != -1) {
maps_out->ints[m_int_out_id] = as_simple_atom->atom().get_int();
}
return true;
}
}
auto as_expr = dynamic_cast<SimpleExpressionElement*>(input->try_as_single_element());
if (as_expr && as_expr->expr().is_identity()) {
auto atom = as_expr->expr().get_arg(0);
if (atom.is_int()) {
if (m_int_out_id != -1) {
maps_out->ints[m_int_out_id] = atom.get_int();
}
return true;
}
}
return false;
} break;
case Kind::ANY_QUOTED_SYMBOL: {
auto as_simple_atom = dynamic_cast<SimpleAtomElement*>(input->try_as_single_element());
if (as_simple_atom) {