Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Overbey2012-02-27 20:43:20 +0000
committerJeffrey Overbey2012-02-27 20:43:20 +0000
commitd275eb57d8fd7494b8d0584bd94c443f5ebae409 (patch)
tree919a10e3e02955cf2a3d62a66a4bcb345775d41d /org.eclipse.photran.cdtinterface
parentc530fbb91d6bbc4f1330f1b716601adb3b378059 (diff)
downloadorg.eclipse.photran-d275eb57d8fd7494b8d0584bd94c443f5ebae409.tar.gz
org.eclipse.photran-d275eb57d8fd7494b8d0584bd94c443f5ebae409.tar.xz
org.eclipse.photran-d275eb57d8fd7494b8d0584bd94c443f5ebae409.zip
Updated Cray error parser to recognize loopmark feedback
Diffstat (limited to 'org.eclipse.photran.cdtinterface')
-rw-r--r--org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/CrayErrorParser.java34
1 files changed, 27 insertions, 7 deletions
diff --git a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/CrayErrorParser.java b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/CrayErrorParser.java
index 1c94a19e..5acb48af 100644
--- a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/CrayErrorParser.java
+++ b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/CrayErrorParser.java
@@ -10,6 +10,7 @@
package org.eclipse.photran.internal.cdtinterface.errorparsers;
import static org.eclipse.cdt.core.IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
+import static org.eclipse.cdt.core.IMarkerGenerator.SEVERITY_INFO;
import static org.eclipse.cdt.core.IMarkerGenerator.SEVERITY_WARNING;
import java.util.regex.Matcher;
@@ -32,25 +33,34 @@ import org.eclipse.core.resources.IFile;
* ftn-967 crayftn: LIMIT $MAIN, File = file_does_not_exist.f90, Line = 1
* The compiler is unable to open file "file_does_not_exist.f90".
* </pre>
+ * <p>
+ * It can also recognize informational messages from loopmark listings, such as the following:
+ * <pre>
+ * ftn-6005 ftn: SCALAR File = test1.f90, Line = 7
+ * A loop starting at line 7 was unrolled 4 times.
+ *
+ * ftn-6204 ftn: VECTOR File = test1.f90, Line = 7
+ * A loop starting at line 7 was vectorized.
+ * </pre>
*
* @author Jeff Overbey
*/
public class CrayErrorParser implements IErrorParser {
private static final Pattern F_ERROR_WARNING_LINE = Pattern.compile( //
- // Capture Group 1------2-------3------------------------4------------5-------6-----------7
- "^ftn-[0-9]+ cray(ftn): ([A-Z]+)( [A-Za-z0-9$_]+, File = (.*), Line = ([0-9]+)(, Column = ([0-9]+))?|.*)?[ \t]*$"); //$NON-NLS-1$
+ // Group ----1------2------3-------4--------------------------5------------6-------7-----------8
+ "^ftn-[0-9]+ (cray)?(ftn): ([A-Z]+)( ?[A-Za-z0-9$_]*,? File = (.*), Line = ([0-9]+)(, Column = ([0-9]+))?|.*)?[ \t]*$"); //$NON-NLS-1$
// Capture groups in the above regexes
- private static final int SEVERITY_GROUP = 2;
- private static final int FILENAME_GROUP = 4;
- private static final int LINE_NUMBER_GROUP = 5;
+ private static final int SEVERITY_GROUP = 3;
+ private static final int FILENAME_GROUP = 5;
+ private static final int LINE_NUMBER_GROUP = 6;
@Override
public boolean processLine(String currentLine, ErrorParserManager eoParser) {
final Matcher matcher = matchErrorWarningLine(eoParser.getPreviousLine());
if (matcher != null) {
- final int severity = matcher.group(SEVERITY_GROUP).equals("WARNING") ? SEVERITY_WARNING : SEVERITY_ERROR_RESOURCE; //$NON-NLS-1$
+ final int severity = determineSeverity(matcher.group(SEVERITY_GROUP));
final String filename = matcher.group(FILENAME_GROUP);
final IFile file = filename == null ? null : eoParser.findFileName(filename);
final int lineNumber = atoi(matcher.group(LINE_NUMBER_GROUP));
@@ -64,7 +74,7 @@ public class CrayErrorParser implements IErrorParser {
}
}
- private Matcher matchErrorWarningLine(String previousLine) {
+ private Matcher matchErrorWarningLine(String previousLine) {
if (previousLine != null) {
Matcher m = F_ERROR_WARNING_LINE.matcher(previousLine);
if (m.matches()) {
@@ -75,6 +85,16 @@ public class CrayErrorParser implements IErrorParser {
return null;
}
+ private int determineSeverity(String text) {
+ if (text.equals("WARNING")) { //$NON-NLS-1$
+ return SEVERITY_WARNING;
+ } else if (text.equals("SCALAR") || text.equals("VECTOR") || text.equals("ACCEL")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ return SEVERITY_INFO;
+ } else {
+ return SEVERITY_ERROR_RESOURCE;
+ }
+ }
+
private int atoi(String string) {
if (string == null) {
return 0;

Back to the top