本文整理汇总了C++中TokenStream::getHygiene方法的典型用法代码示例。如果您正苦于以下问题:C++ TokenStream::getHygiene方法的具体用法?C++ TokenStream::getHygiene怎么用?C++ TokenStream::getHygiene使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TokenStream
的用法示例。
在下文中一共展示了TokenStream::getHygiene方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Parse_MacroRules
/// Parse an entire macro_rules! block into a format that exec.cpp can use
MacroRulesPtr Parse_MacroRules(TokenStream& lex)
{
TRACE_FUNCTION_F("");
Token tok;
// Parse the patterns and replacements
::std::vector<MacroRule> rules;
while( GET_TOK(tok, lex) != TOK_EOF )
{
lex.putback(tok);
rules.push_back( Parse_MacroRules_Var(lex) );
if(GET_TOK(tok, lex) != TOK_SEMICOLON) {
CHECK_TOK(tok, TOK_EOF);
break;
}
}
DEBUG("- " << rules.size() << " rules");
::std::vector<MacroRulesArm> rule_arms;
// Re-parse the patterns into a unified form
for(auto& rule : rules)
{
MacroRulesArm arm = MacroRulesArm( mv$(rule.m_pattern), mv$(rule.m_contents) );
enumerate_names(arm.m_pattern, arm.m_param_names);
rule_arms.push_back( mv$(arm) );
}
auto rv = new MacroRules( );
rv->m_hygiene = lex.getHygiene();
rv->m_rules = mv$(rule_arms);
return MacroRulesPtr(rv);
}