Skip to content

Instantly share code, notes, and snippets.

using result_token = string<'a', 'b', 'c'>;
using rest_of_string = string<'d', 'e', 'f', ' ', 'g'>;
template <typename str, typename curr_token>
struct get_token_impl;
template <typename current_token>
struct get_token_impl<string<>, current_token>
{
using result_token = current_token;
using rest_of_string = string<>;
};
template <char ...str_chars, typename current_token>
struct get_token_impl<string<' ', str_chars...>, current_token>
{
using result_token = current_token;
using rest_of_string = string<str_chars...>;
};
template <char curr_char, char ...str_chars, typename current_token>
struct get_token_impl<string<curr_char, str_chars...>, current_token>
{
using string_without_token_char = string<str_chars...>;
using result_t = get_token_impl<string_without_token_char, string_append<current_token, curr_char>>;
using result_token = typename result_t::result_token;
using rest_of_string = typename result_t::rest_of_string;
};
namespace details
{
template <typename s, typename current_tokens = tuple<>>
struct tokenize_impl;
template <typename current_tokens>
struct tokenize_impl<string<>, current_tokens>
{
using tokens = current_tokens;
};
pop eax
pop ecx
cmp eax, 0
jg end
mov ebx, 0
loop:
add ebx, ecx
cmp ecx, 0
jg loop
pop eax ; 0
pop ecx ; 2
cmp eax, 0 ; 4
jg end ; 7
mov ebx, 0 ; 9
loop:
add ebx, ecx ; 12
cmp ecx, 0 ; 15
jg loop ; 18
pop eax
pop ecx
cmp eax, 0
jg 23
mov ebx, 0
add ebx, ecx
cmp ecx, 0
jg 12
mov eax, ebx
ret
template <typename ...rest_of_tokens>
struct matcher_impl<tuple<tokens::tok_exit, rest_of_tokens...>>
{
using instruction = values_container<inst::to_size<inst::id_t::EXIT>>;
static constexpr auto eip_change = get_eip_change<inst::id_t::EXIT>;
using instruction_tokens = tuple<tokens::tok_exit>;
using rest_of_tokens_t = tuple<rest_of_tokens...>;
};