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
pattern=re.compile("\[[^[:]*:\d*]")
START_REF="(\\"
END_REF=" )"
PREFIX_REF="@{"
SUFFIX_REF="}@"
#PREFIX_REF="@{"
#SUFFIX_REF="}@"
PREFIX_REF=""
SUFFIX_REF=""
MODE_IMMED=0
MODE_SINGLE=1
MODE_ONCE=1
......
......@@ -120,6 +120,10 @@ public class VDTProgramRunner {
String patternErrors= combinePatterns(buildParamsItem.getErrors(), runConfig.getPatternErrors()) ;
String patternWarnings=combinePatterns(buildParamsItem.getWarnings(),runConfig.getPatternWarnings()) ;
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);
subMonitor.beginTask(Txt.s("Launch.Message.Launching"), 2);
......@@ -132,6 +136,9 @@ public class VDTProgramRunner {
System.out.println("patternErrors= \""+ patternErrors+"\"");
System.out.println("patternWarnings= \""+patternWarnings+"\"");
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+"\"");
if (arguments!=null){
for (int i=0;i<arguments.length;i++){
......@@ -210,7 +217,10 @@ public class VDTProgramRunner {
process,
patternErrors,
patternWarnings,
patternInfo
patternInfo,
instCapture,
instSeparator,
instSuffix
);
subMonitor.worked(1);
......
......@@ -64,15 +64,20 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
private CommandLinesBlock readCommandLinesBlock(Node node, Condition condition)
throws ConfigException
{
String name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR);
String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR);
String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR);
String mark = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_MARK_ATTR);
String errors = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_ERRORS_ATTR);
String warnings = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_WARNINGS_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 name = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_NAME_ATTR);
String dest = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_DEST_ATTR);
String sep = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_SEP_ATTR);
String mark = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_MARK_ATTR);
String errors = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_ERRORS_ATTR);
String warnings = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_WARNINGS_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 interrupt = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_INTERRUPT_ATTR);
String stderr = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDERR_ATTR);
String stdout = XMLConfig.getAttributeValue(node, XMLConfig.CONTEXT_LINEBLOCK_STDOUT_ATTR);
......@@ -107,7 +112,12 @@ public class CommandLinesNodeReader extends AbstractConditionNodeReader {
mark,
errors,
warnings,
info,
info,
inst_capture,
inst_separator,
inst_suffix,
prompt,
interrupt,
stderr,
......
......@@ -156,7 +156,12 @@ public class XMLConfig extends Config {
static final String CONTEXT_LINEBLOCK_MARK_ATTR = "mark";
static final String CONTEXT_LINEBLOCK_ERRORS_ATTR = "errors";
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_INTERRUPT_ATTR ="interrupt";
static final String CONTEXT_LINEBLOCK_STDERR_ATTR = "stderr";
......
......@@ -42,6 +42,11 @@ public class BuildParamsItem implements Cloneable{
private String toolErrors; // Eclipse pattern for pattern recognizer
private String toolWarnings; // 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:
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
......@@ -66,6 +71,9 @@ public class BuildParamsItem implements Cloneable{
String toolErrors,
String toolWarnings,
String toolInfo,
String instCapture,
String instSeparator,
String instSuffix,
String prompt,
String interrupt,
String stderr,
......@@ -83,6 +91,9 @@ public class BuildParamsItem implements Cloneable{
this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo;
this.instCapture=instCapture;
this.instSeparator=instSeparator;
this.instSuffix=instSuffix;
this.prompt=prompt;
this.interrupt=interrupt;
this.stderr=stderr;
......@@ -102,6 +113,9 @@ public class BuildParamsItem implements Cloneable{
item.toolErrors,
item.toolWarnings,
item.toolInfo,
item.instCapture,
item.instSeparator,
item.instSuffix,
item.prompt,
item.interrupt,
item.stderr,
......@@ -155,6 +169,9 @@ public class BuildParamsItem implements Cloneable{
public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; }
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 getInterrupt() { return interrupt; }
public String getStderr() { return stderr; }
......
......@@ -291,7 +291,13 @@ public abstract class Context {
String mark=commandLinesBlock.getMark();
String toolErrors= subsitutePattern(commandLinesBlock.getErrors());
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 stdout=commandLinesBlock.getStdout();
// 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 {
// mark,
toolErrors,
toolWarnings,
toolInfo,
toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt,
interrupt,
stderr,
......@@ -388,7 +397,10 @@ public abstract class Context {
// mark,
toolErrors,
toolWarnings,
toolInfo,
toolInfo,
instCapture,
instSeparator,
instSuffix,
prompt,
interrupt,
stderr,
......
......@@ -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 toolErrors; // 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:
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
......@@ -76,7 +83,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
String mark,
String toolErrors,
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 interrupt,
String stderr,
......@@ -100,7 +110,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
this.mark=mark;
this.toolErrors=toolErrors;
this.toolWarnings=toolWarnings;
this.toolInfo=toolInfo;
this.toolInfo=toolInfo;
this.instCapture=instCapture;
this.instSeparator=instSeparator;
this.instSuffix=instSuffix;
this.prompt=prompt;
this.interrupt=interrupt;
this.stderr=stderr;
......@@ -146,7 +159,10 @@ public class CommandLinesBlock extends UpdateableStringsContainer
block.mark,
block.toolErrors,
block.toolWarnings,
block.toolInfo,
block.toolInfo,
block.instCapture,
block.instSeparator,
block.instSuffix,
block.prompt,
block.interrupt,
block.stderr,
......@@ -217,12 +233,17 @@ public class CommandLinesBlock extends UpdateableStringsContainer
public List<String> getLines() { return ConditionUtils.resolveConditionStrings(strings); }
// 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 String getName() { return name; }
public String getSeparator() { return separator; }
public String getMark() { return mark; }
public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; }
public String getInfo() { return toolInfo; }
public String getName() { return name; }
public String getSeparator() { return separator; }
public String getMark() { return mark; }
public String getErrors() { return toolErrors; }
public String getWarnings() { return toolWarnings; }
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 getInterrupt() { return interrupt; }
public String getStderr() { return stderr; }
......
......@@ -44,7 +44,23 @@
visible="true" type="String" format="CopyValue"/>
<parameter id="PatternInfo" label="Info" tooltip= "Regular expression for info messages"
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"
default="true" visible="true" omit="false" type="Boolean" format="None"/>
<parameter id="Drc" label="Drc" tooltip= "Enable problems with [Drc to be reported"
......@@ -123,14 +139,20 @@
"---"
"PatternErrors"
"PatternWarnings"
"PatternInfo"
"PatternInfo"
"InstanceCapture"
"InstanceSeparator"
"InstanceSuffix"
</group>
</input>
<output>
<line name="parser_Vivado"
errors= "PatternErrors"
warnings= "PatternWarnings"
info= "PatternInfo">
info= "PatternInfo"
instance-capture= "InstanceCapture"
instance-separator="InstanceSeparator"
instance-suffix= "InstanceSuffix">
"-c"
"python -u %parsers_path%parser_name %%ToolName | "
"%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