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
......
...@@ -120,6 +120,10 @@ public class VDTProgramRunner { ...@@ -120,6 +120,10 @@ public class VDTProgramRunner {
String patternErrors= combinePatterns(buildParamsItem.getErrors(), runConfig.getPatternErrors()) ; String patternErrors= combinePatterns(buildParamsItem.getErrors(), runConfig.getPatternErrors()) ;
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);
...@@ -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);
......
...@@ -64,15 +64,20 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -64,15 +64,20 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
private CommandLinesBlock readCommandLinesBlock(Node node, Condition condition) private CommandLinesBlock readCommandLinesBlock(Node node, Condition condition)
throws ConfigException throws ConfigException
{ {
String name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR); String name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR);
String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR); String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR);
String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR); String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR);
String mark = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_MARK_ATTR); String mark = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_MARK_ATTR);
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 prompt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_PROMPT_ATTR);
String interrupt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INTERRUPT_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 interrupt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INTERRUPT_ATTR);
String stderr = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDERR_ATTR); String stderr = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDERR_ATTR);
String stdout = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDOUT_ATTR); String stdout = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDOUT_ATTR);
...@@ -107,7 +112,12 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader { ...@@ -107,7 +112,12 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
mark, mark,
errors, errors,
warnings, warnings,
info, info,
inst_capture,
inst_separator,
inst_suffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
......
...@@ -156,7 +156,12 @@ public class XMLConfig extends Config { ...@@ -156,7 +156,12 @@ public class XMLConfig extends Config {
static final String CONTEXT_LINEBLOCK_MARK_ATTR = "mark"; static final String CONTEXT_LINEBLOCK_MARK_ATTR = "mark";
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; }
......
...@@ -291,7 +291,13 @@ public abstract class Context { ...@@ -291,7 +291,13 @@ public abstract class Context {
String mark=commandLinesBlock.getMark(); String mark=commandLinesBlock.getMark();
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
...@@ -342,7 +348,10 @@ public abstract class Context { ...@@ -342,7 +348,10 @@ public abstract class Context {
// mark, // mark,
toolErrors, toolErrors,
toolWarnings, toolWarnings,
toolInfo, toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
...@@ -388,7 +397,10 @@ public abstract class Context { ...@@ -388,7 +397,10 @@ public abstract class Context {
// mark, // mark,
toolErrors, toolErrors,
toolWarnings, toolWarnings,
toolInfo, toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt, prompt,
interrupt, interrupt,
stderr, stderr,
......
...@@ -51,7 +51,14 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -51,7 +51,14 @@ public class CommandLinesBlock extends UpdateableStringsContainer
private String mark; // remove this sequence on the output only (to preserve white spaces) private String mark; // remove this sequence on the output only (to preserve white spaces)
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
...@@ -76,7 +83,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -76,7 +83,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
String mark, String mark,
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,
...@@ -100,7 +110,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -100,7 +110,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this.mark=mark; this.mark=mark;
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;
...@@ -146,7 +159,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -146,7 +159,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
block.mark, block.mark,
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,
...@@ -217,12 +233,17 @@ public class CommandLinesBlock extends UpdateableStringsContainer ...@@ -217,12 +233,17 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); } public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); }
// to distinguish between empty command block (program w/o any parameters) and conditionally removed one // to distinguish between empty command block (program w/o any parameters) and conditionally removed one
public boolean hadStrings() {return (strings!=null) && (strings.getEntries().size()>0); } public boolean hadStrings() {return (strings!=null) && (strings.getEntries().size()>0); }
public String getName() { return name; } public String getName() { return name; }
public String getSeparator() { return separator; } public String getSeparator() { return separator; }
public String getMark() { return mark; } public String getMark() { return mark; }
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; }
......
...@@ -44,7 +44,23 @@ ...@@ -44,7 +44,23 @@
visible="true" type="String" format="CopyValue"/> visible="true" type="String" format="CopyValue"/>
<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"
...@@ -123,14 +139,20 @@ ...@@ -123,14 +139,20 @@
"---" "---"
"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