Class RegexErrorPattern
- java.lang.Object
-
- org.eclipse.cdt.core.errorparsers.RegexErrorPattern
-
- All Implemented Interfaces:
java.lang.Cloneable
public class RegexErrorPattern extends java.lang.Object implements java.lang.CloneableRegexErrorPattern specifies a regular expression and rules how to create markers for Problems View. It is used by
RegexErrorParserto process build output.Regex pattern used by this class is Java regular expression and defines capturing groups. Those capturing groups are used in file, line, description expressions to get the values.
For example: pattern "(../../..) (.*):(\d*): (Error:.*)" could go along with file-expression "$2", line-expression "$3" and description-expression "$1 $4".
Note: variable name is being stored in marker tag. However currently it is not being used.
Severity could be one of:
-IMarkerGenerator.SEVERITY_INFO,
-IMarkerGenerator.SEVERITY_WARNING,
-IMarkerGenerator.SEVERITY_ERROR_RESOURCE,
-IMarkerGenerator.SEVERITY_ERROR_BUILD
-SEVERITY_SKIPSEVERITY_SKIPmeans that output line is checked to match the pattern but won't be parsed to create a marker. It is useful with conjunction witheatProcessedLine=trueto filter out certain lines.eatProcessedLinespecifies if the current output line is being passed to the rest of patterns for further processing or consumed by the pattern.Clients may extend this class. As it implements
Cloneableinterface those clients must implementObject.clone()andObject.equals(java.lang.Object)methods to avoid slicing.- Since:
- 5.2
-
-
Field Summary
Fields Modifier and Type Field Description static intSEVERITY_SKIPAdditional "severity" flag which tells if qualified output line should be ignored.
-
Constructor Summary
Constructors Constructor Description RegexErrorPattern(java.lang.String pattern, java.lang.String fileExpression, java.lang.String lineExpression, java.lang.String descriptionExpression, java.lang.String varNameExpression, int severity, boolean eat)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()booleanequals(java.lang.Object o)protected java.lang.StringgetDesc(java.util.regex.Matcher matcher)java.lang.StringgetDescriptionExpression()java.lang.StringgetFileExpression()protected java.lang.StringgetFileName(java.util.regex.Matcher matcher)java.lang.StringgetLineExpression()protected intgetLineNum(java.util.regex.Matcher matcher)java.lang.StringgetPattern()intgetSeverity()protected intgetSeverity(java.util.regex.Matcher matcher)protected java.lang.StringgetVarName(java.util.regex.Matcher matcher)java.lang.StringgetVarNameExpression()booleanisEatProcessedLine()booleanprocessLine(java.lang.String line, ErrorParserManager eoParser)Parse a line of build output and register error/warning for Problems view.protected booleanrecordError(java.util.regex.Matcher matcher, ErrorParserManager eoParser)Register the error inErrorParserManager.voidsetDescriptionExpression(java.lang.String descriptionExpression)voidsetEatProcessedLine(boolean eatProcessedLine)voidsetFileExpression(java.lang.String fileExpression)voidsetLineExpression(java.lang.String lineExpression)voidsetPattern(java.lang.String pattern)voidsetSeverity(int severity)voidsetVarNameExpression(java.lang.String varNameExpression)
-
-
-
Field Detail
-
SEVERITY_SKIP
public static final int SEVERITY_SKIP
Additional "severity" flag which tells if qualified output line should be ignored.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RegexErrorPattern
public RegexErrorPattern(java.lang.String pattern, java.lang.String fileExpression, java.lang.String lineExpression, java.lang.String descriptionExpression, java.lang.String varNameExpression, int severity, boolean eat)Constructor.- Parameters:
pattern- - regular expression describing the capturing groupsfileExpression- - capturing group expression defining file namelineExpression- - capturing group expression defining line numberdescriptionExpression- - capturing group expression defining descriptionvarNameExpression- -capturing group expression defining variable nameseverity- - severity, one ofIMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILDSEVERITY_SKIPeat- - defines whether to consume output line avoiding further processing by other patternsSee general description for this class
RegexErrorPatternfor more details.
-
-
Method Detail
-
getPattern
public java.lang.String getPattern()
- Returns:
- regular expression pattern
-
getFileExpression
public java.lang.String getFileExpression()
- Returns:
- expression defining file name
-
getLineExpression
public java.lang.String getLineExpression()
- Returns:
- expression defining line number
-
getDescriptionExpression
public java.lang.String getDescriptionExpression()
- Returns:
- expression defining description
-
getVarNameExpression
public java.lang.String getVarNameExpression()
- Returns:
- expression defining variable name
-
getSeverity
public int getSeverity()
- Returns:
- severity of the marker, one of:
IMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILD
-
isEatProcessedLine
public boolean isEatProcessedLine()
- Returns:
- whether output line is consumed and not processed further by other patterns
-
setPattern
public void setPattern(java.lang.String pattern)
- Parameters:
pattern- - regular expression pattern describing the capturing groups
-
setFileExpression
public void setFileExpression(java.lang.String fileExpression)
- Parameters:
fileExpression- - capturing group expression defining file name
-
setLineExpression
public void setLineExpression(java.lang.String lineExpression)
- Parameters:
lineExpression- - capturing group expression defining line number
-
setDescriptionExpression
public void setDescriptionExpression(java.lang.String descriptionExpression)
- Parameters:
descriptionExpression- - capturing group expression defining description
-
setVarNameExpression
public void setVarNameExpression(java.lang.String varNameExpression)
- Parameters:
varNameExpression- -capturing group expression defining variable name
-
setSeverity
public void setSeverity(int severity)
- Parameters:
severity- - severity, one ofIMarkerGenerator.SEVERITY_INFO,IMarkerGenerator.SEVERITY_WARNING,IMarkerGenerator.SEVERITY_ERROR_RESOURCE,IMarkerGenerator.SEVERITY_ERROR_BUILDSEVERITY_SKIP
-
setEatProcessedLine
public void setEatProcessedLine(boolean eatProcessedLine)
- Parameters:
eatProcessedLine- - whether to consume output line avoiding further processing by other patterns
-
getFileName
protected java.lang.String getFileName(java.util.regex.Matcher matcher)
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed file name or
null.
-
getLineNum
protected int getLineNum(java.util.regex.Matcher matcher)
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed line number or
0.
-
getDesc
protected java.lang.String getDesc(java.util.regex.Matcher matcher)
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed description or
null.
-
getVarName
protected java.lang.String getVarName(java.util.regex.Matcher matcher)
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- parsed variable name or
null.
-
getSeverity
protected int getSeverity(java.util.regex.Matcher matcher)
- Parameters:
matcher- - matcher to parse the input line.- Returns:
- severity of the problem.
-
processLine
public boolean processLine(java.lang.String line, ErrorParserManager eoParser)Parse a line of build output and register error/warning for Problems view.- Parameters:
line- - one line of output.eoParser- -ErrorParserManager.- Returns:
trueif error/warning/info problem was found.
-
recordError
protected boolean recordError(java.util.regex.Matcher matcher, ErrorParserManager eoParser)Register the error inErrorParserManager.- Parameters:
matcher- - matcher to parse the input line.eoParser- -ErrorParserManager.- Returns:
trueindicating that error was found.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
-