Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlena Laskavaia2008-08-18 14:13:35 +0000
committerAlena Laskavaia2008-08-18 14:13:35 +0000
commit8e64dbaaa53392df30aa7d0f55e51294d8971ea4 (patch)
tree176aaeb8406aab530a8caa5558951db9a32fb3be
parentc1438bceb5793ff7d338224649421967502d71b4 (diff)
downloadorg.eclipse.cdt-8e64dbaaa53392df30aa7d0f55e51294d8971ea4.tar.gz
org.eclipse.cdt-8e64dbaaa53392df30aa7d0f55e51294d8971ea4.tar.xz
org.eclipse.cdt-8e64dbaaa53392df30aa7d0f55e51294d8971ea4.zip
PR: 215492 - moved to external package
-rw-r--r--core/org.eclipse.cdt.core/META-INF/MANIFEST.MF1
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/AbstractErrorParser.java40
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java174
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java25
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java164
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java2
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java2
9 files changed, 240 insertions, 172 deletions
diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index 224e3416112..c785d94a4bc 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@ Export-Package: org.eclipse.cdt.core,
org.eclipse.cdt.core.dom.parser.cpp,
org.eclipse.cdt.core.dom.rewrite,
org.eclipse.cdt.core.envvar,
+ org.eclipse.cdt.core.errorparsers,
org.eclipse.cdt.core.formatter,
org.eclipse.cdt.core.index,
org.eclipse.cdt.core.index.export,
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/AbstractErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/AbstractErrorParser.java
new file mode 100644
index 00000000000..113785e76d5
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/AbstractErrorParser.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 QNX Software Systems 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:
+ * QNX - initial API and implementation, @author Doug Schaefer
+ * Warren Paul (Nokia) - Bug 178124, have processLine return true if processed.
+ *******************************************************************************/
+
+package org.eclipse.cdt.core.errorparsers;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.core.IErrorParser;
+
+/**
+ * Abstract Error Parser that implements simple line processing using patterns array
+ */
+public class AbstractErrorParser implements IErrorParser {
+
+ private ErrorPattern[] patterns;
+
+ protected AbstractErrorParser(ErrorPattern[] patterns) {
+ this.patterns = patterns;
+ }
+
+ /**
+ * @param line - line of the input
+ * @param epManager - error parsers manager
+ * @return true if error parser recognized and accepted line, false otherwise
+ */
+ public boolean processLine(String line, ErrorParserManager epManager) {
+ for (int i = 0; i < patterns.length; ++i)
+ if (patterns[i].processLine(line, epManager))
+ return true;
+ return false;
+ }
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java
new file mode 100644
index 00000000000..eb970da9814
--- /dev/null
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/errorparsers/ErrorPattern.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2007 QNX Software Systems 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:
+ * QNX - initial API and implementation, @author Doug Schaefer
+ *******************************************************************************/
+
+package org.eclipse.cdt.core.errorparsers;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.cdt.core.ErrorParserManager;
+import org.eclipse.cdt.utils.CygPath;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+
+/**
+ * Error Pattern - used by Error Parser to convert build output to problem markers
+ */
+public class ErrorPattern {
+ private final Pattern pattern;
+ private final int groupFileName;
+ private final int groupLineNum;
+ private final int groupDesc;
+ private final int groupVarName;
+ private final int severity;
+
+ /**
+ * Full Pattern Constructor.
+ *
+ * @param pattern
+ * @param groupFileName
+ * @param groupLineNum
+ * @param groupDesc
+ * @param groupVarName
+ * @param severity
+ */
+ public ErrorPattern(String pattern,
+ int groupFileName,
+ int groupLineNum,
+ int groupDesc,
+ int groupVarName,
+ int severity) {
+ this.pattern = Pattern.compile(pattern);
+ this.groupFileName = groupFileName;
+ this.groupLineNum = groupLineNum;
+ this.groupDesc = groupDesc;
+ this.groupVarName = groupVarName;
+ this.severity = severity;
+ }
+
+ /**
+ * Pattern for errors not associated file a file
+ * (e.g. make and linker errors).
+ *
+ * @param pattern
+ * @param groupDesc
+ * @param severity
+ */
+ public ErrorPattern(String pattern, int groupDesc, int severity) {
+ this(pattern, 0, 0, groupDesc, 0, severity);
+ }
+
+ /**
+ * Pattern for errors that should be skipped.
+ *
+ * @param pattern
+ */
+ public ErrorPattern(String pattern) {
+ this(pattern, 0, 0, 0, 0, -1);
+ }
+ public Matcher getMatcher(CharSequence input) {
+ return pattern.matcher(input);
+ }
+
+ public String getFileName(Matcher matcher) {
+ return groupFileName != 0 ? matcher.group(groupFileName) : null;
+ }
+
+ public int getLineNum(Matcher matcher) {
+ try {
+ return groupLineNum != 0
+ ? Integer.valueOf(matcher.group(groupLineNum)).intValue()
+ : 0;
+ } catch (NumberFormatException e) {
+ return 0;
+ }
+ }
+
+ public String getDesc(Matcher matcher) {
+ return groupDesc != 0 ? matcher.group(groupDesc) : null;
+ }
+
+ public String getVarName(Matcher matcher) {
+ return groupVarName != 0 ? matcher.group(groupVarName) : null;
+ }
+
+ public int getSeverity(Matcher matcher) {
+ return severity;
+ }
+
+ public boolean processLine(String line, ErrorParserManager eoParser) {
+ Matcher matcher = getMatcher(line);
+ if (!matcher.find())
+ return false;
+
+ return recordError(matcher, eoParser);
+ }
+
+ protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
+ int severity = getSeverity(matcher);
+ if (severity == -1)
+ // Skip
+ return true;
+
+ String fileName = getFileName(matcher);
+ int lineNum = getLineNum(matcher);
+ String desc = getDesc(matcher);
+ String varName = getVarName(matcher);
+ IPath externalPath = null ;
+
+ IResource file = null;
+ if (fileName != null) {
+ file = eoParser.findFileName(fileName);
+ if (file == null) {
+ file = eoParser.findFilePath(fileName);
+ }
+
+ if (file == null) {
+ // If the file is not found in the workspace we attach the problem to the project
+ // and add the external path to the file.
+ desc = fileName + " " + desc; //$NON-NLS-1$
+ file = eoParser.getProject();
+ externalPath = getLocation(fileName);
+ }
+ }
+
+ eoParser.generateExternalMarker(file, lineNum, desc, severity, varName, externalPath);
+ return true;
+ }
+
+ /**
+ * If the file designated by filename exists, return the IPath representation of the filename
+ * If it does not exist, try cygpath translation
+ */
+ protected IPath getLocation(String filename) {
+ IPath path = new Path(filename);
+ File file = path.toFile() ;
+ if (!file.exists()) {
+ CygPath cygpath = null ;
+ try {
+ cygpath = new CygPath("cygpath"); //$NON-NLS-1$
+ String cygfilename = cygpath.getFileName(filename);
+ path = new Path(cygfilename);
+ } catch (IOException e) {
+ }
+ finally {
+ if (null!=cygpath) {
+ cygpath.dispose();
+ }
+ }
+ }
+ return path ;
+ }
+
+}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java
index 5536478fd96..0d8475d5cd2 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/AbstractErrorParser.java
@@ -7,30 +7,19 @@
*
* Contributors:
* QNX - initial API and implementation
- * Warren Paul (Nokia) - Bug 178124, have processLine return true if processed.
*******************************************************************************/
-
package org.eclipse.cdt.internal.errorparsers;
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.IErrorParser;
+import org.eclipse.cdt.core.errorparsers.ErrorPattern;
/**
- * @author Doug Schaefer
- *
+ * @deprecated use org.eclipse.cdt.core.errorparsers.AbstractErrorParser
+ * this class is moved to public package
*/
-public class AbstractErrorParser implements IErrorParser {
-
- private ErrorPattern[] patterns;
-
+@Deprecated
+public class AbstractErrorParser extends org.eclipse.cdt.core.errorparsers.AbstractErrorParser{
protected AbstractErrorParser(ErrorPattern[] patterns) {
- this.patterns = patterns;
- }
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- for (int i = 0; i < patterns.length; ++i)
- if (patterns[i].processLine(line, eoParser))
- return true;
- return false;
+ super(patterns);
}
+
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java
index 688e93c1231..6085f06f2be 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/ErrorPattern.java
@@ -8,168 +8,24 @@
* Contributors:
* QNX - initial API and implementation
*******************************************************************************/
-
package org.eclipse.cdt.internal.errorparsers;
-import java.io.File;
-import java.io.IOException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.utils.CygPath;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
/**
- * @author Doug Schaefer
- *
+ * @deprecated use org.eclipse.cdt.core.errorparsers.ErrorPattern
+ * this class is moved to public package
*/
-public class ErrorPattern {
- private final Pattern pattern;
- private final int groupFileName;
- private final int groupLineNum;
- private final int groupDesc;
- private final int groupVarName;
- private final int severity;
-
- /**
- * Full Pattern Constructor.
- *
- * @param pattern
- * @param groupFileName
- * @param groupLineNum
- * @param groupDesc
- * @param groupVarName
- * @param severity
- */
- public ErrorPattern(String pattern,
- int groupFileName,
- int groupLineNum,
- int groupDesc,
- int groupVarName,
- int severity) {
- this.pattern = Pattern.compile(pattern);
- this.groupFileName = groupFileName;
- this.groupLineNum = groupLineNum;
- this.groupDesc = groupDesc;
- this.groupVarName = groupVarName;
- this.severity = severity;
+@Deprecated
+public class ErrorPattern extends org.eclipse.cdt.core.errorparsers.ErrorPattern {
+ public ErrorPattern(String pattern, int groupFileName, int groupLineNum, int groupDesc, int groupVarName,
+ int severity) {
+ super(pattern, groupFileName, groupLineNum, groupDesc, groupVarName, severity);
}
-
- /**
- * Pattern for errors not associated file a file
- * (e.g. make and linker errors).
- *
- * @param pattern
- * @param groupDesc
- * @param severity
- */
+
public ErrorPattern(String pattern, int groupDesc, int severity) {
- this(pattern, 0, 0, groupDesc, 0, severity);
+ super(pattern, groupDesc, severity);
}
- /**
- * Pattern for errors that should be skipped.
- *
- * @param pattern
- */
public ErrorPattern(String pattern) {
- this(pattern, 0, 0, 0, 0, -1);
- }
- public Matcher getMatcher(CharSequence input) {
- return pattern.matcher(input);
- }
-
- public String getFileName(Matcher matcher) {
- return groupFileName != 0 ? matcher.group(groupFileName) : null;
- }
-
- public int getLineNum(Matcher matcher) {
- try {
- return groupLineNum != 0
- ? Integer.valueOf(matcher.group(groupLineNum)).intValue()
- : 0;
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-
- public String getDesc(Matcher matcher) {
- return groupDesc != 0 ? matcher.group(groupDesc) : null;
+ super(pattern);
}
-
- public String getVarName(Matcher matcher) {
- return groupVarName != 0 ? matcher.group(groupVarName) : null;
- }
-
- public int getSeverity(Matcher matcher) {
- return severity;
- }
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- Matcher matcher = getMatcher(line);
- if (!matcher.find())
- return false;
-
- return recordError(matcher, eoParser);
- }
-
- protected boolean recordError(Matcher matcher, ErrorParserManager eoParser) {
- int severity = getSeverity(matcher);
- if (severity == -1)
- // Skip
- return true;
-
- String fileName = getFileName(matcher);
- int lineNum = getLineNum(matcher);
- String desc = getDesc(matcher);
- String varName = getVarName(matcher);
- IPath externalPath = null ;
-
- IResource file = null;
- if (fileName != null) {
- file = eoParser.findFileName(fileName);
- if (file == null) {
- file = eoParser.findFilePath(fileName);
- }
-
- if (file == null) {
- // If the file is not found in the workspace we attach the problem to the project
- // and add the external path to the file.
- desc = fileName + " " + desc; //$NON-NLS-1$
- file = eoParser.getProject();
- externalPath = getLocation(fileName);
- }
- }
-
- eoParser.generateExternalMarker(file, lineNum, desc, severity, varName, externalPath);
- return true;
- }
-
- /**
- * If the file designated by filename exists, return the IPath representation of the filename
- * If it does not exist, try cygpath translation
- */
- protected IPath getLocation(String filename) {
- IPath path = new Path(filename);
- File file = path.toFile() ;
- if (!file.exists()) {
- CygPath cygpath = null ;
- try {
- cygpath = new CygPath("cygpath"); //$NON-NLS-1$
- String cygfilename = cygpath.getFileName(filename);
- path = new Path(cygfilename);
- } catch (IOException e) {
- }
- finally {
- if (null!=cygpath) {
- cygpath.dispose();
- }
- }
- }
- return path ;
- }
-
}
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
index ee060a91de9..9150c036104 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GCCErrorParser.java
@@ -17,6 +17,8 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
+import org.eclipse.cdt.core.errorparsers.ErrorPattern;
public class GCCErrorParser extends AbstractErrorParser {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
index 5ffd9dfa436..69dd3560c07 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/GLDErrorParser.java
@@ -13,6 +13,8 @@
package org.eclipse.cdt.internal.errorparsers;
import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
+import org.eclipse.cdt.core.errorparsers.ErrorPattern;
public class GLDErrorParser extends AbstractErrorParser {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
index 4871c164d76..5e68b0bf710 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/MakeErrorParser.java
@@ -16,6 +16,8 @@ import java.util.regex.Matcher;
import org.eclipse.cdt.core.ErrorParserManager;
import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
+import org.eclipse.cdt.core.errorparsers.ErrorPattern;
import org.eclipse.core.runtime.Path;
public class MakeErrorParser extends AbstractErrorParser {
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
index 7c8f39bf56c..409e5081706 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/errorparsers/VCErrorParser.java
@@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.errorparsers;
import java.util.regex.Matcher;
import org.eclipse.cdt.core.IMarkerGenerator;
+import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
+import org.eclipse.cdt.core.errorparsers.ErrorPattern;
public class VCErrorParser extends AbstractErrorParser {

Back to the top