本文整理汇总了C++中token::name方法的典型用法代码示例。如果您正苦于以下问题:C++ token::name方法的具体用法?C++ token::name怎么用?C++ token::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类token
的用法示例。
在下文中一共展示了token::name方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: render
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 "";
}
示例2:
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);
}