本文整理汇总了Java中org.antlr.tool.Message类的典型用法代码示例。如果您正苦于以下问题:Java Message类的具体用法?Java Message怎么用?Java Message使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Message类属于org.antlr.tool包,在下文中一共展示了Message类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkError
import org.antlr.tool.Message; //导入依赖的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
}
开发者ID:Sable,项目名称:mclab-core,代码行数:22,代码来源:TestRewriteAST.java
示例2: error
import org.antlr.tool.Message; //导入依赖的package包/类
@Override
public void error(Message msg) {
if (msg instanceof GrammarSyntaxMessage) {
GrammarSyntaxMessage syntaxMessage = (GrammarSyntaxMessage)msg;
Token token = syntaxMessage.offendingToken;
if (token == null)
return;
if (!(syntaxMessage.exception.input instanceof ANTLRParserTokenStream))
return;
ANTLRParserTokenStream stream = (ANTLRParserTokenStream)syntaxMessage.exception.input;
ANTLRErrorProvidingParser parser = stream.getParser();
if (parser == null)
return;
parser.syntaxErrors.add(new AntlrSyntaxErrorV3(snapshot, syntaxMessage.offendingToken, syntaxMessage.exception, msg.toString(), Severity.ERROR));
}
}
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:20,代码来源:ANTLRErrorProvidingParser.java
示例3: checkGrammarSemanticsError
import org.antlr.tool.Message; //导入依赖的package包/类
protected void checkGrammarSemanticsError(ErrorQueue equeue,
GrammarSemanticsMessage expectedMessage)
throws Exception
{
/*
System.out.println(equeue.infos);
System.out.println(equeue.warnings);
System.out.println(equeue.errors);
assertTrue("number of errors mismatch", n, equeue.errors.size());
*/
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;
}
}
assertNotNull("no error; "+expectedMessage.msgID+" expected", foundMsg);
assertTrue("error is not a GrammarSemanticsMessage",
foundMsg instanceof GrammarSemanticsMessage);
assertEquals(expectedMessage.arg, foundMsg.arg);
if ( equeue.size()!=1 ) {
System.err.println(equeue);
}
}
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:26,代码来源:BaseTest.java
示例4: checkGrammarSemanticsWarning
import org.antlr.tool.Message; //导入依赖的package包/类
protected void checkGrammarSemanticsWarning(ErrorQueue equeue,
GrammarSemanticsMessage expectedMessage)
throws Exception
{
Message foundMsg = null;
for (int i = 0; i < equeue.warnings.size(); i++) {
Message m = (Message)equeue.warnings.get(i);
if (m.msgID==expectedMessage.msgID ) {
foundMsg = m;
}
}
assertNotNull("no error; "+expectedMessage.msgID+" expected", foundMsg);
assertTrue("error is not a GrammarSemanticsMessage",
foundMsg instanceof GrammarSemanticsMessage);
assertEquals(expectedMessage.arg, foundMsg.arg);
}
开发者ID:pcingola,项目名称:jFuzzyLogic,代码行数:17,代码来源:BaseTest.java
示例5: error
import org.antlr.tool.Message; //导入依赖的package包/类
public void error(Message msg) {
errors.add(msg);
}
开发者ID:Sable,项目名称:mclab-core,代码行数:4,代码来源:ErrorQueue.java
示例6: warning
import org.antlr.tool.Message; //导入依赖的package包/类
public void warning(Message msg) {
warnings.add(msg);
}
开发者ID:Sable,项目名称:mclab-core,代码行数:4,代码来源:ErrorQueue.java
示例7: warning
import org.antlr.tool.Message; //导入依赖的package包/类
@Override
public void warning(Message msg) {
}
开发者ID:tunnelvisionlabs,项目名称:goworks,代码行数:4,代码来源:ANTLRErrorProvidingParser.java
示例8: error
import org.antlr.tool.Message; //导入依赖的package包/类
@Override
public void error(Message message) {
writeMessage("ERROR: " + message.toString());
}
开发者ID:asupdev,项目名称:asup,代码行数:6,代码来源:CompileAntLR.java
示例9: error
import org.antlr.tool.Message; //导入依赖的package包/类
public void error(Message arg0) {
System.out.println("error " + arg0);
}
开发者ID:chipster,项目名称:chipster,代码行数:4,代码来源:StringValidator.java
示例10: warning
import org.antlr.tool.Message; //导入依赖的package包/类
public void warning(Message arg0) {
System.out.println("warning " + arg0);
}
开发者ID:chipster,项目名称:chipster,代码行数:4,代码来源:StringValidator.java
示例11: warning
import org.antlr.tool.Message; //导入依赖的package包/类
@Override
public void warning(Message message) {
}
开发者ID:asupdev,项目名称:asup,代码行数:5,代码来源:CompileAntLR.java
注:本文中的org.antlr.tool.Message类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论