author | timkelly |
Thu, 13 Aug 2009 17:12:47 -0500 | |
changeset 439 | a29cb5e793d3 |
parent 125 | b878114e8cc2 |
child 632 | 4a8b1092f0a4 |
permissions | -rw-r--r-- |
125 | 1 |
/* |
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: |
|
15 |
* |
|
16 |
* Handles GCCE specific error before invoking CDT error parser |
|
17 |
* |
|
18 |
*/ |
|
19 |
package com.nokia.carbide.cdt.internal.builder.error.parsers; |
|
20 |
||
21 |
import java.util.regex.Matcher; |
|
22 |
||
23 |
import org.eclipse.cdt.core.ErrorParserManager; |
|
24 |
import org.eclipse.cdt.core.IMarkerGenerator; |
|
439
a29cb5e793d3
fixed GCCE error parser & tests to work with CDT 6.0 changes.
timkelly
parents:
125
diff
changeset
|
25 |
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser; |
a29cb5e793d3
fixed GCCE error parser & tests to work with CDT 6.0 changes.
timkelly
parents:
125
diff
changeset
|
26 |
import org.eclipse.cdt.core.errorparsers.ErrorPattern; |
125 | 27 |
|
28 |
/* |
|
29 |
* AbstractErrorParser/ErrorPattern are going to public API in CDT 5.1 |
|
30 |
*/ |
|
31 |
abstract public class AbstractGCCEErrorParser extends AbstractErrorParser { |
|
32 |
private String toolNameString; |
|
33 |
private static final ErrorPattern[] patterns = { |
|
34 |
/* |
|
35 |
* int groupFileName, |
|
36 |
* int groupLineNum, |
|
37 |
* int groupDesc, |
|
38 |
* int groupVarName, |
|
39 |
* int severity |
|
40 |
*/ |
|
41 |
// arm-none-symbianelf-g++: \test\test.cpp: No such file or directory |
|
42 |
new ErrorPattern("(.*):\\s*(.*:)\\s*(.*(?:[Nn]o such file:\\s*)?[Nn]o such file or directory)", 2, 0, 3, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1$ |
|
43 |
// arm-none-symbianelf-g++: no input files |
|
44 |
new ErrorPattern("(.*):\\s*(.*[Nn]o input files)", 0, 0, 2, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE), //$NON-NLS-1$ |
|
45 |
//arm-none-symbianelf-g++: warning: `-x c++' after last input file has no effect |
|
46 |
//arm-none-symbianelf-g++: error: some message |
|
47 |
new ErrorPattern("(.*):\\s*(.*[(?:[Ww]arning)(?:[Ee]rror)]):\\s*(.*)", 0, 0, 3, 0, IMarkerGenerator.SEVERITY_INFO) { //$NON-NLS-1$ |
|
48 |
||
49 |
@Override |
|
50 |
public int getSeverity(Matcher matcher) { |
|
51 |
String warningGroup = matcher.group(2); |
|
52 |
if (warningGroup != null && warningGroup.indexOf("arning") >= 0) //$NON-NLS-1$ |
|
53 |
return IMarkerGenerator.SEVERITY_WARNING; |
|
54 |
||
55 |
return IMarkerGenerator.SEVERITY_ERROR_RESOURCE; |
|
56 |
} |
|
57 |
||
58 |
} |
|
59 |
}; |
|
60 |
||
61 |
protected AbstractGCCEErrorParser(String toolNameString) { |
|
62 |
super(patterns); |
|
63 |
this.toolNameString = toolNameString; |
|
64 |
} |
|
65 |
||
66 |
/* |
|
67 |
* (non-Javadoc) |
|
68 |
* @see org.eclipse.cdt.internal.errorparsers.AbstractErrorParser#processLine(java.lang.String, org.eclipse.cdt.core.ErrorParserManager) |
|
69 |
* |
|
70 |
* Only pick up message that matches the tool name pattern |
|
71 |
* |
|
72 |
*/ |
|
73 |
public boolean processLine(String line, ErrorParserManager eoParser) { |
|
74 |
if (line.startsWith(toolNameString)) { |
|
75 |
return super.processLine(line, eoParser); |
|
76 |
} |
|
77 |
return false; |
|
78 |
} |
|
79 |
} |