Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Watson2012-08-06 12:59:23 +0000
committerGreg Watson2012-08-06 12:59:23 +0000
commitd7c4c9a87227570991ba8c47f9779a3570e34dc6 (patch)
treeedbe3ed9e26e8e8228cc5400f44ecdfe036b4a54
parent3c1cc15b6ecbda9931c7d154406dfb4ebd7a9366 (diff)
downloadorg.eclipse.photran-d7c4c9a87227570991ba8c47f9779a3570e34dc6.tar.gz
org.eclipse.photran-d7c4c9a87227570991ba8c47f9779a3570e34dc6.tar.xz
org.eclipse.photran-d7c4c9a87227570991ba8c47f9779a3570e34dc6.zip
Fix error parser when -qsource option used. See bug 386572. Also, switch
to using RegexErrorParser.
-rwxr-xr-xorg.eclipse.photran.core.xlf/plugin.properties14
-rwxr-xr-xorg.eclipse.photran.core.xlf/plugin.xml20
-rwxr-xr-xorg.eclipse.photran.core.xlf/src/org/eclipse/photran/internal/core/xlf/XLFCompilerErrorParser.java246
3 files changed, 23 insertions, 257 deletions
diff --git a/org.eclipse.photran.core.xlf/plugin.properties b/org.eclipse.photran.core.xlf/plugin.properties
index ce2e0844..9cd60f3f 100755
--- a/org.eclipse.photran.core.xlf/plugin.properties
+++ b/org.eclipse.photran.core.xlf/plugin.properties
@@ -1,4 +1,16 @@
pluginName=Photran XLF Error Parser Plug-in
providerName=Eclipse.org
-XLFErrorParser.name=Photran Error Parser for IBM XL Fortran \ No newline at end of file
+XLFErrorParser.name=Photran Error Parser for IBM XL Fortran
+
+# Translators: do not translate patterns below. We currently do not support NL versions of the XL C/C++ compilers.
+# Following are patterns of xlC compiler messages. While translating the patterns should be replaced
+# with corresponding patterns matching localized compiler messages
+
+# START NON-TRANSLATABLE
+# "<filename>", line <lineno>.<column>: 15<CC>-<NNN> (<S>) <description>
+# "<filename>", line <lineno>.<column>: 15<CC>-<NNN> <description>
+XLFErrorParser.pattern.error=[^"]*"([^"]*)", (line )?([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\([USE]\\)\\s*(.*)
+XLFErrorParser.pattern.warning=[^"]*"([^"]*)", (line )?([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(WL\\)\\s*(.*)
+XLFErrorParser.pattern.info=[^"]*"([^"]*)", (line )?([0-9]+)\\.[0-9]+:( [0-9]*-[0-9]*)? \\(I\\)\\s*(.*)
+# END NON-TRANSLATABLE \ No newline at end of file
diff --git a/org.eclipse.photran.core.xlf/plugin.xml b/org.eclipse.photran.core.xlf/plugin.xml
index 002a1b4a..edf20c48 100755
--- a/org.eclipse.photran.core.xlf/plugin.xml
+++ b/org.eclipse.photran.core.xlf/plugin.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
- <!-- This was originally in a plug-in named org.eclipse.photran.errorparsers.xlf,
- so that qualifier has been retained for backward compatibility -->
- <extension
- id="org.eclipse.photran.errorparsers.xlf.XLFCompilerErrorParser"
- name="%XLFErrorParser.name"
- point="org.eclipse.cdt.core.ErrorParser">
- <errorparser
- class="org.eclipse.photran.internal.core.xlf.XLFCompilerErrorParser">
- </errorparser>
- </extension>
+ <extension id="XlfErrorParser" name="%XLFErrorParser.name" point="org.eclipse.cdt.core.ErrorParser">
+ <errorparser
+ class="org.eclipse.cdt.core.errorparsers.RegexErrorParser"
+ id="org.eclipse.photran.errorparsers.xlf.XLFCompilerErrorParser"
+ name="%XLFErrorParser.name">
+ <pattern regex="%XLFErrorParser.pattern.error" severity="Error" file-expr="$1" line-expr="$3" description-expr="$5" eat-processed-line="true"/>
+ <pattern regex="%XLFErrorParser.pattern.warning" severity="Warning" file-expr="$1" line-expr="$3" description-expr="$5" eat-processed-line="true"/>
+ <pattern regex="%XLFErrorParser.pattern.info" severity="Info" file-expr="$1" line-expr="$3" description-expr="$5" eat-processed-line="true"/>
+ </errorparser>
+ </extension>
</plugin>
diff --git a/org.eclipse.photran.core.xlf/src/org/eclipse/photran/internal/core/xlf/XLFCompilerErrorParser.java b/org.eclipse.photran.core.xlf/src/org/eclipse/photran/internal/core/xlf/XLFCompilerErrorParser.java
deleted file mode 100755
index 3160b9fd..00000000
--- a/org.eclipse.photran.core.xlf/src/org/eclipse/photran/internal/core/xlf/XLFCompilerErrorParser.java
+++ /dev/null
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 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 Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.photran.internal.core.xlf;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.cdt.core.ErrorParserManager;
-import org.eclipse.cdt.core.IErrorParser;
-import org.eclipse.cdt.core.IMarkerGenerator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-
-/**
- * Error parser for the IBM XLF compiler
- *
- * @author Craig Rasmussen
- */
-public class XLFCompilerErrorParser implements IErrorParser
-{
- Pattern p1 = Pattern.compile("^\"([^\"]*)\", line (\\d+)\\.(\\d+): (\\d+)-(\\d+) \\(([USEWLI])\\) (.*)$"); //$NON-NLS-1$
- Pattern p2 = Pattern.compile("^\"([^\"]*)\", (\\d+)-(\\d+) \\(([USEWLI])\\) (.*)$"); //$NON-NLS-1$
- private String fileName;
- private String lineNum;
- private String level;
- private String message;
- private int num;
-
- public XLFCompilerErrorParser()
- {
- fileName = null;
- lineNum = null;
- level = "S"; //$NON-NLS-1$
- message = null;
- num = -1;
- }
-
- /**
- * This function returns the file name extracted from
- * the error message.
- * @return The string value of the given file name.
- */
- public String getFileName()
- {
- return fileName;
- }
-
- /**
- * This function returns the line number of
- * the error.
- * @return The integer value of the line number.
- */
-
- public int getLineNumber()
- {
- return num;
- }
-
- /**
- * This function returns the severity of the
- * error that has occured.
- * @return The string value of the severity.
- */
- public String getSeverity()
- {
- return level;
- }
-
- /**
- * This function returns the descriptive string of the
- * error that has occured.
- * @return The string value of the message.
- */
- public String getMessage()
- {
- return message;
- }
-
- /**
- * This function parses the error message occured and fills the
- * class variables fileName, lineNum, message, level( severity ).
- * @param line is the error message generated by the xlF compiler.
- * @return a boolean value indicating the success/failure of
- * extracting the values for fileName, lineNum, message, level.
- */
-
- public boolean parseLine(String line)
- {
- String desc = null;
- Matcher m = p1.matcher(line);
- if (m.matches())
- {
- fileName = m.group(1);
- lineNum = m.group(2);
- m.group(3);
- m.group(4);
- m.group(5);
- level = m.group(6);
- desc = m.group(7);
- message = desc;
- try
- {
- num = Integer.parseInt(lineNum);
- }
- catch (NumberFormatException e)
- {
- throw e;
- }
- }
- else
- {
- m = p2.matcher(line);
- if (m.matches())
- {
- fileName = m.group(1);
- m.group(2);
- m.group(3);
- level = m.group(4);
- desc = m.group(5);
- message = desc;
- }
- else
- {
- return false;
- }
- }
- return true;
- }
-
-
-
-
- public boolean processLine(String line, ErrorParserManager eoParser) {
- return processLine(line, eoParser, IMarkerGenerator.SEVERITY_ERROR_RESOURCE);
- }
-
- public boolean processLine(String line, ErrorParserManager eoParser, int inheritedSeverity) {
- // XLF error messsage format:
- //
- // "<filename>", line <lineno>.<column>: 15<CC>-<NNN> (<S>) <description>
- // "<filename>", line <lineno>.<column>: 15<CC>-<NNN> <description>
- //
- // <CC> is one of:
- // 00 : Indicates a code generation or optimization message.
- // 01 : Indicates an XL Fortran common message.
- // 11-20 : Indicates a Fortran-specific message.
- // 25 : Indicates a run-time message from an XL Fortran application program.
- // 85 : Indicates a loop-transformation message.
- // 86 : Indicates an interprocedural analysis (IPA) message.
- //
- // <NNN> is the message number
- //
- // <S> is one of:
- // U : An unrecoverable error.
- // S : A severe error.
- // E : An error that the compiler can correct.
- // W : Warning message.
- // L : Language conformance warning message.
- // I : Informational message.
-
- if( parseLine(line) == false )
- {
- return false;
- }
- if (!Path.EMPTY.isValidPath(fileName)) { return false; }
-
- IFile file = eoParser.findFileName(fileName);
- if (file != null)
- {
- if (eoParser.isConflictingName(fileName))
- {
- message = "[Conflicting names: " + fileName + " ] " + message; //$NON-NLS-1$ //$NON-NLS-2$
- file = null;
- }
- }
- else
- {
- file = eoParser.findFilePath(fileName);
- if (file == null)
- {
- // one last try before bailing out we may be in a wrong
- // directory. This will happen, for example in the Makefile:
- // all: foo.c
- // cd src3; gcc -c bar/foo.c
- // the user do a cd(1).
- IPath path = new Path(fileName);
- if (path.segmentCount() > 1)
- {
- String name = path.lastSegment();
- file = eoParser.findFileName(fileName);
- if (file != null)
- {
- if (eoParser.isConflictingName(fileName))
- {
- message = "[Conflicting names: " + name + " ] " + message; //$NON-NLS-1$ //$NON-NLS-2$
- file = null;
- }
- }
- }
- }
- }
-
- // Display the fileName.
- if (file == null)
- {
- message = message + " [" + fileName + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- int severity = extractSeverity(level, inheritedSeverity);
-
- eoParser.generateMarker(file, num, message, severity, null);
- return true;
- }
-
- private int extractSeverity(String desc, int defaultSeverity)
- {
- int severity = defaultSeverity;
-
- if (desc.equals("U") || desc.equals("S") ) //$NON-NLS-1$ //$NON-NLS-2$
- {
- severity = IMarkerGenerator.SEVERITY_ERROR_BUILD;
- }
- else if (desc.equals("E")) //$NON-NLS-1$
- {
- severity = IMarkerGenerator.SEVERITY_ERROR_RESOURCE;
- }
- else if (desc.equals("W") || desc.equals("L") ) //$NON-NLS-1$ //$NON-NLS-2$
- {
- severity = IMarkerGenerator.SEVERITY_WARNING;
- }
- else if (desc.equals("I")) //$NON-NLS-1$
- {
- severity = IMarkerGenerator.SEVERITY_INFO;
- }
- return severity;
- }
-}

Back to the top