Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Overbey2011-11-28 21:36:51 +0000
committerJeffrey Overbey2011-11-28 21:36:51 +0000
commit531ccb888c38b6146e2b087f01aed40410106a02 (patch)
tree42e77c6cce4d89f7a716259a718493ae752e3cbe /org.eclipse.photran.cdtinterface
parent6999b0a8b89d4763c19a5b3b94f90593090ae910 (diff)
downloadorg.eclipse.photran-531ccb888c38b6146e2b087f01aed40410106a02.tar.gz
org.eclipse.photran-531ccb888c38b6146e2b087f01aed40410106a02.tar.xz
org.eclipse.photran-531ccb888c38b6146e2b087f01aed40410106a02.zip
Bug 365007 - PGI error parser does not recognize errors containing
non-alphanumeric characters
Diffstat (limited to 'org.eclipse.photran.cdtinterface')
-rw-r--r--org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/PGIErrorParser.java35
1 files changed, 20 insertions, 15 deletions
diff --git a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/PGIErrorParser.java b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/PGIErrorParser.java
index d03f2726..793007d9 100644
--- a/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/PGIErrorParser.java
+++ b/org.eclipse.photran.cdtinterface/src/org/eclipse/photran/internal/cdtinterface/errorparsers/PGIErrorParser.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2007 Los Alamos National Laboratory and others.
+ * Copyright (c) 2007, 2011 Los Alamos National Laboratory 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:
- * LANL - Initial API and implementation
+ * Craig Rasmussen (LANL) - Initial API and implementation
+ * Jeff Overbey (Illinois/NCSA) - Adjusted regexes to accept more errors
*******************************************************************************/
package org.eclipse.photran.internal.cdtinterface.errorparsers;
@@ -21,10 +22,12 @@ import org.eclipse.core.resources.IFile;
/**
* PGI Fortran Error Parser -- An error parser for the Portland Group compiler
*
-* This error parser matches compiler errors of the following form:
+* This error parser matches compiler errors such as
* <pre>PGFTN-S-0034-Syntax error at or near :: (life_f.f: 19)</pre>
+* <pre>PGF90-S-0034-Syntax error at or near &lt;quoted string&gt; (sample.f90: 2)</pre>
*
* @author Craig Rasmussen
+* @author Jeff Overbey
*/
@SuppressWarnings("deprecation")
final public class PGIErrorParser implements IErrorParser
@@ -34,10 +37,12 @@ final public class PGIErrorParser implements IErrorParser
* \S matches any non-whitespace character
* \d matches [0-9]
* \w matches [A-Za-z_0-9]
+ * . matches any character except (possibly) line terminators
+ * $ matches end-of-input
* Parentheses define a capturing group
*/
- private Pattern lineError = Pattern.compile("PGF\\w\\w-S-\\d+-([a-zA-Z ]+):* [(](\\S+): (\\d+)[)]"); //$NON-NLS-1$
- private Pattern nolineError = Pattern.compile("PGF\\w\\w-S-\\d+-([a-zA-Z, ]+)[(](\\S+)[)]"); //$NON-NLS-1$
+ private Pattern lineError = Pattern.compile("PGF\\w\\w-S-\\d+-(.+):* [(](\\S+): (\\d+)[)]$"); //$NON-NLS-1$
+ private Pattern nolineError = Pattern.compile("PGF\\w\\w-S-\\d+-(.+)[(](\\S+)[)]$"); //$NON-NLS-1$
public boolean processLine(String thisLine, ErrorParserManager eoParser)
{
@@ -51,22 +56,22 @@ final public class PGIErrorParser implements IErrorParser
Matcher m = lineError.matcher(thisLine);
if (m.matches()) {
- errorMessage = m.group(1);
- filename = m.group(2);
+ errorMessage = m.group(1);
+ filename = m.group(2);
lineNum = Integer.parseInt(m.group(3));
errorFound = true;
} else {
- m = nolineError.matcher(thisLine);
- if (m.matches()) {
- errorMessage = m.group(1);
- filename = m.group(2);
- lineNum = 1; //TODO - should be end of file?
- errorFound = true;
- }
+ m = nolineError.matcher(thisLine);
+ if (m.matches()) {
+ errorMessage = m.group(1);
+ filename = m.group(2);
+ lineNum = 1; //TODO - should be end of file?
+ errorFound = true;
+ }
}
if (errorFound) {
- IFile file = eoParser.findFilePath(filename);
+ IFile file = eoParser.findFilePath(filename);
eoParser.generateMarker(file, lineNum, errorMessage, IMarkerGenerator.SEVERITY_ERROR_RESOURCE, null);
}

Back to the top