示例#1
0
/** \brief Given a parsing table a \c pt and transition \c new_trans, if \c new_trans is a
    transition in \c pt, then return the successor table */
static optional<parse_table> find_match(optional<parse_table> const & pt, transition const & new_trans) {
    if (pt) {
        if (auto ls = pt->find(new_trans.get_token())) {
            for (auto at : ls) {
                if (new_trans.get_action().is_equal(at.first.get_action()))
                    return optional<parse_table>(at.second);
            }
        }
    }
    return optional<parse_table>();
}
示例#2
0
transition replace(transition const & t, std::function<expr(expr const &)> const & f) {
    return transition(t.get_token(), replace(t.get_action(), f));
}