本文整理汇总了C++中Lexer::Close方法的典型用法代码示例。如果您正苦于以下问题:C++ Lexer::Close方法的具体用法?C++ Lexer::Close怎么用?C++ Lexer::Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer::Close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main(void)
{
Lexer objLex;
objLex.Init();
while (true)
{
string strInput = "";
while (strInput.empty())
{
cout << "Input a filename or 'q' to quit: ";
if (!getline(cin,strInput) || strInput == "q")
{
strInput = "";
break;
}
}
// User typed "q" if it's empty (got here with "break")
if (strInput.empty()) break;
if (!objLex.Open(strInput.c_str()))
{
cout << "Error opening file: " << strInput << endl;
continue;
}
Parser objParse(&objLex);
bool created = false;
try
{
if (objParse.Validate())
{
created = true;
Executer exe;
exe.Execute(objParse.lstParseTree);
//cout << exe.symTable << endl << endl;
vector<DataValue>::iterator it;
}
else
{
cout << "Invalid source file, parse tree was not created." << endl;
}
} catch (Token objToken)
{
cout << "Lexer Error: " << objToken.dtValue << endl;
}
/*if (!created)
{
string strTemp;
do
{
cout << "Would you like to view the partial parse-tree (y/n)? ";
cin >> strTemp;
cin.ignore();
cin.clear();
} while (strTemp!="y"&&strTemp!="Y"&&strTemp!="n"&&strTemp!="N");
if (tolower(strTemp[0]) == 'y')
objParse.PrintTree(cout);
}*/
objLex.Close();
cout << "End of file." << endl;
}
}