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>


<!ELEMENT errorparser (pattern* , context*)>

<!ATTLIST errorparser

id    IDREF #IMPLIED

name  CDATA #IMPLIED

class CDATA "org.eclipse.cdt.core.errorparsers.RegexErrorParser">


<!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.



<!ELEMENT context EMPTY>

<!ATTLIST context

type CDATA #REQUIRED>

Use this element to specify the context where an error parser can be used. If none is specified, the default context type will be "build". An example of a context type is "build". Only error parsers in this context are used to parse build output. You can see these error parsers in the "C/C++" > "Build" > "Settings" preference page. An error parser can be assigned to more than one context type. Clients contributing error parsers are free to define their own context types.



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.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0