本文整理汇总了C++中Grammar::GetNumberOfActions方法的典型用法代码示例。如果您正苦于以下问题:C++ Grammar::GetNumberOfActions方法的具体用法?C++ Grammar::GetNumberOfActions怎么用?C++ Grammar::GetNumberOfActions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Grammar
的用法示例。
在下文中一共展示了Grammar::GetNumberOfActions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintActions
static void PrintActions(std::wostream& os, Grammar& g, bool virt)
{
#if 0
os << L"/*Forward declarations for actions*/\n";
os << L"struct Eval_Context;\n";
os << L"\n";
os << L" " << g.GetLanguageName() << L"_Actions{\n";
const wchar_t * psz0 =
L" int (*{ACTION})( {LANG}_Context* ctx);\n";
std::wstring ws0(psz0);
find_replace(ws0, L"{LANG}", g.GetLanguageName());
for (int i = 0; i < g.GetNumberOfActions(); i++)
{
std::wstring ws(ws0);
find_replace(ws, L"{ACTION}", g.GetActionName(i));
os << ws;
}
os << L"};\n";
#else
os << L"typedef enum \n";
os << L"{\n";
for (int i = 0; i < g.GetNumberOfActions(); i++)
{
os << L" " << g.GetActionName(i) << L",\n";
}
os << g.GetLanguageName() << L"_OnError\n";
os << L"}" << g.GetLanguageName() << L"_Actions;\n";
#endif
}
示例2: PrintActionsNames
static void PrintActionsNames(std::wostream& os, Grammar& g, bool virt)
{
os << L"//\n";
os << L"const char* " << g.GetLanguageName() << L"_Actions_Text(";
os << L"" << g.GetLanguageName() << L"_Actions e)\n";
os << L"{\n";
os << L" switch(e)\n";
os << L" {\n";
for (int i = 0; i < g.GetNumberOfActions(); i++)
{
os << L" case " << g.GetActionName(i) << L": return \"" << g.GetActionName(i) << L"\";\n";
}
os << L" }\n";
os << L" return \"\";\n";
os << L"};\n";
}