int st = converter.convert(ec.token.getLine(), ec.token.getCharPositionInLine());
String sm = ec.token.getText();
int et = st + ec.token.getText().length();
if (st == -1)
return;
DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
ProblemSeverities.Error, st, et, ec.token.getLine());
if (!problems.contains(defaultProblem)) {
reporter.reportProblem(defaultProblem);
problems.add(defaultProblem);
System.out.println(messages[0] + " ### line " + ec.token.getLine());
}
} else if (re instanceof MismatchedTokenException) {
MismatchedTokenException ec = (MismatchedTokenException) re;
if (message == null || ec.token.getText() == null) {
m = ec.toString();
} else {
m = "mismatched input: " + message + " : " + ec.token.getText();
}
// if (message == null) {
// message = "mismatched input "
// + this.parser.getTokenErrorDisplay(ec.token);
// // return;
// }
String[] messages = { m }; // "Syntax Error:" + message, message,
// ec.token.getText() };
// this.converter.convert(ec.token).getColumn() - 1;
// String sm = ec.token.getText();
// st + ((sm != null) ? sm.length() : 1);
// TODO martin: "rewrite converter"
int st = converter.convert(ec.token.getLine(), ec.token.getCharPositionInLine());
// String sm = ec.token.getText();
int et = st;
if (ec.token.getText() != null) {
et = ec.token.getText().length() + st;
if (et >= this.converter.length()) {
et = this.converter.length() - 1;
st -= 2;
}
} else {
st = ((CommonToken) token).getStartIndex();
et = ((CommonToken) token).getStopIndex();
}
// reporter.handle(CompilerOptions.OFFSET, messages, messages,
// st, et);
DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
ProblemSeverities.Error, st, et, ec.line);
if (!problems.contains(defaultProblem)) {
reporter.reportProblem(defaultProblem);
problems.add(defaultProblem);
System.out.println(messages[0] + " ### line " + ec.line);
}
} else if (re instanceof FailedPredicateException) {
String[] messages = { "Syntax Error:" + message, message };
if (message == null) {
messages[0] = re.toString();
}
DLTKToken convert = this.converter.convert(re.token);
int st = convert.getColumn();
int et = convert.getColumn() + convert.getText().length();
// reporter.handle(CompilerOptions.OFFSET, messages, messages,
// st, et);
DefaultProblem defaultProblem = new DefaultProblem("", "Type not defined in this script: "
+ convert.getText(), 0, new String[] {}, ProblemSeverities.Warning, st, et,
re.token.getLine());
if (!problems.contains(defaultProblem)) {
reporter.reportProblem(defaultProblem);
problems.add(defaultProblem);
System.out.println(messages[0] + " ### line " + re.token.getLine());
}
} else {
String[] messages = { "Syntax Error:" + message, message };
if (message == null) {
messages[0] = re.toString();
}
DLTKToken convert = this.converter.convert(re.token);
int st = convert.getColumn();
int et = convert.getColumn() + convert.getText().length();
// reporter.handle(CompilerOptions.OFFSET, messages, messages,
// st, et);
DefaultProblem defaultProblem = new DefaultProblem("", messages[0], 0, new String[] {},
ProblemSeverities.Error, st, et, re.token.getLine());
if (!problems.contains(defaultProblem)) {
reporter.reportProblem(defaultProblem);
problems.add(defaultProblem);
System.out.println(messages[0] + " ### line " + re.token.getLine());