Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2008-02-21 10:20:04 +0000
committerMarkus Schorn2008-02-21 10:20:04 +0000
commitf211b6d5124b7a3df51a975fe804a36d3f50fa7a (patch)
tree5dea1d7a489d719aa549c0da2ac35e8a0fcad88b /core/org.eclipse.cdt.core/parser
parentf7b257a9a219c44741802251a920fda33c48ec69 (diff)
downloadorg.eclipse.cdt-f211b6d5124b7a3df51a975fe804a36d3f50fa7a.tar.gz
org.eclipse.cdt-f211b6d5124b7a3df51a975fe804a36d3f50fa7a.tar.xz
org.eclipse.cdt-f211b6d5124b7a3df51a975fe804a36d3f50fa7a.zip
Removed class Problem, a duplicate of ASTProblem, related to bug 212864.
Diffstat (limited to 'core/org.eclipse.cdt.core/parser')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTProblem.java415
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java126
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java34
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java232
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java81
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/TraceUtil.java8
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java5
12 files changed, 105 insertions, 818 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
index 9c04705405d..29ef5306721 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTSignatureUtil.java
@@ -1083,6 +1083,6 @@ public class ASTSignatureUtil {
* Returns the same message as {@link IASTProblem#getMessageWithoutLocation()}.
*/
public static String getProblemMessage(int problemID, String detail) {
- return ASTProblem.getMessageWithoutLocation(problemID, detail);
+ return ASTProblem.getMessage(problemID, detail);
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTProblem.java
index b67d045d93f..ff9f596dce4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTProblem.java
@@ -11,419 +11,10 @@
*******************************************************************************/
package org.eclipse.cdt.core.dom.ast;
-import org.eclipse.cdt.internal.core.parser.ParserMessages;
+import org.eclipse.cdt.core.parser.IProblem;
/**
- * @author jcamelon
- *
- * Description of a C/C++ parse/compilation problem, as detected by the parser
- * or some of the underlying clients of the parser.
- *
- * A problem provides access to:
- * <ul>
- * <li> its location (originating source file name, source position, line
- * number), </li>
- * <li> its message description and a predicate to check its severity (warning
- * or error). </li>
- * <li> its ID : an number identifying the very nature of this problem. All
- * possible IDs are listed as constants on this interface. </li>
- * </ul>
+ * Interface for problems in the ast tree.
*/
-public interface IASTProblem extends IASTNode {
- /**
- * Returns the problem id
- *
- * @return the problem id
- */
- int getID();
-
- /**
- * Answer a localized, human-readable message string which describes the
- * problem including its location
- *
- * @return a localized, human-readable message string which describes the
- * problem
- */
- String getMessage();
-
- /**
- * Returns a human-readable message string describing the problem, without
- * location information.
- */
- String getMessageWithoutLocation();
-
- /**
- * Return to the client a map between parameter names and values.
- *
- * The keys and values are all Strings.
- *
- *
- * @return a map between parameter names and values.
- */
- String getArguments();
-
- /**
- * Checks the severity to see if the Error bit is set.
- *
- * @return true if the Error bit is set for the severity, false otherwise
- */
- boolean isError();
-
- /**
- * Checks the severity to see if the Warning bit is not set.
- *
- * @return true if the Warning bit is not set for the severity, false
- * otherwise
- */
- boolean isWarning();
-
- /**
- * Unknown Numeric Value for line numbers and offsets; use this constant
- */
- public final static int INT_VALUE_NOT_PROVIDED = -1;
-
- /**
- * Unknown filename sentinel value
- */
- public final static String FILENAME_NOT_PROVIDED = ParserMessages
- .getString("IProblem.unknownFileName"); //$NON-NLS-1$
-
- /**
- * Problem Categories The high bits of a problem ID contains information
- * about the category of a problem. For example, (problemID & TypeRelated) !=
- * 0, indicates that this problem is type related.
- *
- * A problem category can help to implement custom problem filters. Indeed,
- * when numerous problems are listed, focusing on import related problems
- * first might be relevant.
- *
- * When a problem is tagged as Internal, it means that no change other than
- * a local source code change can fix the corresponding problem.
- */
-
- /**
- * IProblem relates to a valid error on the Scanner
- */
- public final static int SCANNER_RELATED = 0x01000000;
-
- /**
- * IProblem relates to a valid error on the preprocessor
- */
- public final static int PREPROCESSOR_RELATED = 0x02000000;
-
- /**
- * IProblem relates to a valid syntax error in the parser
- */
- public final static int SYNTAX_RELATED = 0x04000000;
-
- /**
- * IProblem relates to a valid semantical error in the parser
- */
- public final static int SEMANTICS_RELATED = 0x08000000;
-
- /**
- * IProblem relates to an implementation of design limitation
- */
- public final static int INTERNAL_RELATED = 0x10000000;
-
- /**
- * Check the parameter bitmask against an IProblem's ID to broadly segregate
- * the types of problems.
- *
- * @param bitmask
- * @return true if ( (id & bitmask ) != 0 )
- */
- public boolean checkCategory(int bitmask);
-
- /**
- * Mask to use in order to filter out the category portion of the problem
- * ID.
- */
- public final static int IGNORE_CATEGORIES_MASK = 0xFFFFFF;
-
- /**
- * Below are listed all available problem attributes. The JavaDoc for each
- * problem ID indicates when they should be contributed to creating a
- * problem of that type.
- */
-
- // Preprocessor IProblem attributes
- /**
- * The text that follows a #error preprocessor directive
- */
- public final static String A_PREPROC_POUND_ERROR = ParserMessages
- .getString("IProblem.preproc.poundError"); //$NON-NLS-1$
-
- /**
- * The text that follows a #warning preprocessor directive
- */
- public final static String A_PREPROC_POUND_WARNING = ParserMessages
- .getString("IProblem.preproc.poundWarning"); //$NON-NLS-1$
-
- /**
- * The filename that failed somehow in an preprocessor include directive
- */
- public final static String A_PREPROC_INCLUDE_FILENAME = ParserMessages
- .getString("IProblem.preproc.include"); //$NON-NLS-1$
-
- /**
- * A preprocessor macro name
- */
- public final static String A_PREPROC_MACRO_NAME = ParserMessages
- .getString("IProblem.preproc.macro"); //$NON-NLS-1$
-
- /**
- * A preprocessor conditional that could not be evaluated
- *
- * #if X + Y == Z <== that one, if X, Y or Z are not defined #endif
- */
- public final static String A_PREPROC_CONDITION = ParserMessages
- .getString("IProblem.preproc.condition"); //$NON-NLS-1$
-
- /**
- * A preprocessor directive that could not be interpretted
- *
- * e.g. #blah
- */
- public final static String A_PREPROC_UNKNOWN_DIRECTIVE = ParserMessages
- .getString("IProblem.preproc.unknownDirective"); //$NON-NLS-1$
-
- /**
- * The preprocessor conditional statement that caused an unbalanced
- * mismatch.
- *
- * #if X #else #else <=== that one #endif
- */
- public final static String A_PREPROC_CONDITIONAL_MISMATCH = ParserMessages
- .getString("IProblem.preproc.conditionalMismatch"); //$NON-NLS-1$
-
- /**
- * The Bad character encountered in scanner
- */
- public static final String A_SCANNER_BADCHAR = null;
-
- /**
- * A_SYMBOL_NAME - symbol name
- */
- public static final String A_SYMBOL_NAME = ParserMessages
- .getString("IProblem.symbolName"); //$NON-NLS-1$
-
- /**
- * A_NAMESPACE_NAME = namespace name
- */
- public static final String A_NAMESPACE_NAME = ParserMessages
- .getString("IProblem.namespaceName"); //$NON-NLS-1$
-
- /**
- * A_TYPE_NAME - type name
- */
- public static final String A_TYPE_NAME = ParserMessages
- .getString("IProblem.typeName"); //$NON-NLS-1$
-
- /**
- * Below are listed all available problem IDs. Note that this list could be
- * augmented in the future, as new features are added to the C/C++ core
- * implementation.
- */
-
- /*
- * Scanner Problems
- */
-
- /**
- * Bad character encountered by Scanner. Required attributes:
- * A_SCANNER_BADCHAR
- *
- * @see #A_SCANNER_BADCHAR
- */
- public final static int SCANNER_BAD_CHARACTER = SCANNER_RELATED | 0x001;
-
- /**
- * Unbounded literal string encountered by Scanner. Required attributes:
- * none.
- */
- public final static int SCANNER_UNBOUNDED_STRING = SCANNER_RELATED | 0x002;
-
- /**
- * Invalid escape sequence encountered by Scanner. Required attributes:
- * none.
- */
- public final static int SCANNER_INVALID_ESCAPECHAR = SCANNER_RELATED | 0x003;
-
- /**
- * Bad floating point encountered by Scanner. Required attributes: none.
- */
- public final static int SCANNER_BAD_FLOATING_POINT = SCANNER_RELATED | 0x004;
-
- /**
- * Bad hexidecimal encountered by Scanner. Required attributes: none.
- */
- public final static int SCANNER_BAD_HEX_FORMAT = SCANNER_RELATED | 0x005;
-
- /**
- * Unexpected EOF encountered by Scanner. Required attributes: none.
- */
- public final static int SCANNER_UNEXPECTED_EOF = SCANNER_RELATED | 0x006;
-
- /**
- * Bad octal encountered by Scanner. Required attributes: none.
- */
- public final static int SCANNER_BAD_OCTAL_FORMAT = SCANNER_RELATED | 0x007;
-
- /**
- * Bad decimal encountered by Scanner. Required attributes: none.
- */
- public final static int SCANNER_BAD_DECIMAL_FORMAT = SCANNER_RELATED | 0x008;
-
- /**
- * Assignment '=' encountered in macro by Scanner. Required attributes:
- * none.
- */
- public final static int SCANNER_ASSIGNMENT_NOT_ALLOWED = SCANNER_RELATED | 0x009;
-
- /**
- * Division by 0 encountered in macro by Scanner. Required attributes: none.
- */
- public final static int SCANNER_DIVIDE_BY_ZERO = SCANNER_RELATED | 0x00A;
-
- /**
- * Missing ')' encountered in macro by Scanner. Required attributes: none.
- */
- public final static int SCANNER_MISSING_R_PAREN = SCANNER_RELATED | 0x00B;
-
- /**
- * Expression syntax error encountered in macro by Scanner. Required
- * attributes: none.
- */
- public final static int SCANNER_EXPRESSION_SYNTAX_ERROR = SCANNER_RELATED | 0x00C;
-
- /**
- * Expression syntax error encountered in macro by Scanner. Required
- * attributes: none.
- */
- public final static int SCANNER_ILLEGAL_IDENTIFIER = SCANNER_RELATED | 0x00D;
-
- /**
- * Division by 0 encountered in macro by Scanner. Required attributes: none.
- */
- public final static int SCANNER_BAD_CONDITIONAL_EXPRESSION = SCANNER_RELATED | 0x00E;
-
- /*
- * Preprocessor Problems
- */
-
- /**
- * #error encountered by Preprocessor. Required attributes:
- * A_PREPROC_POUND_ERROR
- *
- * @see #A_PREPROC_POUND_ERROR
- */
- public final static int PREPROCESSOR_POUND_ERROR = PREPROCESSOR_RELATED | 0x001;
-
- /**
- * Inclusion not found by Preprocessor. Required attributes:
- * A_PREPROC_INCLUDE_FILENAME
- *
- * @see #A_PREPROC_INCLUDE_FILENAME
- */
- public final static int PREPROCESSOR_INCLUSION_NOT_FOUND = PREPROCESSOR_RELATED | 0x002;
-
- /**
- * Macro definition not found by Preprocessor. Required attributes:
- * A_PREPROC_MACRO_NAME
- *
- * @see #A_PREPROC_MACRO_NAME
- */
- public final static int PREPROCESSOR_DEFINITION_NOT_FOUND = PREPROCESSOR_RELATED | 0x003;
-
- /**
- * Preprocessor conditionals seem unbalanced. Required attributes:
- * A_PREPROC_CONDITIONAL_MISMATCH
- *
- * @see #A_PREPROC_CONDITIONAL_MISMATCH
- */
-
- public final static int PREPROCESSOR_UNBALANCE_CONDITION = PREPROCESSOR_RELATED | 0x004;
-
- /**
- * Invalid format to Macro definition. Required attributes:
- * A_PREPROC_MACRO_NAME
- *
- * @see #A_PREPROC_MACRO_NAME
- */
- public final static int PREPROCESSOR_INVALID_MACRO_DEFN = PREPROCESSOR_RELATED | 0x005;
-
- /**
- * Invalid or unknown preprocessor directive encountered by Preprocessor.
- * Required attributes: A_PREPROC_UNKNOWN_DIRECTIVE
- *
- * @see #A_PREPROC_UNKNOWN_DIRECTIVE
- */
- public final static int PREPROCESSOR_INVALID_DIRECTIVE = PREPROCESSOR_RELATED | 0x006;
-
- /**
- * Invalid macro redefinition encountered by Preprocessor. Required
- * attributes: A_PREPROC_MACRO_NAME
- *
- * @see #A_PREPROC_MACRO_NAME
- */
- public final static int PREPROCESSOR_INVALID_MACRO_REDEFN = PREPROCESSOR_RELATED | 0x007;
-
- /**
- * Preprocessor Conditional cannot not be evaluated due. Required
- * attributes: A_PREPROC_CONDITION
- *
- * @see #A_PREPROC_CONDITION
- */
- public final static int PREPROCESSOR_CONDITIONAL_EVAL_ERROR = PREPROCESSOR_RELATED | 0x008;
-
- /**
- * Invalid macro usage encountered by Preprocessor. Required attributes:
- * A_PREPROC_MACRO_NAME
- *
- * @see #A_PREPROC_MACRO_NAME
- */
- public final static int PREPROCESSOR_MACRO_USAGE_ERROR = PREPROCESSOR_RELATED | 0x009;
-
- /**
- * Invalid Macro Pasting encountered by Preprocessor. Required attributes:
- * A_PREPROC_MACRO_NAME
- *
- * @see #A_PREPROC_MACRO_NAME
- */
- public final static int PREPROCESSOR_MACRO_PASTING_ERROR = PREPROCESSOR_RELATED | 0x00A;
-
- /**
- * Circular inclusion encountered by Preprocessor. Required attributes:
- * A_PREPROC_INCLUDE_FILENAME
- *
- * @see #A_PREPROC_INCLUDE_FILENAME
- */
- public final static int PREPROCESSOR_CIRCULAR_INCLUSION = PREPROCESSOR_RELATED | 0x00B;
-
- /**
- * macro argument "..." encountered without the required ')' i.e. must be
- * last argument if used Required attributes: none
- */
- public final static int PREPROCESSOR_MISSING_RPAREN_PARMLIST = PREPROCESSOR_RELATED | 0x00C;
-
- /**
- * __VA_ARGS__ encountered in macro definition without the required '...'
- * parameter Required attributes: none
- */
- public final static int PREPROCESSOR_INVALID_VA_ARGS = PREPROCESSOR_RELATED | 0x00D;
-
- /**
- * #warning encountered by Preprocessor. Required attributes:
- * A_PREPROC_POUND_WARNING
- *
- * @see #A_PREPROC_POUND_WARNING
- */
- public final static int PREPROCESSOR_POUND_WARNING = PREPROCESSOR_RELATED | 0x00E;
-
- /*
- * Parser Syntactic Problems
- */
- public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
-
+public interface IASTProblem extends IProblem, IASTNode {
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java
index 5f588d56f96..03561e8fbd1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/IProblem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,6 +43,12 @@ public interface IProblem
String getMessage();
/**
+ * Returns a human-readable message string describing the problem, adding
+ * location information.
+ */
+ String getMessageWithLocation();
+
+ /**
* Return to the client a map between parameter names and values.
*
* The keys and values are all Strings.
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
index f8a32b57dc0..9256e5bf0be 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTProblem.java
@@ -61,24 +61,16 @@ public class ASTProblem extends ASTNode implements IASTProblem {
return !isError;
}
- public String getMessage() {
- String msg= getMessageWithoutLocation();
-
- IASTFileLocation f = getFileLocation();
- String file = null;
- int line = 0;
- if( f == null )
- {
- file = ""; //$NON-NLS-1$
- } else {
- file = f.getFileName();
- line = f.getStartingLineNumber();
- }
+ public String getMessageWithLocation() {
+ String msg= getMessage();
+
+ char[] file= getOriginatingFileName();
+ int line= getSourceLineNumber();
Object[] args = new Object[] { msg, file, new Integer(line) };
return ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
}
- public static String getMessageWithoutLocation(int id, String arg) {
+ public static String getMessage(int id, String arg) {
String msg = errorMessages.get(new Integer(id));
if (msg == null)
msg = ""; //$NON-NLS-1$
@@ -89,81 +81,121 @@ public class ASTProblem extends ASTNode implements IASTProblem {
return msg;
}
- public String getMessageWithoutLocation() {
- return getMessageWithoutLocation(id, arg == null ? null : new String(arg));
+ public String getMessage() {
+ return getMessage(id, arg == null ? null : new String(arg));
}
public boolean checkCategory(int bitmask) {
return ((id & bitmask) != 0);
}
- public String getArguments() {
- return arg != null ? String.valueOf(arg) : ""; //$NON-NLS-1$
+ public String[] getArguments() {
+ return arg == null ? new String[0] : new String[] {new String(arg)};
}
protected static final Map<Integer, String> errorMessages;
static {
errorMessages = new HashMap<Integer, String>();
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_POUND_ERROR),
+ errorMessages.put(new Integer(PREPROCESSOR_POUND_ERROR),
ParserMessages.getString("ScannerProblemFactory.error.preproc.error")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_POUND_WARNING),
+ errorMessages.put(new Integer(PREPROCESSOR_POUND_WARNING),
ParserMessages.getString("ScannerProblemFactory.error.preproc.warning")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_INCLUSION_NOT_FOUND),
+ errorMessages.put(new Integer(PREPROCESSOR_INCLUSION_NOT_FOUND),
ParserMessages.getString("ScannerProblemFactory.error.preproc.inclusionNotFound")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_DEFINITION_NOT_FOUND),
+ errorMessages.put(new Integer(PREPROCESSOR_DEFINITION_NOT_FOUND),
ParserMessages.getString("ScannerProblemFactory.error.preproc.definitionNotFound")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_INVALID_MACRO_DEFN),
+ errorMessages.put(new Integer(PREPROCESSOR_INVALID_MACRO_DEFN),
ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroDefn")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_INVALID_MACRO_REDEFN),
+ errorMessages.put(new Integer(PREPROCESSOR_INVALID_MACRO_REDEFN),
ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroRedefn")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_UNBALANCE_CONDITION),
+ errorMessages.put(new Integer(PREPROCESSOR_UNBALANCE_CONDITION),
ParserMessages.getString("ScannerProblemFactory.error.preproc.unbalancedConditional")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR),
+ errorMessages.put(new Integer(PREPROCESSOR_CONDITIONAL_EVAL_ERROR),
ParserMessages.getString("ScannerProblemFactory.error.preproc.conditionalEval")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_MACRO_USAGE_ERROR),
+ errorMessages.put(new Integer(PREPROCESSOR_MACRO_USAGE_ERROR),
ParserMessages.getString("ScannerProblemFactory.error.preproc.macroUsage")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_CIRCULAR_INCLUSION),
+ errorMessages.put(new Integer(PREPROCESSOR_CIRCULAR_INCLUSION),
ParserMessages.getString("ScannerProblemFactory.error.preproc.circularInclusion")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_INVALID_DIRECTIVE),
+ errorMessages.put(new Integer(PREPROCESSOR_INVALID_DIRECTIVE),
ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidDirective")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_MACRO_PASTING_ERROR),
+ errorMessages.put(new Integer(PREPROCESSOR_MACRO_PASTING_ERROR),
ParserMessages.getString("ScannerProblemFactory.error.preproc.macroPasting")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_MISSING_RPAREN_PARMLIST),
+ errorMessages.put(new Integer(PREPROCESSOR_MISSING_RPAREN_PARMLIST),
ParserMessages.getString("ScannerProblemFactory.error.preproc.missingRParen")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.PREPROCESSOR_INVALID_VA_ARGS),
+ errorMessages.put(new Integer(PREPROCESSOR_INVALID_VA_ARGS),
ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidVaArgs")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_INVALID_ESCAPECHAR),
+ errorMessages.put(new Integer(SCANNER_INVALID_ESCAPECHAR),
ParserMessages.getString("ScannerProblemFactory.error.scanner.invalidEscapeChar")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_UNBOUNDED_STRING),
+ errorMessages.put(new Integer(SCANNER_UNBOUNDED_STRING),
ParserMessages.getString("ScannerProblemFactory.error.scanner.unboundedString")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_FLOATING_POINT),
+ errorMessages.put(new Integer(SCANNER_BAD_FLOATING_POINT),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badFloatingPoint")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_HEX_FORMAT),
+ errorMessages.put(new Integer(SCANNER_BAD_HEX_FORMAT),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badHexFormat")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_OCTAL_FORMAT),
+ errorMessages.put(new Integer(SCANNER_BAD_OCTAL_FORMAT),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badOctalFormat")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_DECIMAL_FORMAT),
+ errorMessages.put(new Integer(SCANNER_BAD_DECIMAL_FORMAT),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badDecimalFormat")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_ASSIGNMENT_NOT_ALLOWED),
+ errorMessages.put(new Integer(SCANNER_ASSIGNMENT_NOT_ALLOWED),
ParserMessages.getString("ScannerProblemFactory.error.scanner.assignmentNotAllowed")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_DIVIDE_BY_ZERO),
+ errorMessages.put(new Integer(SCANNER_DIVIDE_BY_ZERO),
ParserMessages.getString("ScannerProblemFactory.error.scanner.divideByZero")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_MISSING_R_PAREN),
+ errorMessages.put(new Integer(SCANNER_MISSING_R_PAREN),
ParserMessages.getString("ScannerProblemFactory.error.scanner.missingRParen")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_EXPRESSION_SYNTAX_ERROR),
+ errorMessages.put(new Integer(SCANNER_EXPRESSION_SYNTAX_ERROR),
ParserMessages.getString("ScannerProblemFactory.error.scanner.expressionSyntaxError")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_ILLEGAL_IDENTIFIER),
+ errorMessages.put(new Integer(SCANNER_ILLEGAL_IDENTIFIER),
ParserMessages.getString("ScannerProblemFactory.error.scanner.illegalIdentifier")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_CONDITIONAL_EXPRESSION),
+ errorMessages.put(new Integer(SCANNER_BAD_CONDITIONAL_EXPRESSION),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badConditionalExpression")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_UNEXPECTED_EOF),
+ errorMessages.put(new Integer(SCANNER_UNEXPECTED_EOF),
ParserMessages.getString("ScannerProblemFactory.error.scanner.unexpectedEOF")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SCANNER_BAD_CHARACTER),
+ errorMessages.put(new Integer(SCANNER_BAD_CHARACTER),
ParserMessages.getString("ScannerProblemFactory.error.scanner.badCharacter")); //$NON-NLS-1$
- errorMessages.put(new Integer(IASTProblem.SYNTAX_ERROR),
+ errorMessages.put(new Integer(SYNTAX_ERROR),
ParserMessages.getString("ParserProblemFactory.error.syntax.syntaxError")); //$NON-NLS-1$
}
protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
+
+ /*
+ * @see org.eclipse.cdt.core.parser.IProblem#getOriginatingFileName()
+ */
+ public char[] getOriginatingFileName() {
+ return getContainingFilename().toCharArray();
+ }
+
+ /*
+ * @see org.eclipse.cdt.core.parser.IProblem#getSourceEnd()
+ */
+ public int getSourceEnd() {
+ final IASTFileLocation location= getFileLocation();
+ if (location != null) {
+ return location.getNodeOffset() + location.getNodeLength() - 1;
+ }
+ return -1;
+ }
+
+ /*
+ * @see org.eclipse.cdt.core.parser.IProblem#getSourceLineNumber()
+ */
+ public int getSourceLineNumber() {
+ final IASTFileLocation location= getFileLocation();
+ if (location != null) {
+ return location.getStartingLineNumber();
+ }
+ return -1;
+ }
+
+ /*
+ * @see org.eclipse.cdt.core.parser.IProblem#getSourceStart()
+ */
+ public int getSourceStart() {
+ final IASTFileLocation location= getFileLocation();
+ if (location != null) {
+ return location.getNodeOffset();
+ }
+ return -1;
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
index ead967abe83..b99ec621b60 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/AbstractGNUSourceCodeParser.java
@@ -67,6 +67,7 @@ import org.eclipse.cdt.core.parser.AbstractParserLogService;
import org.eclipse.cdt.core.parser.EndOfFileException;
import org.eclipse.cdt.core.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IParserLogService;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.OffsetLimitReachedException;
@@ -343,7 +344,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
IASTProblem result = null;
if (bt.getProblem() == null)
- result = createProblem(IASTProblem.SYNTAX_ERROR, bt.getOffset(), bt
+ result = createProblem(IProblem.SYNTAX_ERROR, bt.getOffset(), bt
.getLength());
else
result = bt.getProblem();
@@ -383,7 +384,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
}
}
- public String toString() {
+ @Override
+ public String toString() {
return scanner.toString();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
index f37c6d5b76a..d389f23603b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/GNUCSourceParser.java
@@ -101,6 +101,7 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.EndOfFileException;
import org.eclipse.cdt.core.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IParserLogService;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserMode;
@@ -2451,7 +2452,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
}
private IASTProblemDeclaration createKnRCProblemDeclaration(int length, int offset) throws EndOfFileException {
- IASTProblem p = createProblem(IASTProblem.SYNTAX_ERROR, offset, length);
+ IASTProblem p = createProblem(IProblem.SYNTAX_ERROR, offset, length);
IASTProblemDeclaration pd = createProblemDeclaration();
pd.setProblem(p);
((ASTNode) pd).setOffsetAndLength(((ASTNode) p).getOffset(), ((ASTNode) p).getLength());
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
index 9d96d36b5da..09af7466058 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
@@ -134,6 +134,7 @@ import org.eclipse.cdt.core.index.IIndex;
import org.eclipse.cdt.core.parser.EndOfFileException;
import org.eclipse.cdt.core.parser.IGCCToken;
import org.eclipse.cdt.core.parser.IParserLogService;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
@@ -3721,7 +3722,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
if (typeId != null) {
exceptionSpecIds.add(typeId);
} else {
- IASTProblem p = createProblem(IASTProblem.SYNTAX_ERROR,
+ IASTProblem p = createProblem(IProblem.SYNTAX_ERROR,
before.getOffset(), before.getLength());
IASTProblemTypeId typeIdProblem = createTypeIDProblem();
typeIdProblem.setProblem(p);
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java
deleted file mode 100644
index e72d8824171..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/BaseProblemFactory.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.problem;
-
-import org.eclipse.cdt.core.parser.IProblem;
-
-/**
- * @author jcamelon
- */
-public abstract class BaseProblemFactory {
- protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
-
- public IProblem createProblem(int id, int start, int end, int line, char[] file, String[] arg,
- boolean warn, boolean error) {
- return new Problem( id, start, end, line, file, arg, warn, error);
- }
-
- public boolean checkBitmask(int id, int bitmask) {
- return (id & bitmask) != 0;
- }
-
- protected IProblem createInternalProblem( int id, int start, int end, int line, char[] file, String[] arg,
- boolean warn, boolean error) {
- return createProblem(id, start, end, line, file, arg, warn, error);
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java
deleted file mode 100644
index 7a58fca1dbe..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/problem/Problem.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.problem;
-
-import java.text.MessageFormat;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.internal.core.parser.ParserMessages;
-
-/**
- * @author jcamelon
- */
-public class Problem implements IProblem {
- private final String[] arg;
- private final int id;
- private final int sourceStart;
- private final int sourceEnd;
- private final int lineNumber;
-
- private final boolean isError;
- private final boolean isWarning;
- private final char[] originatingFileName;
-
- private String message = null;
-
- public Problem(int id, int start, int end, int line, char[] file, String[] arg,
- boolean warn, boolean error) {
- this.id = id;
- this.sourceStart = start;
- this.sourceEnd = end;
- this.lineNumber = line;
- this.originatingFileName = file;
- this.arg = arg;
- this.isWarning = warn;
- this.isError = error;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getID()
- */
- public int getID() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getOriginatingFileName()
- */
- public char[] getOriginatingFileName() {
- return originatingFileName;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceEnd()
- */
- public int getSourceEnd() {
- return sourceEnd;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceLineNumber()
- */
- public int getSourceLineNumber() {
- return lineNumber;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getSourceStart()
- */
- public int getSourceStart() {
- return sourceStart;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#isError()
- */
- public boolean isError() {
- return isError;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#isWarning()
- */
- public boolean isWarning() {
- return isWarning;
- }
-
- protected static final Map<Integer, String> errorMessages;
- static {
- errorMessages = new HashMap<Integer, String>();
- errorMessages.put(IProblem.SEMANTIC_UNIQUE_NAME_PREDEFINED,
- ParserMessages.getString("ASTProblemFactory.error.semantic.uniqueNamePredefined")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_NAME_NOT_FOUND,
- ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotFound")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_NAME_NOT_PROVIDED,
- ParserMessages.getString("ASTProblemFactory.error.semantic.nameNotProvided")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_CONVERSION_TYPE ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.invalidConversionType")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_MALFORMED_EXPRESSION ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.malformedExpression")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_AMBIGUOUS_LOOKUP ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.ambiguousLookup")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_TYPE ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidType")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_CIRCULAR_INHERITANCE ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.circularInheritance")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_OVERLOAD ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidOverload")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_TEMPLATE ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidTemplate")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_USING ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidUsing")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_BAD_VISIBILITY ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.badVisibility")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_UNABLE_TO_RESOLVE_FUNCTION ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.unableToResolveFunction")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_TEMPLATE_ARGUMENT ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidTemplateArgument")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_INVALID_TEMPLATE_PARAMETER ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.invalidTemplateParameter")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_REDECLARED_TEMPLATE_PARAMETER ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.redeclaredTemplateParameter")); //$NON-NLS-1$
- errorMessages.put(IProblem.SEMANTIC_RECURSIVE_TEMPLATE_INSTANTIATION ,
- ParserMessages.getString("ASTProblemFactory.error.semantic.pst.recursiveTemplateInstantiation")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_POUND_ERROR,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.error")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_POUND_WARNING,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.warning")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.inclusionNotFound")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.definitionNotFound")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_INVALID_MACRO_DEFN,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroDefn")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidMacroRedefn")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_UNBALANCE_CONDITION,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.unbalancedConditional")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.conditionalEval")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_MACRO_USAGE_ERROR,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.macroUsage")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_CIRCULAR_INCLUSION,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.circularInclusion")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_INVALID_DIRECTIVE,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidDirective")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_MACRO_PASTING_ERROR,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.macroPasting")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_MISSING_RPAREN_PARMLIST,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.missingRParen")); //$NON-NLS-1$
- errorMessages.put(IProblem.PREPROCESSOR_INVALID_VA_ARGS,
- ParserMessages.getString("ScannerProblemFactory.error.preproc.invalidVaArgs")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_INVALID_ESCAPECHAR,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.invalidEscapeChar")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_UNBOUNDED_STRING,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.unboundedString")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_FLOATING_POINT,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badFloatingPoint")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_HEX_FORMAT,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badHexFormat")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_OCTAL_FORMAT,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badOctalFormat")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_DECIMAL_FORMAT,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badDecimalFormat")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_ASSIGNMENT_NOT_ALLOWED,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.assignmentNotAllowed")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_DIVIDE_BY_ZERO,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.divideByZero")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_MISSING_R_PAREN,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.missingRParen")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_EXPRESSION_SYNTAX_ERROR,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.expressionSyntaxError")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_ILLEGAL_IDENTIFIER,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.illegalIdentifier")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_CONDITIONAL_EXPRESSION,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badConditionalExpression")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_UNEXPECTED_EOF,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.unexpectedEOF")); //$NON-NLS-1$
- errorMessages.put(IProblem.SCANNER_BAD_CHARACTER,
- ParserMessages.getString("ScannerProblemFactory.error.scanner.badCharacter")); //$NON-NLS-1$
- errorMessages.put(IProblem.SYNTAX_ERROR,
- ParserMessages.getString("ParserProblemFactory.error.syntax.syntaxError")); //$NON-NLS-1$
- }
- protected final static String PROBLEM_PATTERN = "BaseProblemFactory.problemPattern"; //$NON-NLS-1$
-
- public String getMessage() {
- if (message != null)
- return message;
-
- String msg = errorMessages.get(id);
- if (msg == null)
- msg = ""; //$NON-NLS-1$
-
- if (arg != null) {
- msg = MessageFormat.format(msg, (Object[]) arg);
- }
-
- String[] args = null;
- if (originatingFileName != null) {
- args = new String[] { msg, new String(originatingFileName), String.valueOf(lineNumber) };
- } else {
- args = new String[] { msg, "", String.valueOf(lineNumber) }; //$NON-NLS-1$
- }
-
- message = ParserMessages.getFormattedString(PROBLEM_PATTERN, args);
- return message;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#checkCategory(int)
- */
- public boolean checkCategory(int bitmask) {
- return (id & bitmask) != 0;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.IProblem#getArguments()
- */
- public String[] getArguments() {
- return arg;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java
deleted file mode 100644
index e4dd39f1e4b..00000000000
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/scanner/ScannerProblemFactory.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
- * Anton Leherbauer (Wind River Systems)
- *******************************************************************************/
-package org.eclipse.cdt.internal.core.parser.scanner;
-
-import org.eclipse.cdt.core.parser.IProblem;
-import org.eclipse.cdt.internal.core.parser.problem.BaseProblemFactory;
-import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
-
-/**
- * @author jcamelon
- *
- */
-public class ScannerProblemFactory extends BaseProblemFactory implements IProblemFactory
-{
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IProblemFactory#createProblem(int, int, int, int, char[], java.lang.String, boolean, boolean)
- */
- public IProblem createProblem(int id, int start, int end, int line, char[] file, String[] arg,
- boolean warn, boolean error) {
- if (checkBitmask(id, IProblem.INTERNAL_RELATED))
- return createInternalProblem(id, start, end, line, file, arg, warn, error);
-
- if (checkBitmask(id, IProblem.SCANNER_RELATED) ||
- checkBitmask(id, IProblem.PREPROCESSOR_RELATED)) {
- return super.createProblem(id, start, end, line, file, arg, warn, error);
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.IProblemFactory#getRequiredAttributesForId(int)
- */
- public String getRequiredAttributesForId(int id)
- {
- switch (id)
- {
- case IProblem.PREPROCESSOR_POUND_ERROR :
- return IProblem.A_PREPROC_POUND_ERROR;
- case IProblem.PREPROCESSOR_POUND_WARNING :
- return IProblem.A_PREPROC_POUND_WARNING;
- case IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND :
- return IProblem.A_PREPROC_INCLUDE_FILENAME;
- case IProblem.PREPROCESSOR_DEFINITION_NOT_FOUND :
- return IProblem.A_PREPROC_MACRO_NAME;
- case IProblem.PREPROCESSOR_UNBALANCE_CONDITION :
- return IProblem.A_PREPROC_CONDITIONAL_MISMATCH;
- case IProblem.PREPROCESSOR_INVALID_MACRO_DEFN :
- return IProblem.A_PREPROC_MACRO_NAME;
- case IProblem.PREPROCESSOR_INVALID_DIRECTIVE :
- return IProblem.A_PREPROC_UNKNOWN_DIRECTIVE;
- case IProblem.PREPROCESSOR_INVALID_MACRO_REDEFN :
- return IProblem.A_PREPROC_MACRO_NAME;
- case IProblem.PREPROCESSOR_CONDITIONAL_EVAL_ERROR :
- return IProblem.A_PREPROC_CONDITION;
- case IProblem.PREPROCESSOR_MACRO_USAGE_ERROR :
- return IProblem.A_PREPROC_MACRO_NAME;
- case IProblem.PREPROCESSOR_MACRO_PASTING_ERROR :
- return IProblem.A_PREPROC_MACRO_NAME;
- case IProblem.PREPROCESSOR_CIRCULAR_INCLUSION :
- return IProblem.A_PREPROC_INCLUDE_FILENAME;
- case IProblem.SCANNER_BAD_CHARACTER :
- return IProblem.A_SCANNER_BADCHAR;
- case IProblem.SCANNER_UNBOUNDED_STRING :
- case IProblem.SCANNER_INVALID_ESCAPECHAR :
- case IProblem.SCANNER_BAD_FLOATING_POINT :
- case IProblem.SCANNER_BAD_HEX_FORMAT :
- case IProblem.SCANNER_UNEXPECTED_EOF :
- break;
- }
- return null;
- }
-}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/TraceUtil.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/TraceUtil.java
index 5f98e821b2f..684dff1acd1 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/TraceUtil.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/util/TraceUtil.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ public class TraceUtil {
if( log.isTracing() ) {
StringBuffer buffer = new StringBuffer();
if( preface != null ) buffer.append( preface );
- if( problem != null ) buffer.append( problem.getMessage());
+ if( problem != null ) buffer.append( problem.getMessageWithLocation());
if( first != null ) buffer.append( first );
if( second != null ) buffer.append( second );
if( third != null ) buffer.append( third );
@@ -33,7 +33,7 @@ public class TraceUtil {
if( log.isTracing() ) {
StringBuffer buffer = new StringBuffer();
if( preface != null ) buffer.append( preface );
- if( problem != null ) buffer.append( problem.getMessage());
+ if( problem != null ) buffer.append( problem.getMessageWithLocation());
log.traceLog( buffer.toString() );
}
}
@@ -41,7 +41,7 @@ public class TraceUtil {
if( log.isTracing() ) {
StringBuffer buffer = new StringBuffer();
if( preface != null ) buffer.append( preface );
- if( problem != null ) buffer.append( problem.getMessage());
+ if( problem != null ) buffer.append( problem.getMessageWithLocation());
if( first != null ) buffer.append( first );
if( second != null ) buffer.append( second );
if( third != null ) buffer.append( third );
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java
index 111f690ff16..e5c195c6767 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMWriter.java
@@ -42,6 +42,7 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespaceAlias;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
import org.eclipse.cdt.core.index.IIndexFile;
import org.eclipse.cdt.core.index.IIndexFileLocation;
+import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.internal.core.dom.parser.ASTInternal;
import org.eclipse.cdt.internal.core.index.IIndexFragmentFile;
import org.eclipse.cdt.internal.core.index.IWritableIndex;
@@ -343,7 +344,7 @@ abstract public class PDOMWriter {
final boolean reportAll= fShowScannerProblems && fShowInclusionProblems;
IASTProblem[] scannerProblems= ast.getPreprocessorProblems();
for (IASTProblem problem : scannerProblems) {
- if (reportAll || (problem.getID() == IASTProblem.PREPROCESSOR_INCLUSION_NOT_FOUND) == fShowInclusionProblems) {
+ if (reportAll || (problem.getID() == IProblem.PREPROCESSOR_INCLUSION_NOT_FOUND) == fShowInclusionProblems) {
reportProblem(problem);
}
}
@@ -492,7 +493,7 @@ abstract public class PDOMWriter {
}
private void reportProblem(IASTProblem problem) {
- String msg= "Indexer: " + problem.getMessage(); //$NON-NLS-1$
+ String msg= "Indexer: " + problem.getMessageWithLocation(); //$NON-NLS-1$
System.out.println(msg);
}

Back to the top