01: package org.antlr.test;
02:
03: import org.antlr.tool.ANTLRErrorListener;
04: import org.antlr.tool.Message;
05: import org.antlr.tool.ToolMessage;
06:
07: import java.util.List;
08: import java.util.LinkedList;
09:
10: public class ErrorQueue implements ANTLRErrorListener {
11: List infos = new LinkedList();
12: List errors = new LinkedList();
13: List warnings = new LinkedList();
14:
15: public void info(String msg) {
16: infos.add(msg);
17: }
18:
19: public void error(Message msg) {
20: errors.add(msg);
21: }
22:
23: public void warning(Message msg) {
24: warnings.add(msg);
25: }
26:
27: public void error(ToolMessage msg) {
28: errors.add(msg);
29: }
30:
31: public int size() {
32: return infos.size() + errors.size() + warnings.size();
33: }
34:
35: public String toString() {
36: return "infos: " + infos + "errors: " + errors + "warnings: "
37: + warnings;
38: }
39: }
|