Commit adef049e authored by Andrey Filippov's avatar Andrey Filippov

Implemented configurab;e parsing of instances in the tool output

parent 48ea2d41
...@@ -5,8 +5,10 @@ import re ...@@ -5,8 +5,10 @@ import re
pattern=re.compile("\[[^[:]*:\d*]") pattern=re.compile("\[[^[:]*:\d*]")
START_REF="(\\" START_REF="(\\"
END_REF=" )" END_REF=" )"
PREFIX_REF="@{" #PREFIX_REF="@{"
SUFFIX_REF="}@" #SUFFIX_REF="}@"
PREFIX_REF=""
SUFFIX_REF=""
MODE_IMMED=0 MODE_IMMED=0
MODE_SINGLE=1 MODE_SINGLE=1
MODE_ONCE=1 MODE_ONCE=1
......
...@@ -121,6 +121,10 @@ public class VDTProgramRunner { ...@@ -121,6 +121,10 @@ public class VDTProgramRunner {
String patternWarnings=combinePatterns(buildParamsItem.getWarnings(),runConfig.getPatternWarnings()) ; String patternWarnings=combinePatterns(buildParamsItem.getWarnings(),runConfig.getPatternWarnings()) ;
String patternInfo= combinePatterns(buildParamsItem.getInfo(), runConfig.getPatternInfo()) ; String patternInfo= combinePatterns(buildParamsItem.getInfo(), runConfig.getPatternInfo()) ;
String instCapture= buildParamsItem.getinstCapture();
String instSeparator=buildParamsItem.getInstSeparator();
String instSuffix= buildParamsItem.getInstSuffix();
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
subMonitor.beginTask(Txt.s("Launch.Message.Launching"), 2); subMonitor.beginTask(Txt.s("Launch.Message.Launching"), 2);
subMonitor.subTask(Txt.s("Launch.Message.ConstructingCommandLine")); subMonitor.subTask(Txt.s("Launch.Message.ConstructingCommandLine"));
...@@ -132,6 +136,9 @@ public class VDTProgramRunner { ...@@ -132,6 +136,9 @@ public class VDTProgramRunner {
System.out.println("patternErrors= \""+ patternErrors+"\""); System.out.println("patternErrors= \""+ patternErrors+"\"");
System.out.println("patternWarnings= \""+patternWarnings+"\""); System.out.println("patternWarnings= \""+patternWarnings+"\"");
System.out.println("patternInfo= \"" +patternInfo+"\""); System.out.println("patternInfo= \"" +patternInfo+"\"");
System.out.println("instCapture= \"" +instCapture+"\"");
System.out.println("instSeparator= \"" +instSeparator+"\"");
System.out.println("instSuffix= \"" +instSuffix+"\"");
System.out.println((isShell?"Shell":"Tool")+" to launch=\""+toolTolaunch+"\""); System.out.println((isShell?"Shell":"Tool")+" to launch=\""+toolTolaunch+"\"");
if (arguments!=null){ if (arguments!=null){
for (int i=0;i<arguments.length;i++){ for (int i=0;i<arguments.length;i++){
...@@ -210,7 +217,10 @@ public class VDTProgramRunner { ...@@ -210,7 +217,10 @@ public class VDTProgramRunner {
process, process,
patternErrors, patternErrors,
patternWarnings, patternWarnings,
patternInfo patternInfo,
instCapture,
instSeparator,
instSuffix
); );
subMonitor.worked(1); subMonitor.worked(1);
......
...@@ -71,6 +71,11 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -71,6 +71,11 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
String errors = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_ERRORS_ATTR); String errors = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_ERRORS_ATTR);
String warnings = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_WARNINGS_ATTR); String warnings = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_WARNINGS_ATTR);
String info = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INFO_ATTR); String info = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INFO_ATTR);
String inst_capture = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INSTANCE_CAPTURE);
String inst_separator=XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INSTANCE_SEPARATOR);
String inst_suffix = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INSTANCE_SUFFIX);
String prompt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_PROMPT_ATTR); String prompt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_PROMPT_ATTR);
String interrupt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INTERRUPT_ATTR); String interrupt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INTERRUPT_ATTR);
...@@ -108,6 +113,11 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -108,6 +113,11 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
errors, errors,
warnings, warnings,
info, info,
inst_capture,
inst_separator,
inst_suffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
......
...@@ -157,6 +157,11 @@ public class XMLConfig extends Config { ...@@ -157,6 +157,11 @@ public class XMLConfig extends Config {
static final String CONTEXT_LINEBLOCK_ERRORS_ATTR = "errors"; static final String CONTEXT_LINEBLOCK_ERRORS_ATTR = "errors";
static final String CONTEXT_LINEBLOCK_WARNINGS_ATTR = "warnings"; static final String CONTEXT_LINEBLOCK_WARNINGS_ATTR = "warnings";
static final String CONTEXT_LINEBLOCK_INFO_ATTR = "info"; static final String CONTEXT_LINEBLOCK_INFO_ATTR = "info";
//Regular expressions for capturing hierarchical names
static final String CONTEXT_LINEBLOCK_INSTANCE_CAPTURE = "instance-capture";
static final String CONTEXT_LINEBLOCK_INSTANCE_SEPARATOR ="instance-separator";
static final String CONTEXT_LINEBLOCK_INSTANCE_SUFFIX = "instance-suffix";
static final String CONTEXT_LINEBLOCK_PROMPT_ATTR = "prompt"; static final String CONTEXT_LINEBLOCK_PROMPT_ATTR = "prompt";
static final String CONTEXT_LINEBLOCK_INTERRUPT_ATTR ="interrupt"; static final String CONTEXT_LINEBLOCK_INTERRUPT_ATTR ="interrupt";
static final String CONTEXT_LINEBLOCK_STDERR_ATTR = "stderr"; static final String CONTEXT_LINEBLOCK_STDERR_ATTR = "stderr";
......
...@@ -42,6 +42,11 @@ public class BuildParamsItem implements Cloneable{ ...@@ -42,6 +42,11 @@ public class BuildParamsItem implements Cloneable{
private String toolErrors; // Eclipse pattern for pattern recognizer private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // Eclipse pattern for pattern recognizer private String toolWarnings; // Eclipse pattern for pattern recognizer
private String toolInfo; // Eclipse pattern for pattern recognizer private String toolInfo; // Eclipse pattern for pattern recognizer
private String instCapture; // RegEx to extract hierarchical name form tool output (may need extra "()" around)
private String instSeparator;// RegEx to split name segments (i.e. "\.")
private String instSuffix; // RegEx to remove tool-generated name suffixes, like "_reg|_suffix2|suffix3"
// for commands being sent to opened remote console: // for commands being sent to opened remote console:
private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input) private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input)
private String interrupt; // control character(s) to interrupt console command private String interrupt; // control character(s) to interrupt console command
...@@ -66,6 +71,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -66,6 +71,9 @@ public class BuildParamsItem implements Cloneable{
String toolErrors, String toolErrors,
String toolWarnings, String toolWarnings,
String toolInfo, String toolInfo,
String instCapture,
String instSeparator,
String instSuffix,
String prompt, String prompt,
String interrupt, String interrupt,
String stderr, String stderr,
...@@ -83,6 +91,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -83,6 +91,9 @@ public class BuildParamsItem implements Cloneable{
this.toolErrors=toolErrors; this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings; this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo; this.toolInfo=toolInfo;
this.instCapture=instCapture;
this.instSeparator=instSeparator;
this.instSuffix=instSuffix;
this.prompt=prompt; this.prompt=prompt;
this.interrupt=interrupt; this.interrupt=interrupt;
this.stderr=stderr; this.stderr=stderr;
...@@ -102,6 +113,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -102,6 +113,9 @@ public class BuildParamsItem implements Cloneable{
item.toolErrors, item.toolErrors,
item.toolWarnings, item.toolWarnings,
item.toolInfo, item.toolInfo,
item.instCapture,
item.instSeparator,
item.instSuffix,
item.prompt, item.prompt,
item.interrupt, item.interrupt,
item.stderr, item.stderr,
...@@ -155,6 +169,9 @@ public class BuildParamsItem implements Cloneable{ ...@@ -155,6 +169,9 @@ public class BuildParamsItem implements Cloneable{
public String getErrors() { return toolErrors; } public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; } public String getWarnings() { return toolWarnings; }
public String getInfo() { return toolInfo; } public String getInfo() { return toolInfo; }
public String getinstCapture() { return instCapture; }
public String getInstSeparator(){ return instSeparator; }
public String getInstSuffix() { return instSuffix; }
public String getPrompt() { return prompt; } public String getPrompt() { return prompt; }
public String getInterrupt() { return interrupt; } public String getInterrupt() { return interrupt; }
public String getStderr() { return stderr; } public String getStderr() { return stderr; }
......
...@@ -292,6 +292,12 @@ public abstract class Context { ...@@ -292,6 +292,12 @@ public abstract class Context {
String toolErrors= subsitutePattern(commandLinesBlock.getErrors()); String toolErrors= subsitutePattern(commandLinesBlock.getErrors());
String toolWarnings=subsitutePattern(commandLinesBlock.getWarnings()); String toolWarnings=subsitutePattern(commandLinesBlock.getWarnings());
String toolInfo= subsitutePattern(commandLinesBlock.getInfo()); String toolInfo= subsitutePattern(commandLinesBlock.getInfo());
String instCapture= subsitutePattern(commandLinesBlock.getinstCapture());
String instSeparator= subsitutePattern(commandLinesBlock.getInstSeparator());
String instSuffix= subsitutePattern(commandLinesBlock.getInstSuffix());
String stderr=commandLinesBlock.getStderr(); String stderr=commandLinesBlock.getStderr();
String stdout=commandLinesBlock.getStdout(); String stdout=commandLinesBlock.getStdout();
// the result will not be used as some other parameter value, so topProcessor is null in the next 2 lines /Andrey // the result will not be used as some other parameter value, so topProcessor is null in the next 2 lines /Andrey
...@@ -343,6 +349,9 @@ public abstract class Context { ...@@ -343,6 +349,9 @@ public abstract class Context {
toolErrors, toolErrors,
toolWarnings, toolWarnings,
toolInfo, toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
...@@ -389,6 +398,9 @@ public abstract class Context { ...@@ -389,6 +398,9 @@ public abstract class Context {
toolErrors, toolErrors,
toolWarnings, toolWarnings,
toolInfo, toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
......
...@@ -52,6 +52,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -52,6 +52,13 @@ public class CommandLinesBlock extends UpdateableStringsContainer
private String toolErrors; // Eclipse pattern for pattern recognizer private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // Eclipse pattern for pattern recognizer private String toolWarnings; // Eclipse pattern for pattern recognizer
private String toolInfo; // Eclipse pattern for pattern recognizer private String toolInfo; // Eclipse pattern for pattern recognizer
private String instCapture; // RegEx to extract hierarchical name form tool output (may need extra "()" around)
private String instSeparator;// RegEx to split name segments (i.e. "\.")
private String instSuffix; // RegEx to remove tool-generated name suffixes, like "_reg|_suffix2|suffix3"
// for commands being sent to opened remote console: // for commands being sent to opened remote console:
private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input) private String prompt; // relevant for commands sent to remote console - double prompt means "done" (extra separator on input)
private String stderr; // name of the command to (command line block) to launch in a separate process/console private String stderr; // name of the command to (command line block) to launch in a separate process/console
...@@ -77,6 +84,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -77,6 +84,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer
String toolErrors, String toolErrors,
String toolWarnings, String toolWarnings,
String toolInfo, String toolInfo,
String instCapture, // RegEx to extract hierarchical name form tool output (may need extra "()" around)
String instSeparator,// RegEx to split name segments (i.e. "\.")
String instSuffix, // RegEx to remove tool-generated name suffixes, like "_reg|_suffix2|suffix3"
String prompt, String prompt,
String interrupt, String interrupt,
String stderr, String stderr,
...@@ -101,6 +111,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -101,6 +111,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this.toolErrors=toolErrors; this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings; this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo; this.toolInfo=toolInfo;
this.instCapture=instCapture;
this.instSeparator=instSeparator;
this.instSuffix=instSuffix;
this.prompt=prompt; this.prompt=prompt;
this.interrupt=interrupt; this.interrupt=interrupt;
this.stderr=stderr; this.stderr=stderr;
...@@ -147,6 +160,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -147,6 +160,9 @@ public class CommandLinesBlock extends UpdateableStringsContainer
block.toolErrors, block.toolErrors,
block.toolWarnings, block.toolWarnings,
block.toolInfo, block.toolInfo,
block.instCapture,
block.instSeparator,
block.instSuffix,
block.prompt, block.prompt,
block.interrupt, block.interrupt,
block.stderr, block.stderr,
...@@ -223,6 +239,11 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -223,6 +239,11 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public String getErrors() { return toolErrors; } public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; } public String getWarnings() { return toolWarnings; }
public String getInfo() { return toolInfo; } public String getInfo() { return toolInfo; }
public String getinstCapture() { return instCapture; }
public String getInstSeparator(){ return instSeparator; }
public String getInstSuffix() { return instSuffix; }
public String getPrompt() { return prompt; } public String getPrompt() { return prompt; }
public String getInterrupt() { return interrupt; } public String getInterrupt() { return interrupt; }
public String getStderr() { return stderr; } public String getStderr() { return stderr; }
......
...@@ -45,6 +45,22 @@ ...@@ -45,6 +45,22 @@
<parameter id="PatternInfo" label="Info" tooltip= "Regular expression for info messages" <parameter id="PatternInfo" label="Info" tooltip= "Regular expression for info messages"
default=".*INFO: (\[.*\].*)\[(.*):([0-9]+)\]" default=".*INFO: (\[.*\].*)\[(.*):([0-9]+)\]"
visible="true" type="String" format="CopyValue"/> visible="true" type="String" format="CopyValue"/>
<parameter id="InstanceCapture" label="Instance capture"
tooltip= "Regular expression to extract hierarchical instance name (outer '()' enclose the hierarchical name itself)"
default="((([a-zA-Z_]([a-zA-Z_0-9]|\[[0-9:]+\])*)\.)+([a-zA-Z_]([a-zA-Z_0-9]|\[[0-9:]+\])*))"
visible="true" type="String" format="CopyValue"/>
<parameter id="InstanceSeparator" label="Instance separator"
tooltip= "Regular expression to extract hierarchical name separator, for literal '.' it is '\.'"
default="\."
visible="true" type="String" format="CopyValue"/>
<parameter id="InstanceSuffix" label="Instance suffix"
tooltip= "Regular expression to match/remove name suffixes automatically added by the tools"
default="_reg"
visible="true" type="String" format="CopyValue"/>
<parameter id="NoFileProblem" label="No-file problems" tooltip= "Report problems that do not specify particular source file/line" <parameter id="NoFileProblem" label="No-file problems" tooltip= "Report problems that do not specify particular source file/line"
default="true" visible="true" omit="false" type="Boolean" format="None"/> default="true" visible="true" omit="false" type="Boolean" format="None"/>
<parameter id="Drc" label="Drc" tooltip= "Enable problems with [Drc to be reported" <parameter id="Drc" label="Drc" tooltip= "Enable problems with [Drc to be reported"
...@@ -124,13 +140,19 @@ ...@@ -124,13 +140,19 @@
"PatternErrors" "PatternErrors"
"PatternWarnings" "PatternWarnings"
"PatternInfo" "PatternInfo"
"InstanceCapture"
"InstanceSeparator"
"InstanceSuffix"
</group> </group>
</input> </input>
<output> <output>
<line name="parser_Vivado" <line name="parser_Vivado"
errors= "PatternErrors" errors= "PatternErrors"
warnings= "PatternWarnings" warnings= "PatternWarnings"
info= "PatternInfo"> info= "PatternInfo"
instance-capture= "InstanceCapture"
instance-separator="InstanceSeparator"
instance-suffix= "InstanceSuffix">
"-c" "-c"
"python -u %parsers_path%parser_name %%ToolName | " "python -u %parsers_path%parser_name %%ToolName | "
"%GrepEWI" "%GrepEWI"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment