96 final String eoln = System.lineSeparator();
97 final int position = Token.descPosition(token);
98 final StringBuilder sb = new StringBuilder();
99
100 // Source description and message.
101 sb.append(source.getName()).
102 append(':').
103 append(line).
104 append(':').
105 append(column).
106 append(' ').
107 append(message).
108 append(eoln);
109
110 // Source content.
111 final String sourceLine = source.getSourceLine(position);
112 sb.append(sourceLine).append(eoln);
113
114 // Pointer to column.
115 for (int i = 0; i < column; i++) {
116 if (sourceLine.charAt(i) == '\t') {
117 sb.append('\t');
118 } else {
119 sb.append(' ');
120 }
121 }
122
123 sb.append('^');
124 // Use will append eoln.
125 // buffer.append(eoln);
126
127 return sb.toString();
128 }
129
130 /**
131 * Report an error using information provided by the ParserException
132 *
133 * @param e ParserException object
134 */
135
136 public void error(final ParserException e) {
|
96 final String eoln = System.lineSeparator();
97 final int position = Token.descPosition(token);
98 final StringBuilder sb = new StringBuilder();
99
100 // Source description and message.
101 sb.append(source.getName()).
102 append(':').
103 append(line).
104 append(':').
105 append(column).
106 append(' ').
107 append(message).
108 append(eoln);
109
110 // Source content.
111 final String sourceLine = source.getSourceLine(position);
112 sb.append(sourceLine).append(eoln);
113
114 // Pointer to column.
115 for (int i = 0; i < column; i++) {
116 if (i < sourceLine.length() && sourceLine.charAt(i) == '\t') {
117 sb.append('\t');
118 } else {
119 sb.append(' ');
120 }
121 }
122
123 sb.append('^');
124 // Use will append eoln.
125 // buffer.append(eoln);
126
127 return sb.toString();
128 }
129
130 /**
131 * Report an error using information provided by the ParserException
132 *
133 * @param e ParserException object
134 */
135
136 public void error(final ParserException e) {
|