1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

bug 102847 line numbers on scanner problems

This commit is contained in:
Andrew Niefer 2005-07-07 20:30:52 +00:00
parent aa3270e91a
commit ae3e33131f

View file

@ -16,6 +16,7 @@ import java.util.Map;
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTFileLocation;
import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTProblem; import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@ -268,7 +269,17 @@ public class ScannerASTProblem extends ASTNode implements IASTProblem {
msg = MessageFormat.format(msg, new Object[] { new String(arg) }); msg = MessageFormat.format(msg, new Object[] { new String(arg) });
} }
Object[] args = new Object[] { msg, new String(""), new Integer(0) }; //$NON-NLS-1$ IASTFileLocation f = getFileLocation();
String file = null;
int line = 0;
if( f == null )
{
file = ""; //$NON-NLS-1$
} else {
file = f.getFileName();
line = f.getStartingLineNumber();
}
Object[] args = new Object[] { msg, file, new Integer(line) }; //$NON-NLS-1$
message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args); message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
return message; return message;
} }