Ejemplo n.º 1
0
std::string outside_section::render(
    render_context& ctx, const token& token)
{
    using flag = render_node::flag;
    switch (token.token_type()) {
    case token::type::section_open:
        ctx.set_state<in_section>(in_section::type::normal, token);
        break;
    case token::type::inverted_section_open:
        ctx.set_state<in_section>(in_section::type::inverted, token);
        break;
    case token::type::variable:
        return visit(render_node(ctx, flag::escape_html), ctx.get_node(token.name()));
    case token::type::unescaped_variable:
        return visit(render_node(ctx, flag::none), ctx.get_node(token.name()));
    case token::type::text:
        return token.raw();
    case token::type::partial:
        return ctx.render_partial(token.name(), token.partial_prefix());
    default:
        break;
    }
    return "";
}
Ejemplo n.º 2
0
inline unique_ptr<statement>create_call_statement_from_tokenizer(const statement&parent,const token&tk,tokenizer&t){
	const string&func=tk.name();
	if("mov"==func)        return make_unique<call_asm_mov>(parent,move(tk),t);
	if("int"==func)        return make_unique<call_asm_int>(parent,move(tk),t);
	if("xor"==func)        return make_unique<call_asm_xor>(parent,move(tk),t);
	if("syscall"==func)return make_unique<call_asm_syscall>(parent,move(tk),t);
//	if("add"==func)        return make_unique<call_asm_add>(parent,move(tk),t);
	if("loop"==func)          return make_unique<stmt_loop>(parent,move(tk),t);
	if("break"==func)        return make_unique<stmt_break>(parent,move(tk),t);
	if("continue"==func)  return make_unique<stmt_continue>(parent,move(tk),t);
//	if("tag"==func)        return make_unique<call_asm_tag>(parent,move(tk),t);
//	if("cmp"==func)        return make_unique<call_asm_cmp>(parent,move(tk),t);
//	if("je"==func)          return make_unique<call_asm_je>(parent,move(tk),t);
//	if("jmp"==func)        return make_unique<call_asm_jmp>(parent,move(tk),t);
//	if("jne"==func)        return make_unique<call_asm_jne>(parent,move(tk),t);
	if("if"==func)              return make_unique<stmt_if>(parent,move(tk),t);
//	if("cmove"==func)    return make_unique<call_asm_cmove>(parent,move(tk),t);
//	if("cmovne"==func)  return make_unique<call_asm_cmovne>(parent,move(tk),t);
//	if("or"==func)          return make_unique<call_asm_or>(parent,move(tk),t);
//	if("and"==func)        return make_unique<call_asm_and>(parent,move(tk),t);
	return                           make_unique<stmt_call>(parent,move(tk),t);
}