package net.sourceforge.phpdt.internal.compiler.problem;
import net.sourceforge.phpdt.core.compiler.IProblem;
-import net.sourceforge.phpdt.internal.compiler.util.Util;
+//import net.sourceforge.phpdt.internal.compiler.util.Util;
public class DefaultProblem implements ProblemSeverities, IProblem {
private char[] fileName;
this.line = line;
}
- public String errorReportSource(char[] unitSource) {
- // extra from the source the innacurate token
- // and "highlight" it using some underneath ^^^^^
- // put some context around too.
- // this code assumes that the font used in the console is fixed size
- // sanity .....
- if ((startPosition > endPosition)
- || ((startPosition < 0) && (endPosition < 0)))
- return Util.bind("problem.noSourceInformation"); //$NON-NLS-1$
- StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$
- errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$
- errorBuffer.append("\n\t"); //$NON-NLS-1$
- char c;
- final char SPACE = '\u0020';
- final char MARK = '^';
- final char TAB = '\t';
- // the next code tries to underline the token.....
- // it assumes (for a good display) that token source does not
- // contain any \r \n. This is false on statements !
- // (the code still works but the display is not optimal !)
- // expand to line limits
- int length = unitSource.length, begin, end;
- for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) {
- if ((c = unitSource[begin - 1]) == '\n' || c == '\r')
- break;
- }
- for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) {
- if ((c = unitSource[end + 1]) == '\r' || c == '\n')
- break;
- }
- // trim left and right spaces/tabs
- while ((c = unitSource[begin]) == ' ' || c == '\t')
- begin++;
- // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO
- // (philippe) should also trim right, but all tests are to be updated
- // copy source
- errorBuffer.append(unitSource, begin, end - begin + 1);
- errorBuffer.append("\n\t"); //$NON-NLS-1$
- // compute underline
- for (int i = begin; i < startPosition; i++) {
- errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE);
- }
- for (int i = startPosition; i <= (endPosition >= length ? length - 1
- : endPosition); i++) {
- errorBuffer.append(MARK);
- }
- return errorBuffer.toString();
- }
+// public String errorReportSource(char[] unitSource) {
+// // extra from the source the innacurate token
+// // and "highlight" it using some underneath ^^^^^
+// // put some context around too.
+// // this code assumes that the font used in the console is fixed size
+// // sanity .....
+// if ((startPosition > endPosition)
+// || ((startPosition < 0) && (endPosition < 0)))
+// return Util.bind("problem.noSourceInformation"); //$NON-NLS-1$
+// StringBuffer errorBuffer = new StringBuffer(" "); //$NON-NLS-1$
+// errorBuffer.append(Util.bind("problem.atLine", String.valueOf(line))); //$NON-NLS-1$
+// errorBuffer.append("\n\t"); //$NON-NLS-1$
+// char c;
+// final char SPACE = '\u0020';
+// final char MARK = '^';
+// final char TAB = '\t';
+// // the next code tries to underline the token.....
+// // it assumes (for a good display) that token source does not
+// // contain any \r \n. This is false on statements !
+// // (the code still works but the display is not optimal !)
+// // expand to line limits
+// int length = unitSource.length, begin, end;
+// for (begin = startPosition >= length ? length - 1 : startPosition; begin > 0; begin--) {
+// if ((c = unitSource[begin - 1]) == '\n' || c == '\r')
+// break;
+// }
+// for (end = endPosition >= length ? length - 1 : endPosition; end + 1 < length; end++) {
+// if ((c = unitSource[end + 1]) == '\r' || c == '\n')
+// break;
+// }
+// // trim left and right spaces/tabs
+// while ((c = unitSource[begin]) == ' ' || c == '\t')
+// begin++;
+// // while ((c = unitSource[end]) == ' ' || c == '\t') end--; TODO
+// // (philippe) should also trim right, but all tests are to be updated
+// // copy source
+// errorBuffer.append(unitSource, begin, end - begin + 1);
+// errorBuffer.append("\n\t"); //$NON-NLS-1$
+// // compute underline
+// for (int i = begin; i < startPosition; i++) {
+// errorBuffer.append((unitSource[i] == TAB) ? TAB : SPACE);
+// }
+// for (int i = startPosition; i <= (endPosition >= length ? length - 1
+// : endPosition); i++) {
+// errorBuffer.append(MARK);
+// }
+// return errorBuffer.toString();
+// }
// public String errorReportSource(ITextEditor textEditor){
// //ICompilationUnit compilationUnit) {