ErrorParser
Identifier:
org.eclipse.cdt.core.ErrorParser
Since:
CDT 1.2
Description:
This extension point is used to contribute a new Error Parser. A Error Parser is used to parse errors/warnings/info from build output and populate Problems View with them.
Configuration Markup:
<!ELEMENT extension (errorparser)>
<!ATTLIST extension
id CDATA #REQUIRED
name CDATA #REQUIRED
point CDATA #REQUIRED
>
- id - ID of the extension point (Simple ID)
- name - Name of the extension point
<!ELEMENT errorparser (pattern*)>
<!ATTLIST errorparser
id CDATA #IMPLIED
name CDATA #IMPLIED
class CDATA "org.eclipse.cdt.core.errorparsers.RegexErrorParser"
>
- id - ID of the error parser. If attribute is missing error parser ID is constructed appending Simple ID of extension to plugin ID.
- name - Name of the error parser. If this attribute is missing extension name is taken.
- class - a fully qualified name of the Java class that implements org.eclipse.cdt.core.IErrorParser interface.
<!ELEMENT pattern EMPTY>
<!ATTLIST pattern
severity (Error|Warning|Info|Ignore)
regex CDATA "(.*)"
file-expr CDATA #IMPLIED
line-expr CDATA #IMPLIED
description-expr CDATA "$1"
variable-expr CDATA #IMPLIED
eat-processed-line (true | false)
>
Use element "pattern" to configure RegexErrorParser.
- severity - Attribute "severity" specifies which severity should be used to display the marker in Problems View. There are 3 levels of severity, "Error", "Warning" and "Info". "Ignore" lets stop evaluating the line by the rest of patterns without showing up in Problems View.
- regex - Java regular expression to define capturing groups for file-expr, line-expr and description-expr.
- file-expr - "Replacement" expression composed from capturing groups defined in regex to define the file.
- line-expr - "Replacement" expression composed from capturing groups defined in regex to define the line in file.
- description-expr - "Replacement" expression composed from capturing groups defined in regex to define the description (i.e. "$1: $2"). It is possible to specify more than one capturing group in such expression.
- variable-expr - "Replacement" expression composed from capturing groups defined in regex to define variable. The value will be assigned to marker attributes but is not used by CDT currently.
- eat-processed-line - The attribute defines if a line matched by the pattern is prevented or allowed to be processed by the rest of patterns. "No" allows several patterns to evaluate one line.
Examples:
package org.eclipse.cdt.example.errorparser;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.errorparsers.AbstractErrorParser;
import org.eclipse.cdt.core.errorparsers.ErrorPattern;
/**
* Simple error parser parsing lines of kind "FILE,LINE:error DESCRIPTION"
* Enable the errorparser in project Properties->C/C++ Build->Settings->Error Parsers
*/
public class SampleErrorParser extends AbstractErrorParser {
private static final ErrorPattern[] patterns = {
new ErrorPattern("(.*),(.*):error (.*)", 1, 2, 3, 0, IMarkerGenerator.SEVERITY_ERROR_RESOURCE),
new ErrorPattern("(.*),(.*):warning (.*)", 1, 2, 3, 0, IMarkerGenerator.SEVERITY_WARNING),
new ErrorPattern("(.*),(.*):info (.*)", 1, 2, 3, 0, IMarkerGenerator.SEVERITY_INFO),
};
/**
* Constructor to set the error pattern.
*/
public SampleErrorParser() {
super(patterns);
}
}
API Information:
Plug-ins that want to extend this extension point must implement org.eclipse.cdt.core.IErrorParser interface.
For most cases it is sufficient to configure RegexErrorParser which is provided by default.
Another good choice is to extend org.eclipse.cdt.core.errorparsers.AbstractErrorParser as done in the example.
ErrorParsers dealing with multi-line messages should implement org.eclipse.cdt.core.IErrorParser2 interface.
Supplied Implementation:
For another example of implementation see org.eclipse.cdt.internal.errorparsers.GCCErrorParser
Copyright (c) 2005, 2009 Andrew Gvozdev (Quoin Inc.) 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