本文整理汇总了C++中pANTLR3_LEXER::recover方法的典型用法代码示例。如果您正苦于以下问题:C++ pANTLR3_LEXER::recover方法的具体用法?C++ pANTLR3_LEXER::recover怎么用?C++ pANTLR3_LEXER::recover使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pANTLR3_LEXER
的用法示例。
在下文中一共展示了pANTLR3_LEXER::recover方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/** Implementation of matchc for the lexer, overrides any
* base implementation in the base recognizer.
*
* \remark
* Note that the generated code lays down arrays of ints for constant
* strings so that they are int UTF32 form!
*/
static ANTLR3_BOOLEAN
matchc(pANTLR3_LEXER lexer, ANTLR3_UCHAR c)
{
if (lexer->input->istream->_LA(lexer->input->istream, 1) == c)
{
/* Matched correctly, do consume it
*/
lexer->input->istream->consume(lexer->input->istream);
/* Reset any failed indicator
*/
lexer->rec->state->failed = ANTLR3_FALSE;
return ANTLR3_TRUE;
}
/* Failed to match, exception and recovery time.
*/
if (lexer->rec->state->backtracking > 0)
{
lexer->rec->state->failed = ANTLR3_TRUE;
return ANTLR3_FALSE;
}
lexer->rec->exConstruct(lexer->rec);
/* TODO: Implement exception creation more fully perhaps
*/
lexer->recover(lexer);
return ANTLR3_FALSE;
}