01: package javaparser;
02:
03: import java.util.*;
04: import tide.editor.UIConstants;
05:
06: /** parser error
07: */
08: public final class ErrorNode extends MainNode {
09: final String message;
10:
11: public ErrorNode(String message) {
12: super ("", "E", UIConstants.red, true);
13: this .message = message;
14: this .expandInView = true;
15:
16: int line = 0;
17: int pos = message.indexOf("line ");
18: if (pos > 0) {
19: int posE = message.indexOf(',', pos + 5);
20: if (posE > 0) {
21: String ls = message.substring(pos + 5, posE);
22: //System.out.println("Error node: ls="+ls);
23: try {
24: line = Integer.parseInt(ls);
25: } catch (Exception ee) {
26: }
27: }
28: }
29:
30: int column = 0;
31: pos = message.indexOf("column ", pos);
32: if (pos > 0) {
33: int posE = message.indexOf('.', pos + 7);
34: if (posE > 0) {
35: String ls = message.substring(pos + 7, posE);
36: try {
37: column = Integer.parseInt(ls);
38: } catch (Exception ee) {
39: }
40: }
41: }
42:
43: setStart(line, column);
44: setEnd(line, column + 1);
45:
46: }
47:
48: @Override
49: public String toString() {
50: return message;
51: }
52:
53: }
|