author | timkelly |
Mon, 21 Sep 2009 09:18:33 -0500 | |
changeset 97 | ce57c204ca6b |
parent 77 | 2d52d49686f6 |
permissions | -rw-r--r-- |
37 | 1 |
/******************************************************************************* |
2 |
* Copyright (c) 2005, 2009 IBM Corporation and others. |
|
3 |
* All rights reserved. This program and the accompanying materials |
|
4 |
* are made available under the terms of the Eclipse Public License v1.0 |
|
5 |
* which accompanies this distribution, and is available at |
|
6 |
* http://www.eclipse.org/legal/epl-v10.html |
|
7 |
* |
|
8 |
* Contributors: |
|
9 |
* IBM Corporation - initial API and implementation |
|
10 |
* James Blackburn - Patch for PR 85264 |
|
11 |
* Norbert Ploett (Siemens AG) - externalized strings |
|
12 |
*******************************************************************************/ |
|
13 |
||
14 |
package org.eclipse.cdt.internal.errorparsers; |
|
15 |
||
16 |
import java.util.regex.Matcher; |
|
17 |
import java.util.regex.Pattern; |
|
18 |
||
19 |
import org.eclipse.cdt.core.IMarkerGenerator; |
|
20 |
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser; |
|
21 |
import org.eclipse.cdt.core.errorparsers.ErrorPattern; |
|
22 |
||
23 |
public class GCCErrorParser extends AbstractErrorParser { |
|
24 |
||
25 |
private static final Pattern[] varPatterns = { |
|
26 |
Pattern.compile(Messages.GCCErrorParser_varPattern_undeclared), |
|
27 |
Pattern.compile(Messages.GCCErrorParser_varPattern_defdNotUsed), |
|
28 |
Pattern.compile(Messages.GCCErrorParser_varPattern_conflictTypes), |
|
29 |
Pattern.compile(Messages.GCCErrorParser_varPattern_parseError) |
|
30 |
}; |
|
31 |
||
32 |
private static final ErrorPattern[] patterns = { |
|
33 |
// The following are skipped |
|
34 |
new ErrorPattern(Messages.GCCErrorParser_skip_UndeclaredOnlyOnce), |
|
35 |
new ErrorPattern(Messages.GCCErrorParser_skip_forEachFunction), |
|
36 |
new ErrorPattern(Messages.GCCErrorParser_skip_note), |
|
37 |
new ErrorPattern(Messages.GCCErrorParser_sikp_instantiatedFromHere), |
|
38 |
// The following are not... |
|
97
ce57c204ca6b
fix for cdt bug 263987 (slightly different from our proposal but just as effective)
timkelly
parents:
77
diff
changeset
|
39 |
new ErrorPattern(Messages.GCCErrorParser_Warnings, 1, 2, 5, 0, 0) { |
37 | 40 |
@Override |
41 |
public String getVarName(Matcher matcher) { |
|
42 |
String desc = getDesc(matcher); |
|
43 |
if (desc == null) |
|
44 |
return null; |
|
45 |
||
46 |
for (int i = 0; i < varPatterns.length; ++i) { |
|
47 |
Matcher varMatcher = varPatterns[i].matcher(desc); |
|
48 |
if (varMatcher.find()) |
|
49 |
return varMatcher.group(1); |
|
50 |
} |
|
51 |
return null; |
|
52 |
} |
|
53 |
@Override |
|
54 |
public int getSeverity(Matcher matcher) { |
|
55 |
String warningGroup = matcher.group(4); |
|
77 | 56 |
if (warningGroup != null && warningGroup.toLowerCase().endsWith("warning:")) { //$NON-NLS-1$ |
37 | 57 |
return IMarkerGenerator.SEVERITY_WARNING; |
58 | 58 |
} |
37 | 59 |
|
60 |
return IMarkerGenerator.SEVERITY_ERROR_RESOURCE; |
|
61 |
} |
|
62 |
} |
|
63 |
}; |
|
64 |
||
65 |
public GCCErrorParser() { |
|
66 |
super(patterns); |
|
67 |
} |
|
68 |
||
69 |
} |