本文整理汇总了Java中org.antlr.tool.ErrorManager.resetErrorState方法的典型用法代码示例。如果您正苦于以下问题:Java ErrorManager.resetErrorState方法的具体用法?Java ErrorManager.resetErrorState怎么用?Java ErrorManager.resetErrorState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.antlr.tool.ErrorManager
的用法示例。
在下文中一共展示了ErrorManager.resetErrorState方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkError
import org.antlr.tool.ErrorManager; //导入方法依赖的package包/类
protected void checkError(ErrorQueue equeue,
GrammarSemanticsMessage expectedMessage)
throws Exception
{
//System.out.println("errors="+equeue);
Message foundMsg = null;
for (int i = 0; i < equeue.errors.size(); i++) {
Message m = (Message)equeue.errors.get(i);
if (m.msgID==expectedMessage.msgID ) {
foundMsg = m;
}
}
assertTrue("no error; "+expectedMessage.msgID+" expected", equeue.errors.size()>0);
assertTrue("too many errors; "+equeue.errors, equeue.errors.size()<=1);
assertNotNull("couldn't find expected error: "+expectedMessage.msgID, foundMsg);
assertTrue("error is not a GrammarSemanticsMessage",
foundMsg instanceof GrammarSemanticsMessage);
assertEquals(expectedMessage.arg, foundMsg.arg);
assertEquals(expectedMessage.arg2, foundMsg.arg2);
ErrorManager.resetErrorState(); // wack errors for next test
}
示例2: run
import org.antlr.tool.ErrorManager; //导入方法依赖的package包/类
/**
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
ErrorManager.resetErrorState();
ErrorManager.setErrorListener(this);
writeMessage("Compile: " + iAntLRSourceFile.getLocationURI().toString());
Tool antLRCompiler;
antLRCompiler = new Tool(new String[] {new File(iAntLRSourceFile.getLocationURI()).getAbsolutePath()});
antLRCompiler.process();
if (ErrorManager.getNumErrors() == 0) {
writeMessage("Compile AntLR grammar was executed.");
MessageDialog.openInformation(shell,
"ParserTools",
"Compile AntLR grammar was executed.");
} else {
writeMessage("Cannot compile AntLT grammar");
}
try {
iProject.refreshLocal(IResource.DEPTH_INFINITE, null);
} catch (CoreException e) {
}
}
示例3: setUp
import org.antlr.tool.ErrorManager; //导入方法依赖的package包/类
protected void setUp() throws Exception {
ErrorManager.resetErrorState();
}