Commit e72c8dd2 authored by Andrey Filippov's avatar Andrey Filippov

made python-based parser script for Vivado

parent 06b222bd
......@@ -5,21 +5,21 @@ tool="EXTERNAL_TOOL"
if len(sys.argv)>1:
tool=sys.argv[1]
def isProblem(str):
if str.startswith("ERROR:") or str.startswith("WARNING:") or str.startswith("INFO:"):
def isProblem(string):
if string.startswith("ERROR:") or string.startswith("WARNING:") or string.startswith("INFO:"):
return True
return False
def hasLine(str):
if '" Line ' in str:
def hasLine(string):
if '" Line ' in string:
return True
return False
def addTool(str,tool):
if hasLine(str):
return str
def addTool(string,tool):
if hasLine(string):
return string
else:
index=str.find(" - ")+3
return str[:index]+(" \"%s\" Line 0000:"%tool)+str[index:]
# return str[:len(str)-1]+(" \"%s\" Line 0000:"%tool)+"\n"
index=string.find(" - ")+3
return string[:index]+(" \"%s\" Line 0000:"%tool)+string[index:]
# return string[:len(string)-1]+(" \"%s\" Line 0000:"%tool)+"\n"
pline=""
......
#!/usr/bin/env python
##/usr/bin/python -u
import sys
import re
pattern=re.compile("\[[^[:]*:\d*]")
tool="EXTERNAL_TOOL"
if len(sys.argv)>1:
tool=sys.argv[1]
def isProblem(string):
if string.startswith("ERROR:") or string.startswith("WARNING:") or string.startswith("INFO:"):
return True
return False
#def hasLine(string):
# if '" Line ' in string:
# return True
# return False
#Problem string has "[filename:line_number]"
def hasFileVivado(string): # [*:*]
if pattern.findall(string):
return True
return False
#add [tool_name:0000] if there is no {file:line_no] to generate Eclipse problem marker
def addTool(string,tool):
if hasFileVivado(string):
return string
else:
return string[:len(string)-1]+"[%s:0000]"%tool+string[len(string)-1]
pline=""
for line in iter(sys.stdin.readline,''):
if isProblem(pline):
if line.startswith(" ") :
pline = pline[:len(pline)-1]+line[2:]
else:
sys.stdout.write(addTool(pline,tool))
pline = line
else:
pline = line
if isProblem(pline):
sys.stdout.write(addTool(pline,tool))
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