本文整理汇总了C++中Guard::Parser方法的典型用法代码示例。如果您正苦于以下问题:C++ Guard::Parser方法的具体用法?C++ Guard::Parser怎么用?C++ Guard::Parser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guard
的用法示例。
在下文中一共展示了Guard::Parser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExecuteLine
//.........这里部分代码省略.........
bool found = CompleteFileName( file);
if( !found)
{
file = fileRaw;
CompleteFileName( file);
}
ExecuteFile( file);
return CC_OK;
}
// statement -> execute it
executeLine.clear(); // clear EOF (for executeLine)
executeLine.str( line + "\n"); // append new line
RefDNode theAST;
try {
Guard<GDLLexer> lexer;
// LineContinuation LC
// conactenate the strings and insert \n
// the resulting string can be fed to the lexer
// print if expr parse ok
int lCNum = 0;
for(;;)
{
lexer.Reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
try {
// works, but ugly -> depends from parser detecting an error
// (which it always will due to missing END_U token in case of LC)
//lexer->Parser().SetCompileOpt(callStack.back()->CompileOpt());
lexer.Get()->Parser().interactive();
break; // no error -> everything ok
}
catch( GDLException& e)
{
int lCNew = lexer.Get()->LineContinuation();
if( lCNew == lCNum)
// throw; // no LC -> real error
{
#ifdef AUTO_PRINT_EXPR
#ifndef GDL_DEBUG
try {
// executeLine.clear(); // clear EOF (for executeLine)
// lexer.reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
// lexer->Parser().expr();
executeLine.clear(); // clear EOF (for executeLine)
executeLine.str( "print," + executeLine.str()); // append new line
lexer.reset( new GDLLexer(executeLine, "", callStack.back()->CompileOpt()));
lexer->Parser().interactive();
break; // no error -> everything ok
}
catch( GDLException& e2)
#endif
#endif
{
throw e;
}
}
lCNum = lCNew; // save number to see if next line also has LC