[DEV] add better integration of typedef and using
This commit is contained in:
90
monkArg.py
90
monkArg.py
@@ -4,22 +4,22 @@ import monkDebug as debug
|
|||||||
|
|
||||||
class ArgElement:
|
class ArgElement:
|
||||||
def __init__(self, option, value=""):
|
def __init__(self, option, value=""):
|
||||||
self.m_option = option;
|
self.option = option;
|
||||||
self.m_arg = value;
|
self.arg = value;
|
||||||
|
|
||||||
def get_option_name(self):
|
def get_option_name(self):
|
||||||
return self.m_option
|
return self.option
|
||||||
|
|
||||||
def get_arg(self):
|
def get_arg(self):
|
||||||
return self.m_arg
|
return self.arg
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if len(self.m_arg)==0:
|
if len(self.arg)==0:
|
||||||
debug.info("option : " + self.m_option)
|
debug.info("option : " + self.option)
|
||||||
elif len(self.m_option)==0:
|
elif len(self.option)==0:
|
||||||
debug.info("element : " + self.m_arg)
|
debug.info("element : " + self.arg)
|
||||||
else:
|
else:
|
||||||
debug.info("option : " + self.m_option + ":" + self.m_arg)
|
debug.info("option : " + self.option + ":" + self.arg)
|
||||||
|
|
||||||
|
|
||||||
class ArgDefine:
|
class ArgDefine:
|
||||||
@@ -29,61 +29,61 @@ class ArgDefine:
|
|||||||
list=[], # ["val", "description"]
|
list=[], # ["val", "description"]
|
||||||
desc="",
|
desc="",
|
||||||
haveParam=False):
|
haveParam=False):
|
||||||
self.m_optionSmall = smallOption;
|
self.option_small = smallOption;
|
||||||
self.m_optionBig = bigOption;
|
self.option_big = bigOption;
|
||||||
self.m_list = list;
|
self.list = list;
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
if True==haveParam:
|
if True==haveParam:
|
||||||
self.m_haveParam = True
|
self.have_param = True
|
||||||
else:
|
else:
|
||||||
self.m_haveParam = False
|
self.have_param = False
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return self.m_optionSmall
|
return self.option_small
|
||||||
|
|
||||||
def get_option_big(self):
|
def get_option_big(self):
|
||||||
return self.m_optionBig
|
return self.option_big
|
||||||
|
|
||||||
def need_parameters(self):
|
def need_parameters(self):
|
||||||
return self.m_haveParam
|
return self.have_param
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def check_availlable(self, argument):
|
def check_availlable(self, argument):
|
||||||
if len(self.m_list)==0:
|
if len(self.list)==0:
|
||||||
return True
|
return True
|
||||||
for element,desc in self.m_list:
|
for element,desc in self.list:
|
||||||
if element == argument:
|
if element == argument:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
if self.m_optionSmall != "" and self.m_optionBig != "":
|
if self.option_small != "" and self.option_big != "":
|
||||||
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
|
print(" -" + self.option_small + " / --" + self.option_big)
|
||||||
elif self.m_optionSmall != "":
|
elif self.option_small != "":
|
||||||
print(" -" + self.m_optionSmall)
|
print(" -" + self.option_small)
|
||||||
elif self.m_optionSmall != "":
|
elif self.option_small != "":
|
||||||
print(" --" + self.m_optionBig)
|
print(" --" + self.option_big)
|
||||||
else:
|
else:
|
||||||
print(" ???? ==> internal error ...")
|
print(" ???? ==> internal error ...")
|
||||||
if self.m_description != "":
|
if self.description != "":
|
||||||
print(" " + self.m_description)
|
print(" " + self.description)
|
||||||
if len(self.m_list)!=0:
|
if len(self.list)!=0:
|
||||||
hasDescriptiveElement=False
|
hasDescriptiveElement=False
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if desc!="":
|
if desc!="":
|
||||||
hasDescriptiveElement=True
|
hasDescriptiveElement=True
|
||||||
break;
|
break;
|
||||||
if hasDescriptiveElement==True:
|
if hasDescriptiveElement==True:
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
print(" " + val + " : " + desc)
|
print(" " + val + " : " + desc)
|
||||||
else:
|
else:
|
||||||
tmpElementPrint = ""
|
tmpElementPrint = ""
|
||||||
for val,desc in self.m_list:
|
for val,desc in self.list:
|
||||||
if len(tmpElementPrint)!=0:
|
if len(tmpElementPrint)!=0:
|
||||||
tmpElementPrint += " / "
|
tmpElementPrint += " / "
|
||||||
tmpElementPrint += val
|
tmpElementPrint += val
|
||||||
@@ -97,8 +97,8 @@ class ArgSection:
|
|||||||
def __init__(self,
|
def __init__(self,
|
||||||
sectionName="",
|
sectionName="",
|
||||||
desc=""):
|
desc=""):
|
||||||
self.m_section = sectionName;
|
self.section = sectionName;
|
||||||
self.m_description = desc;
|
self.description = desc;
|
||||||
|
|
||||||
def get_option_small(self):
|
def get_option_small(self):
|
||||||
return ""
|
return ""
|
||||||
@@ -107,10 +107,10 @@ class ArgSection:
|
|||||||
return ""
|
return ""
|
||||||
|
|
||||||
def get_porperties(self):
|
def get_porperties(self):
|
||||||
return " [" + self.m_section + "]"
|
return " [" + self.section + "]"
|
||||||
|
|
||||||
def display(self):
|
def display(self):
|
||||||
print(" [" + self.m_section + "] : " + self.m_description)
|
print(" [" + self.section + "] : " + self.description)
|
||||||
|
|
||||||
def parse(self, argList, currentID):
|
def parse(self, argList, currentID):
|
||||||
return currentID;
|
return currentID;
|
||||||
@@ -118,13 +118,13 @@ class ArgSection:
|
|||||||
|
|
||||||
class MonkArg:
|
class MonkArg:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.m_listProperties = []
|
self.list_properties = []
|
||||||
|
|
||||||
def add(self, argument):
|
def add(self, argument):
|
||||||
self.m_listProperties.append(argument) #argDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
self.list_properties.append(argument) #argDefine(smallOption, bigOption, haveParameter, parameterList, description));
|
||||||
|
|
||||||
def add_section(self, sectionName, sectionDesc):
|
def add_section(self, sectionName, sectionDesc):
|
||||||
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
|
self.list_properties.append(ArgSection(sectionName, sectionDesc))
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
listArgument = [] # composed of list element
|
listArgument = [] # composed of list element
|
||||||
@@ -147,7 +147,7 @@ class MonkArg:
|
|||||||
argumentFound=False;
|
argumentFound=False;
|
||||||
if option[:2]=="--":
|
if option[:2]=="--":
|
||||||
# big argument
|
# big argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.list_properties:
|
||||||
if prop.get_option_big()=="":
|
if prop.get_option_big()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_big() == option[2:]:
|
if prop.get_option_big() == option[2:]:
|
||||||
@@ -189,7 +189,7 @@ class MonkArg:
|
|||||||
debug.error("UNKNOW argument : '" + argument + "'")
|
debug.error("UNKNOW argument : '" + argument + "'")
|
||||||
elif option[:1]=="-":
|
elif option[:1]=="-":
|
||||||
# small argument
|
# small argument
|
||||||
for prop in self.m_listProperties:
|
for prop in self.list_properties:
|
||||||
if prop.get_option_small()=="":
|
if prop.get_option_small()=="":
|
||||||
continue
|
continue
|
||||||
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
|
||||||
@@ -243,8 +243,8 @@ class MonkArg:
|
|||||||
def display(self):
|
def display(self):
|
||||||
print("usage:")
|
print("usage:")
|
||||||
listOfPropertiesArg = "";
|
listOfPropertiesArg = "";
|
||||||
for element in self.m_listProperties :
|
for element in self.list_properties :
|
||||||
listOfPropertiesArg += element.get_porperties()
|
listOfPropertiesArg += element.get_porperties()
|
||||||
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
|
||||||
for element in self.m_listProperties :
|
for element in self.list_properties :
|
||||||
element.display()
|
element.display()
|
30
monkClass.py
30
monkClass.py
@@ -60,11 +60,11 @@ class Class(Node.Node):
|
|||||||
return
|
return
|
||||||
Node.Node.__init__(self, 'class', stack[1], file, lineNumber, documentation)
|
Node.Node.__init__(self, 'class', stack[1], file, lineNumber, documentation)
|
||||||
self.template = templateDeclatation
|
self.template = templateDeclatation
|
||||||
self.subList = []
|
self.sub_list = []
|
||||||
self.access = "private"
|
self.access = "private"
|
||||||
# heritage list :
|
# heritage list :
|
||||||
self.templateType = None
|
self.template_type = None
|
||||||
self.templateTypeStr = ""
|
self.template_type_str = ""
|
||||||
self.inherit = []
|
self.inherit = []
|
||||||
if len(stack) == 2:
|
if len(stack) == 2:
|
||||||
# just a simple class...
|
# just a simple class...
|
||||||
@@ -74,23 +74,23 @@ class Class(Node.Node):
|
|||||||
# This is a template
|
# This is a template
|
||||||
for iii in range(0, len(stack)):
|
for iii in range(0, len(stack)):
|
||||||
if stack[iii] == '>':
|
if stack[iii] == '>':
|
||||||
self.templateType = stack[2:iii]
|
self.template_type = stack[2:iii]
|
||||||
stack = stack[:2] + stack[iii+1:]
|
stack = stack[:2] + stack[iii+1:]
|
||||||
break;
|
break;
|
||||||
# TODO : add tpe in rendering
|
# TODO : add tpe in rendering
|
||||||
if self.templateType == None:
|
if self.template_type == None:
|
||||||
debug.error("error in parsing class : " + str(stack) + " can not parse template property ...")
|
debug.error("error in parsing class : " + str(stack) + " can not parse template property ...")
|
||||||
else:
|
else:
|
||||||
copyTemplateType = self.templateType;
|
copytemplate_type = self.template_type;
|
||||||
self.templateType = []
|
self.template_type = []
|
||||||
self.templateTypeStr = "<"
|
self.template_type_str = "<"
|
||||||
for val in copyTemplateType:
|
for val in copytemplate_type:
|
||||||
if val[0] == '<':
|
if val[0] == '<':
|
||||||
val = val[1:]
|
val = val[1:]
|
||||||
if val != '>':
|
if val != '>':
|
||||||
self.templateType.append(val)
|
self.template_type.append(val)
|
||||||
self.templateTypeStr += val + " "
|
self.template_type_str += val + " "
|
||||||
self.templateTypeStr = ">"
|
self.template_type_str = ">"
|
||||||
if len(stack) == 3:
|
if len(stack) == 3:
|
||||||
debug.error("error in parsing class : " + str(stack))
|
debug.error("error in parsing class : " + str(stack))
|
||||||
return
|
return
|
||||||
@@ -123,7 +123,7 @@ class Class(Node.Node):
|
|||||||
|
|
||||||
def to_str(self) :
|
def to_str(self) :
|
||||||
ret = "class " + self.name
|
ret = "class " + self.name
|
||||||
ret += self.templateTypeStr
|
ret += self.template_type_str
|
||||||
if len(self.inherit) != 0 :
|
if len(self.inherit) != 0 :
|
||||||
ret += " : "
|
ret += " : "
|
||||||
isFirst = True
|
isFirst = True
|
||||||
@@ -155,8 +155,8 @@ class Class(Node.Node):
|
|||||||
if parrentName == self.inherit[0]['class']:
|
if parrentName == self.inherit[0]['class']:
|
||||||
ret.append(self.get_displayable_name())
|
ret.append(self.get_displayable_name())
|
||||||
# set for all sub elements ...
|
# set for all sub elements ...
|
||||||
if self.subList != None:
|
if self.sub_list != None:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
|
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
|
||||||
if len(tmpRet) != 0:
|
if len(tmpRet) != 0:
|
||||||
for tmp in tmpRet:
|
for tmp in tmpRet:
|
||||||
|
20
monkEnum.py
20
monkEnum.py
@@ -4,7 +4,7 @@ import monkNode as Node
|
|||||||
|
|
||||||
class Enum(Node.Node):
|
class Enum(Node.Node):
|
||||||
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
||||||
self.baseValue = 0;
|
self.base_value = 0;
|
||||||
# check input :
|
# check input :
|
||||||
if len(stack) < 1:
|
if len(stack) < 1:
|
||||||
debug.error("Can not parse enum : " + str(stack))
|
debug.error("Can not parse enum : " + str(stack))
|
||||||
@@ -23,7 +23,7 @@ class Enum(Node.Node):
|
|||||||
|
|
||||||
Node.Node.__init__(self, 'enum', localEnumName, file, lineNumber, documentation)
|
Node.Node.__init__(self, 'enum', localEnumName, file, lineNumber, documentation)
|
||||||
|
|
||||||
self.listElement = []
|
self.list_element = []
|
||||||
|
|
||||||
def to_str(self) :
|
def to_str(self) :
|
||||||
return "enum " + self.name + " { ... };"
|
return "enum " + self.name + " { ... };"
|
||||||
@@ -60,23 +60,23 @@ class Enum(Node.Node):
|
|||||||
for tmp in element[2:]:
|
for tmp in element[2:]:
|
||||||
value = tmp
|
value = tmp
|
||||||
if value == "":
|
if value == "":
|
||||||
if self.baseValue == None:
|
if self.base_value == None:
|
||||||
value = "???"
|
value = "???"
|
||||||
else:
|
else:
|
||||||
value = str(self.baseValue)
|
value = str(self.base_value)
|
||||||
self.baseValue += 1
|
self.base_value += 1
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
tmpVal = int(value)
|
tmpVal = int(value)
|
||||||
self.baseValue = tmpVal + 1
|
self.base_value = tmpVal + 1
|
||||||
except:
|
except:
|
||||||
debug.debug("can not parse enum value : '" + value + "'")
|
debug.debug("can not parse enum value : '" + value + "'")
|
||||||
self.baseValue = None
|
self.base_value = None
|
||||||
self.listElement.append({'name' : element[0], 'value' : value, 'doc' : comments})
|
self.list_element.append({'name' : element[0], 'value' : value, 'doc' : comments})
|
||||||
|
|
||||||
debug.verbose("enum list : " + str(self.listElement))
|
debug.verbose("enum list : " + str(self.list_element))
|
||||||
|
|
||||||
def get_enum_list(self):
|
def get_enum_list(self):
|
||||||
return self.listElement
|
return self.list_element
|
||||||
|
|
||||||
|
|
||||||
|
32
monkHtml.py
32
monkHtml.py
@@ -204,6 +204,7 @@ def calculate_methode_size(list):
|
|||||||
methodeSize = 0;
|
methodeSize = 0;
|
||||||
haveVirtual = False
|
haveVirtual = False
|
||||||
for element in list:
|
for element in list:
|
||||||
|
debug.info("node type = " + element['node'].get_node_type())
|
||||||
if element['node'].get_node_type() == 'methode' \
|
if element['node'].get_node_type() == 'methode' \
|
||||||
or element['node'].get_node_type() == 'constructor' \
|
or element['node'].get_node_type() == 'constructor' \
|
||||||
or element['node'].get_node_type() == 'destructor':
|
or element['node'].get_node_type() == 'destructor':
|
||||||
@@ -211,6 +212,8 @@ def calculate_methode_size(list):
|
|||||||
haveVirtual = True
|
haveVirtual = True
|
||||||
if element['node'].get_node_type() == 'variable':
|
if element['node'].get_node_type() == 'variable':
|
||||||
retType = element['node'].get_type().to_str()
|
retType = element['node'].get_type().to_str()
|
||||||
|
elif element['node'].get_node_type() == 'using':
|
||||||
|
retType = ""
|
||||||
else:
|
else:
|
||||||
retType = element['node'].get_return_type().to_str()
|
retType = element['node'].get_return_type().to_str()
|
||||||
tmpLen = len(retType)
|
tmpLen = len(retType)
|
||||||
@@ -241,7 +244,11 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
|
|||||||
else:
|
else:
|
||||||
ret += ' '
|
ret += ' '
|
||||||
|
|
||||||
if element['node'].get_node_type() == 'variable':
|
if element['node'].get_node_type() in ['variable']:
|
||||||
|
if displaySize[2] == True:
|
||||||
|
ret += ' '
|
||||||
|
raw, decorated = element['node'].get_type().to_str_decorated()
|
||||||
|
elif element['node'].get_node_type() in ['using']:
|
||||||
if displaySize[2] == True:
|
if displaySize[2] == True:
|
||||||
ret += ' '
|
ret += ' '
|
||||||
raw, decorated = element['node'].get_type().to_str_decorated()
|
raw, decorated = element['node'].get_type().to_str_decorated()
|
||||||
@@ -270,7 +277,7 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
|
|||||||
else:
|
else:
|
||||||
ret += '<span class="' + classDecoration + '">' + name + '</span>'
|
ret += '<span class="' + classDecoration + '">' + name + '</span>'
|
||||||
|
|
||||||
if element['node'].get_node_type() != 'variable':
|
if element['node'].get_node_type() not in ['variable', 'using']:
|
||||||
ret += white_space(displaySize[1] - len(name)) + ' ('
|
ret += white_space(displaySize[1] - len(name)) + ' ('
|
||||||
listParam = element['node'].get_param()
|
listParam = element['node'].get_param()
|
||||||
first = True
|
first = True
|
||||||
@@ -289,12 +296,14 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
|
|||||||
ret += " "
|
ret += " "
|
||||||
ret += "<span class=\"code-argument\">" + param.get_name() + "</span>"
|
ret += "<span class=\"code-argument\">" + param.get_name() + "</span>"
|
||||||
ret += ')'
|
ret += ')'
|
||||||
if element['node'].get_virtual_pure() == True:
|
|
||||||
ret += ' = 0'
|
|
||||||
if element['node'].get_constant() == True:
|
if element['node'].get_constant() == True:
|
||||||
ret += module.display_color(' const')
|
ret += module.display_color(' const')
|
||||||
if element['node'].get_override() == True:
|
if element['node'].get_override() == True:
|
||||||
ret += module.display_color(' override')
|
ret += module.display_color(' override')
|
||||||
|
if element['node'].get_virtual_pure() == True:
|
||||||
|
ret += ' = 0'
|
||||||
|
if element['node'].get_delete() == True:
|
||||||
|
ret += ' = delete'
|
||||||
|
|
||||||
ret += ';'
|
ret += ';'
|
||||||
ret += '<br/>'
|
ret += '<br/>'
|
||||||
@@ -318,8 +327,8 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
|
|||||||
debug.print_element("code-doc", name_lib, "<==", element.name)
|
debug.print_element("code-doc", name_lib, "<==", element.name)
|
||||||
currentPageSite = element.get_doc_website_page()
|
currentPageSite = element.get_doc_website_page()
|
||||||
namespaceStack = element.get_namespace()
|
namespaceStack = element.get_namespace()
|
||||||
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union']:
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union', 'using']:
|
||||||
listBase = element.get_all_sub_type(['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union'])
|
listBase = element.get_all_sub_type(['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union', 'using'])
|
||||||
for elem in listBase:
|
for elem in listBase:
|
||||||
generate_page(outFolder, header, footer, elem['node'], name_lib)
|
generate_page(outFolder, header, footer, elem['node'], name_lib)
|
||||||
filename = outFolder + '/' + generate_html_page_name(element)
|
filename = outFolder + '/' + generate_html_page_name(element)
|
||||||
@@ -366,7 +375,7 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
|
|||||||
file.write('</ul>\n');
|
file.write('</ul>\n');
|
||||||
|
|
||||||
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
||||||
for nameElement in ['namespace', 'class', 'struct', 'enum', 'union']:
|
for nameElement in ['namespace', 'class', 'struct', 'enum', 'union', 'using']:
|
||||||
listBase = element.get_all_sub_type(nameElement)
|
listBase = element.get_all_sub_type(nameElement)
|
||||||
if len(listBase) == 0:
|
if len(listBase) == 0:
|
||||||
continue
|
continue
|
||||||
@@ -385,12 +394,11 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
|
|||||||
file.write('</ul>\n');
|
file.write('</ul>\n');
|
||||||
|
|
||||||
# calculate element size :
|
# calculate element size :
|
||||||
listBase = element.get_all_sub_type(['methode', 'constructor', 'destructor', 'variable'])
|
listBase = element.get_all_sub_type(['methode', 'constructor', 'destructor', 'variable', 'using'])
|
||||||
displayLen = calculate_methode_size(listBase)
|
displayLen = calculate_methode_size(listBase)
|
||||||
|
|
||||||
if element.get_node_type() == 'class' \
|
if element.get_node_type() == 'class' \
|
||||||
or element.get_node_type() == 'struct':
|
or element.get_node_type() == 'struct':
|
||||||
|
|
||||||
if len(element.get_all_sub_type(['constructor', 'destructor'])) != 0:
|
if len(element.get_all_sub_type(['constructor', 'destructor'])) != 0:
|
||||||
globalWrite = ""
|
globalWrite = ""
|
||||||
listBaseConstructor = element.get_all_sub_type(['constructor'])
|
listBaseConstructor = element.get_all_sub_type(['constructor'])
|
||||||
@@ -411,7 +419,7 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
|
|||||||
file.write('<br/>\n')
|
file.write('<br/>\n')
|
||||||
|
|
||||||
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
|
||||||
listBaseMethode = element.get_all_sub_type(['methode', 'variable'])
|
listBaseMethode = element.get_all_sub_type(['methode', 'variable', 'using'])
|
||||||
if len(listBaseMethode) != 0:
|
if len(listBaseMethode) != 0:
|
||||||
globalWrite = ""
|
globalWrite = ""
|
||||||
globalWriteProperties = ""
|
globalWriteProperties = ""
|
||||||
@@ -697,7 +705,9 @@ def generate(my_lutin_doc, outFolder) :
|
|||||||
continue
|
continue
|
||||||
generic_header += '<ul class="niveau1">'
|
generic_header += '<ul class="niveau1">'
|
||||||
link = node.get_doc_website_page_relative(localWebsite, modd.get_website())
|
link = node.get_doc_website_page_relative(localWebsite, modd.get_website())
|
||||||
if link[-1] != "/":
|
debug.debug("link = " + str(link) + " << " + localWebsite + " !! " + str(modd.get_website()))
|
||||||
|
if len(link) != 0 \
|
||||||
|
and link[-1] != "/":
|
||||||
link += "/"
|
link += "/"
|
||||||
generic_header += '<li><a href="' + link + 'index.html">' + modd.name + '</a></li>\n'
|
generic_header += '<li><a href="' + link + 'index.html">' + modd.name + '</a></li>\n'
|
||||||
generic_header += '</ul>'
|
generic_header += '</ul>'
|
||||||
|
@@ -10,11 +10,12 @@ class Methode(Node.Node):
|
|||||||
type = 'methode'
|
type = 'methode'
|
||||||
self.override = False
|
self.override = False
|
||||||
self.virtual = False
|
self.virtual = False
|
||||||
self.virtualPure = False
|
self.virtual_pure = False
|
||||||
self.static = False
|
self.static = False
|
||||||
self.inline = False
|
self.inline = False
|
||||||
self.const = False # the end of line cont methode is sont for the class ...
|
self.const = False # the end of line cont methode is sont for the class ...
|
||||||
self.noexcept = False
|
self.noexcept = False
|
||||||
|
self.delete = False
|
||||||
|
|
||||||
# remove constructer inside declaration ...
|
# remove constructer inside declaration ...
|
||||||
if ':' in stack:
|
if ':' in stack:
|
||||||
@@ -26,8 +27,9 @@ class Methode(Node.Node):
|
|||||||
break
|
break
|
||||||
stack = res
|
stack = res
|
||||||
|
|
||||||
#check if it is a template class:
|
#check if it is a template methode:
|
||||||
if stack[0] == "template":
|
# note: A methode template can contain multiple methode handle ...
|
||||||
|
while stack[0] == "template":
|
||||||
debug.debug("find a template methode: " + str(stack))
|
debug.debug("find a template methode: " + str(stack))
|
||||||
#remove template properties ==> not manage for now ...
|
#remove template properties ==> not manage for now ...
|
||||||
newStack = []
|
newStack = []
|
||||||
@@ -52,8 +54,14 @@ class Methode(Node.Node):
|
|||||||
if stack[len(stack)-2] == '=' \
|
if stack[len(stack)-2] == '=' \
|
||||||
and stack[len(stack)-1] == '0':
|
and stack[len(stack)-1] == '0':
|
||||||
stack = stack[:len(stack)-2]
|
stack = stack[:len(stack)-2]
|
||||||
self.virtualPure = True
|
self.virtual_pure = True
|
||||||
|
|
||||||
|
if stack[len(stack)-2] == '=' \
|
||||||
|
and stack[len(stack)-1] == 'delete':
|
||||||
|
stack = stack[:len(stack)-2]
|
||||||
|
self.delete = True
|
||||||
|
|
||||||
|
while stack[0] in ['virtual', 'static', 'inline']:
|
||||||
if stack[0] == 'virtual':
|
if stack[0] == 'virtual':
|
||||||
self.virtual = True
|
self.virtual = True
|
||||||
stack = stack[1:]
|
stack = stack[1:]
|
||||||
@@ -63,27 +71,38 @@ class Methode(Node.Node):
|
|||||||
if stack[0] == 'inline':
|
if stack[0] == 'inline':
|
||||||
self.inline = True
|
self.inline = True
|
||||||
stack = stack[1:]
|
stack = stack[1:]
|
||||||
if stack[len(stack)-1] == 'override':
|
while stack[-1] in ['override', 'noexcept', 'const']:
|
||||||
|
if stack[-1] == 'override':
|
||||||
self.override = True
|
self.override = True
|
||||||
stack = stack[:len(stack)-1]
|
stack = stack[:-1]
|
||||||
if stack[len(stack)-1] == 'noexcept':
|
if stack[-1] == 'noexcept':
|
||||||
self.noexcept = True
|
self.noexcept = True
|
||||||
stack = stack[:len(stack)-1]
|
stack = stack[:-1]
|
||||||
if stack[len(stack)-1] == 'const':
|
if stack[-1] == 'const':
|
||||||
self.const = True
|
self.const = True
|
||||||
stack = stack[:len(stack)-1]
|
stack = stack[:-1]
|
||||||
|
|
||||||
namePos = -1
|
|
||||||
|
|
||||||
debug.debug("methode parse : " + str(stack))
|
debug.debug("methode parse : " + str(stack))
|
||||||
for iii in range(0, len(stack)-2):
|
namePos = -1
|
||||||
if stack[iii+1] == '(':
|
# form start to '(' char we will concatenate the name of the function wit template attributes
|
||||||
name = stack[iii]
|
# ex: ['esignal', '::', 'Signal', '<', 'T_ARGS', '>', '::', 'Signal', '(', 'CLASS_TYPE', '*', '_class', ',', 'FUNC_TYPE', '_func', ')']
|
||||||
|
# ==> ['esignal::Signal<T_ARGS>::Signal', '(', 'CLASS_TYPE', '*', '_class', ',', 'FUNC_TYPE', '_func', ')']
|
||||||
|
# find pos of '(':
|
||||||
|
namePos = len(stack)
|
||||||
|
namePosStart = 0
|
||||||
|
for iii in range(0, len(stack)):
|
||||||
|
if stack[iii] == '(':
|
||||||
namePos = iii
|
namePos = iii
|
||||||
break;
|
break;
|
||||||
|
if iii != 0 \
|
||||||
if namePos == 0:
|
and not ( stack[iii-1] in ["::", "<", ">", ","]
|
||||||
debug.debug("start with '" + str(name[0]) + "'")
|
or stack[iii] in ["::", "<", ">", ","]) :
|
||||||
|
namePosStart = iii
|
||||||
|
if namePos == len(stack):
|
||||||
|
debug.error(" can not parse function name :" + str(stack))
|
||||||
|
name = "".join(stack[namePosStart: namePos])
|
||||||
|
if namePosStart == 0:
|
||||||
|
debug.verbose("start with '" + str(name[0]) + "'")
|
||||||
if name[0] == '~':
|
if name[0] == '~':
|
||||||
if className == name[1:]:
|
if className == name[1:]:
|
||||||
type = 'destructor'
|
type = 'destructor'
|
||||||
@@ -93,15 +112,15 @@ class Methode(Node.Node):
|
|||||||
debug.debug("methode name : " + name)
|
debug.debug("methode name : " + name)
|
||||||
Node.Node.__init__(self, type, name, file, lineNumber, documentation)
|
Node.Node.__init__(self, type, name, file, lineNumber, documentation)
|
||||||
|
|
||||||
self.returnType = Type.TypeNone()
|
self.return_type = Type.TypeNone()
|
||||||
self.variable = []
|
self.variable = []
|
||||||
|
|
||||||
# create the return Type (Can be Empty)
|
# create the return Type (Can be Empty)
|
||||||
retTypeStack = stack[:namePos]
|
retTypeStack = stack[:namePosStart]
|
||||||
debug.debug("return : " + str(retTypeStack))
|
debug.debug("return : " + str(retTypeStack))
|
||||||
self.returnType = Type.Type(retTypeStack)
|
self.return_type = Type.Type(retTypeStack)
|
||||||
|
|
||||||
parameterStack = stack[namePos+2:len(stack)-1]
|
parameterStack = stack[namePos+1:len(stack)-1]
|
||||||
debug.debug("parameter : " + str(parameterStack))
|
debug.debug("parameter : " + str(parameterStack))
|
||||||
paramTmp = []
|
paramTmp = []
|
||||||
braceOpen = 0
|
braceOpen = 0
|
||||||
@@ -110,16 +129,16 @@ class Methode(Node.Node):
|
|||||||
if element == ',':
|
if element == ',':
|
||||||
self.variable.append(Variable.Variable(paramTmp))
|
self.variable.append(Variable.Variable(paramTmp))
|
||||||
paramTmp = []
|
paramTmp = []
|
||||||
elif element == '(':
|
elif element in ['(', '<']:
|
||||||
paramTmp.append(element)
|
paramTmp.append(element)
|
||||||
braceOpen += 1
|
braceOpen += 1
|
||||||
else:
|
else:
|
||||||
paramTmp.append(element)
|
paramTmp.append(element)
|
||||||
else:
|
else:
|
||||||
paramTmp.append(element)
|
paramTmp.append(element)
|
||||||
if element == '(':
|
if element in ['(', '<']:
|
||||||
braceOpen += 1
|
braceOpen += 1
|
||||||
elif element == ')':
|
elif element in [')', '>']:
|
||||||
braceOpen -= 1
|
braceOpen -= 1
|
||||||
if len(paramTmp) != 0:
|
if len(paramTmp) != 0:
|
||||||
self.variable.append(Variable.Variable(paramTmp))
|
self.variable.append(Variable.Variable(paramTmp))
|
||||||
@@ -139,7 +158,7 @@ class Methode(Node.Node):
|
|||||||
if self.inline == True:
|
if self.inline == True:
|
||||||
ret += "inline "
|
ret += "inline "
|
||||||
retDecorated += module.display_color("inline") + " "
|
retDecorated += module.display_color("inline") + " "
|
||||||
raw, decorated = self.returnType.to_str_decorated()
|
raw, decorated = self.return_type.to_str_decorated()
|
||||||
ret += raw
|
ret += raw
|
||||||
retDecorated += decorated
|
retDecorated += decorated
|
||||||
ret += " "
|
ret += " "
|
||||||
@@ -147,7 +166,7 @@ class Methode(Node.Node):
|
|||||||
ret += "("
|
ret += "("
|
||||||
# ...
|
# ...
|
||||||
ret += ")"
|
ret += ")"
|
||||||
if self.virtualPure == True:
|
if self.virtual_pure == True:
|
||||||
ret += " = 0"
|
ret += " = 0"
|
||||||
retDecorated += " = 0"
|
retDecorated += " = 0"
|
||||||
if self.const == True:
|
if self.const == True:
|
||||||
@@ -159,6 +178,9 @@ class Methode(Node.Node):
|
|||||||
if self.override == True:
|
if self.override == True:
|
||||||
ret += " override"
|
ret += " override"
|
||||||
retDecorated += " " + module.display_color("override")
|
retDecorated += " " + module.display_color("override")
|
||||||
|
if self.delete == True:
|
||||||
|
ret += " = delete"
|
||||||
|
retDecorated += " = " + module.display_color("delete")
|
||||||
return [ret, retDecorated]
|
return [ret, retDecorated]
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -176,7 +198,14 @@ class Methode(Node.Node):
|
|||||||
## @note Availlable only if the virtual is active
|
## @note Availlable only if the virtual is active
|
||||||
##
|
##
|
||||||
def get_virtual_pure(self):
|
def get_virtual_pure(self):
|
||||||
return self.virtualPure
|
return self.virtual_pure
|
||||||
|
|
||||||
|
##
|
||||||
|
## @brief Get the status of the delete function ( virtual XXX(...) = delete;)
|
||||||
|
## @return True if =delete is present, False otherwise
|
||||||
|
##
|
||||||
|
def get_delete(self):
|
||||||
|
return self.delete
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get the status of the inline function ( inline XXX(...);)
|
## @brief Get the status of the inline function ( inline XXX(...);)
|
||||||
@@ -206,7 +235,7 @@ class Methode(Node.Node):
|
|||||||
## @return Return methode type (type: Type.Type)
|
## @return Return methode type (type: Type.Type)
|
||||||
##
|
##
|
||||||
def get_return_type(self):
|
def get_return_type(self):
|
||||||
return self.returnType
|
return self.return_type
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get the list of parameter of the methode
|
## @brief Get the list of parameter of the methode
|
||||||
|
@@ -9,6 +9,7 @@ import monkNode as Node
|
|||||||
import monkParse as Parse
|
import monkParse as Parse
|
||||||
import monkHtml
|
import monkHtml
|
||||||
import re
|
import re
|
||||||
|
import json
|
||||||
|
|
||||||
class Module:
|
class Module:
|
||||||
##
|
##
|
||||||
@@ -22,21 +23,21 @@ class Module:
|
|||||||
##
|
##
|
||||||
def __init__(self, file, moduleName, moduleType):
|
def __init__(self, file, moduleName, moduleType):
|
||||||
## Remove all variable to prevent error of multiple deffinition of the module ...
|
## Remove all variable to prevent error of multiple deffinition of the module ...
|
||||||
self.originFile=''
|
self.origin_file=''
|
||||||
self.originFolder=''
|
self.origin_folder=''
|
||||||
# type of the module:
|
# type of the module:
|
||||||
self.type='LIBRARY'
|
self.type='LIBRARY'
|
||||||
# Name of the module
|
# Name of the module
|
||||||
self.name=moduleName
|
self.name=moduleName
|
||||||
self.list_doc_file = []
|
self.list_doc_file = []
|
||||||
self.list_tutorial_file = []
|
self.list_tutorial_file = []
|
||||||
self.webSite = ""
|
self.web_site = ""
|
||||||
self.webSource = ""
|
self.web_source = ""
|
||||||
self.pathParsing = ""
|
self.path_parsing = ""
|
||||||
self.pathGlobalDoc = ""
|
self.path_global_doc = ""
|
||||||
self.externalLink = []
|
self.external_link = []
|
||||||
self.title = moduleName + " Library"
|
self.title = moduleName + " Library"
|
||||||
self.styleHtml = ""
|
self.style_html = ""
|
||||||
## end of basic INIT ...
|
## end of basic INIT ...
|
||||||
if moduleType.upper() == 'APPLICATION':
|
if moduleType.upper() == 'APPLICATION':
|
||||||
self.type = 'application'
|
self.type = 'application'
|
||||||
@@ -46,27 +47,27 @@ class Module:
|
|||||||
debug.error('for module "%s"' %moduleName)
|
debug.error('for module "%s"' %moduleName)
|
||||||
debug.error(' ==> error : "%s" ' %moduleType)
|
debug.error(' ==> error : "%s" ' %moduleType)
|
||||||
raise 'Input value error'
|
raise 'Input value error'
|
||||||
self.structureLib = Node.MainNode(self.type, moduleName)
|
self.structure_lib = Node.MainNode(self.type, moduleName)
|
||||||
self.originFile = file;
|
self.origin_file = file;
|
||||||
self.originFolder = tools.get_current_path(self.originFile)
|
self.origin_folder = tools.get_current_path(self.origin_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Set the module website (activate only when compile in release mode, else "../moduleName/)
|
## @brief Set the module web_site (activate only when compile in release mode, else "../moduleName/)
|
||||||
## @param[in] url New Website url
|
## @param[in] url New web_site url
|
||||||
##
|
##
|
||||||
def set_website(self, url):
|
def set_website(self, url):
|
||||||
self.webSite = url
|
self.web_site = url
|
||||||
|
|
||||||
def get_website(self):
|
def get_website(self):
|
||||||
return self.webSite
|
return self.web_site
|
||||||
|
|
||||||
def set_website_sources(self, url):
|
def set_website_sources(self, url):
|
||||||
self.webSource = url
|
self.web_source = url
|
||||||
|
|
||||||
def get_website_sources(self):
|
def get_website_sources(self):
|
||||||
return self.webSource
|
return self.web_source
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -74,21 +75,21 @@ class Module:
|
|||||||
## @param[in] path New path to parse
|
## @param[in] path New path to parse
|
||||||
##
|
##
|
||||||
def set_path(self, path):
|
def set_path(self, path):
|
||||||
self.pathParsing = path
|
self.path_parsing = path
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief set the glabal documentation parsing folder
|
## @brief set the glabal documentation parsing folder
|
||||||
## @param[in] path New path to parse
|
## @param[in] path New path to parse
|
||||||
##
|
##
|
||||||
def set_path_general_doc(self, path):
|
def set_path_general_doc(self, path):
|
||||||
self.pathGlobalDoc = path
|
self.path_global_doc = path
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief List of validate external library link (disable otherwise)
|
## @brief List of validate external library link (disable otherwise)
|
||||||
## @param[in] availlable List of all module link availlable
|
## @param[in] availlable List of all module link availlable
|
||||||
##
|
##
|
||||||
def set_external_link(self, availlable):
|
def set_external_link(self, availlable):
|
||||||
self.externalLink = availlable
|
self.external_link = availlable
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Set the library title
|
## @brief Set the library title
|
||||||
@@ -102,15 +103,15 @@ class Module:
|
|||||||
## @param[in] file File of the css style sheet
|
## @param[in] file File of the css style sheet
|
||||||
##
|
##
|
||||||
def set_html_css(self, cssFile):
|
def set_html_css(self, cssFile):
|
||||||
self.styleHtml = cssFile
|
self.style_html = cssFile
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Create the module documentation:
|
## @brief Create the module documentation:
|
||||||
##
|
##
|
||||||
def parse_code(self):
|
def parse_code(self):
|
||||||
debug.info('Parse documantation code : ' + self.name)
|
debug.info('Parse documantation code : ' + self.name)
|
||||||
if self.pathParsing != "":
|
if self.path_parsing != "":
|
||||||
for root, dirnames, filenames in os.walk(self.pathParsing):
|
for root, dirnames, filenames in os.walk(self.path_parsing):
|
||||||
tmpList = fnmatch.filter(filenames, "*.h")
|
tmpList = fnmatch.filter(filenames, "*.h")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
@@ -118,20 +119,20 @@ class Module:
|
|||||||
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
debug.debug(" Find a file : '" + fileCompleteName + "'")
|
||||||
self.add_file(fileCompleteName)
|
self.add_file(fileCompleteName)
|
||||||
# all file is parset ==> now we create the namespacing of all elements:
|
# all file is parset ==> now we create the namespacing of all elements:
|
||||||
self.structureLib.set_namespace()
|
self.structure_lib.set_namespace()
|
||||||
self.structureLib.set_module_link(self)
|
self.structure_lib.set_module_link(self)
|
||||||
#self.structureLib.complete_display()
|
#self.structure_lib.complete_display()
|
||||||
|
|
||||||
# display the hierarchie of all the class and namespace ...
|
# display the hierarchie of all the class and namespace ...
|
||||||
#self.structureLib.debug_display()
|
#self.structure_lib.debug_display()
|
||||||
if self.pathGlobalDoc != "":
|
if self.path_global_doc != "":
|
||||||
for root, dirnames, filenames in os.walk(self.pathGlobalDoc):
|
for root, dirnames, filenames in os.walk(self.path_global_doc):
|
||||||
tmpList = fnmatch.filter(filenames, "*.bb")
|
tmpList = fnmatch.filter(filenames, "*.bb")
|
||||||
# Import the module :
|
# Import the module :
|
||||||
for filename in tmpList:
|
for filename in tmpList:
|
||||||
fileCompleteName = os.path.join(root, filename)
|
fileCompleteName = os.path.join(root, filename)
|
||||||
tutorialPath = os.path.join(self.pathGlobalDoc, "tutorial/")
|
tutorialPath = os.path.join(self.path_global_doc, "tutorial/")
|
||||||
pathBase = fileCompleteName[len(self.pathGlobalDoc):len(fileCompleteName)-3]
|
pathBase = fileCompleteName[len(self.path_global_doc):len(fileCompleteName)-3]
|
||||||
debug.verbose(" Find a doc file : fileCompleteName='" + fileCompleteName + "'")
|
debug.verbose(" Find a doc file : fileCompleteName='" + fileCompleteName + "'")
|
||||||
if fileCompleteName[:len(tutorialPath)] == tutorialPath:
|
if fileCompleteName[:len(tutorialPath)] == tutorialPath:
|
||||||
self.add_tutorial_doc(fileCompleteName, pathBase)
|
self.add_tutorial_doc(fileCompleteName, pathBase)
|
||||||
@@ -206,7 +207,7 @@ class Module:
|
|||||||
#parsedFile = Parse.parse_file("Widget.h")
|
#parsedFile = Parse.parse_file("Widget.h")
|
||||||
#debug.error("plop")
|
#debug.error("plop")
|
||||||
parsedFile = Parse.parse_file(filename)
|
parsedFile = Parse.parse_file(filename)
|
||||||
self.structureLib = parsedFile.fusion(self.structureLib)
|
self.structure_lib = parsedFile.fusion(self.structure_lib)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -217,14 +218,16 @@ class Module:
|
|||||||
##
|
##
|
||||||
def generate(self):
|
def generate(self):
|
||||||
debug.info('Generate documantation code : ' + self.name)
|
debug.info('Generate documantation code : ' + self.name)
|
||||||
destFolder = "out/doc/" + self.name + '/'
|
#json_data = json.dumps(self, sort_keys=True, indent=4)
|
||||||
|
#tools.file_write_data(os.path.join("out", "doc", self.name + ".json"), json_data)
|
||||||
|
destFolder = os.path.join("out", "doc", self.name)
|
||||||
tools.remove_folder_and_sub_folder(destFolder);
|
tools.remove_folder_and_sub_folder(destFolder);
|
||||||
if monkHtml.generate(self, destFolder) == False:
|
if monkHtml.generate(self, destFolder + '/') == False:
|
||||||
debug.warning("Generation Documentation ==> return an error for " + self.name)
|
debug.warning("Generation Documentation ==> return an error for " + self.name)
|
||||||
|
|
||||||
|
|
||||||
def get_base_doc_node(self):
|
def get_base_doc_node(self):
|
||||||
return self.structureLib
|
return self.structure_lib
|
||||||
|
|
||||||
##
|
##
|
||||||
## @brief Get the heritage list (parent) of one element.
|
## @brief Get the heritage list (parent) of one element.
|
||||||
@@ -234,8 +237,8 @@ class Module:
|
|||||||
def get_heritage_list(self, element):
|
def get_heritage_list(self, element):
|
||||||
list = []
|
list = []
|
||||||
# get element class :
|
# get element class :
|
||||||
if element in self.listClass.keys():
|
if element in self.list_class.keys():
|
||||||
localClass = self.listClass[element]
|
localClass = self.list_class[element]
|
||||||
if len(localClass['inherits']) != 0:
|
if len(localClass['inherits']) != 0:
|
||||||
# TODO : Support multiple heritage ...
|
# TODO : Support multiple heritage ...
|
||||||
isFirst = True
|
isFirst = True
|
||||||
@@ -255,8 +258,8 @@ class Module:
|
|||||||
def get_down_heritage_list(self, curentClassName):
|
def get_down_heritage_list(self, curentClassName):
|
||||||
list = []
|
list = []
|
||||||
# get element class :
|
# get element class :
|
||||||
for element in self.listClass:
|
for element in self.list_class:
|
||||||
localClass = self.listClass[element]
|
localClass = self.list_class[element]
|
||||||
if len(localClass['inherits']) != 0:
|
if len(localClass['inherits']) != 0:
|
||||||
for heritedClass in localClass['inherits']:
|
for heritedClass in localClass['inherits']:
|
||||||
if curentClassName == heritedClass['class']:
|
if curentClassName == heritedClass['class']:
|
||||||
@@ -266,11 +269,11 @@ class Module:
|
|||||||
return list
|
return list
|
||||||
|
|
||||||
def get_whith_specific_parrent(self, name, appName=None):
|
def get_whith_specific_parrent(self, name, appName=None):
|
||||||
if self.structureLib.get_node_type() == "library":
|
if self.structure_lib.get_node_type() == "library":
|
||||||
return self.structureLib.get_whith_specific_parrent(name)
|
return self.structure_lib.get_whith_specific_parrent(name)
|
||||||
if appName != self.structureLib.get_name():
|
if appName != self.structure_lib.get_name():
|
||||||
return []
|
return []
|
||||||
return self.structureLib.get_whith_specific_parrent(name)
|
return self.structure_lib.get_whith_specific_parrent(name)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@ class Namespace(Node.Node):
|
|||||||
debug.error("Can not parse namespace : " + str(stack))
|
debug.error("Can not parse namespace : " + str(stack))
|
||||||
Node.Node.__init__(self, 'namespace', stack[1], file, lineNumber, documentation)
|
Node.Node.__init__(self, 'namespace', stack[1], file, lineNumber, documentation)
|
||||||
# enable sub list
|
# enable sub list
|
||||||
self.subList = []
|
self.sub_list = []
|
||||||
|
|
||||||
debug.verbose("find namespace : " + self.to_str())
|
debug.verbose("find namespace : " + self.to_str())
|
||||||
|
|
||||||
|
136
monkNode.py
136
monkNode.py
@@ -2,7 +2,7 @@
|
|||||||
import monkDebug as debug
|
import monkDebug as debug
|
||||||
import monkModule as module
|
import monkModule as module
|
||||||
|
|
||||||
accessList = ['private', 'protected', 'public']
|
access_list = ['private', 'protected', 'public']
|
||||||
|
|
||||||
def debug_space(level):
|
def debug_space(level):
|
||||||
ret = ""
|
ret = ""
|
||||||
@@ -13,23 +13,23 @@ def debug_space(level):
|
|||||||
genericUID = 0
|
genericUID = 0
|
||||||
|
|
||||||
class Node():
|
class Node():
|
||||||
def __init__(self, type, name="", file="", lineNumber=0, documentation=[]):
|
def __init__(self, type, name="", file="", line_number=0, documentation=[]):
|
||||||
global genericUID
|
global genericUID
|
||||||
genericUID+=1
|
genericUID+=1
|
||||||
self.uid = genericUID
|
self.uid = genericUID
|
||||||
self.documenatationCode = []
|
self.documenatation_code = []
|
||||||
self.nodeType = type
|
self.node_type = type
|
||||||
self.name = name
|
self.name = name
|
||||||
self.doc = None
|
self.doc = None
|
||||||
self.fileName = file
|
self.file_name = file
|
||||||
self.lineNumber = lineNumber
|
self.line_number = line_number
|
||||||
self.subList = None
|
self.sub_list = None
|
||||||
self.access = None
|
self.access = None
|
||||||
# namespace elements : (set when all element are parsed ...
|
# namespace elements : (set when all element are parsed ...
|
||||||
self.namespace = []
|
self.namespace = []
|
||||||
self.moduleLink = None # this is a link on the main application node or library node (usefull to get the website ...)
|
self.module_link = None # this is a link on the main application node or library node (usefull to get the website ...)
|
||||||
self.hiddenRequest = False # @not-in-doc
|
self.hidden_request = False # @not-in-doc
|
||||||
self.previousRequest = False # @previous
|
self.previous_request = False # @previous
|
||||||
self.template = []
|
self.template = []
|
||||||
self.add_doc(documentation)
|
self.add_doc(documentation)
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ class Node():
|
|||||||
return self.to_str()
|
return self.to_str()
|
||||||
|
|
||||||
def get_node_type(self):
|
def get_node_type(self):
|
||||||
return self.nodeType
|
return self.node_type
|
||||||
|
|
||||||
def get_name(self):
|
def get_name(self):
|
||||||
ret = ""
|
ret = ""
|
||||||
@@ -65,18 +65,18 @@ class Node():
|
|||||||
|
|
||||||
def add_doc(self, doc):
|
def add_doc(self, doc):
|
||||||
for element in doc:
|
for element in doc:
|
||||||
self.documenatationCode.append(element)
|
self.documenatation_code.append(element)
|
||||||
if element.find("@not-in-doc") != -1 :
|
if element.find("@not-in-doc") != -1 :
|
||||||
self.hiddenRequest = True
|
self.hidden_request = True
|
||||||
if element.find("@previous") != -1 :
|
if element.find("@previous") != -1 :
|
||||||
self.previousRequest = True
|
self.previous_request = True
|
||||||
|
|
||||||
|
|
||||||
def get_request_hidden(self):
|
def get_request_hidden(self):
|
||||||
return self.hiddenRequest
|
return self.hidden_request
|
||||||
|
|
||||||
def get_request_in_previous(self):
|
def get_request_in_previous(self):
|
||||||
return self.previousRequest
|
return self.previous_request
|
||||||
|
|
||||||
|
|
||||||
def get_displayable_name(self):
|
def get_displayable_name(self):
|
||||||
@@ -91,16 +91,16 @@ class Node():
|
|||||||
|
|
||||||
def get_doc(self):
|
def get_doc(self):
|
||||||
#debug.info(str(self.doc))
|
#debug.info(str(self.doc))
|
||||||
if len(self.documenatationCode) > 0:
|
if len(self.documenatation_code) > 0:
|
||||||
ret = ""
|
ret = ""
|
||||||
isFirst = True
|
isFirst = True
|
||||||
for req in self.documenatationCode:
|
for req in self.documenatation_code:
|
||||||
if isFirst == False:
|
if isFirst == False:
|
||||||
ret += '\n'
|
ret += '\n'
|
||||||
isFirst = False
|
isFirst = False
|
||||||
ret += req
|
ret += req
|
||||||
return ret
|
return ret
|
||||||
if self.nodeType not in ['methode']:
|
if self.node_type not in ['methode']:
|
||||||
return ""
|
return ""
|
||||||
#try to get previous element :
|
#try to get previous element :
|
||||||
if len(self.namespace) == 0:
|
if len(self.namespace) == 0:
|
||||||
@@ -130,35 +130,35 @@ class Node():
|
|||||||
heveMethode, pointerMethode = element.have_methode(self.name)
|
heveMethode, pointerMethode = element.have_methode(self.name)
|
||||||
if heveMethode == False:
|
if heveMethode == False:
|
||||||
continue
|
continue
|
||||||
if len(pointerMethode.documenatationCode) != 0:
|
if len(pointerMethode.documenatation_code) != 0:
|
||||||
return pointerMethode.get_doc()
|
return pointerMethode.get_doc()
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def get_lib_name(self):
|
def get_lib_name(self):
|
||||||
if self.moduleLink == None:
|
if self.module_link == None:
|
||||||
return None
|
return None
|
||||||
return self.moduleLink.get_base_doc_node().get_name()
|
return self.module_link.get_base_doc_node().get_name()
|
||||||
|
|
||||||
def debug_display(self, level=0, access = None):
|
def debug_display(self, level=0, access = None):
|
||||||
if access == 'private':
|
if access == 'private':
|
||||||
debug.info(debug_space(level) + "- " + self.nodeType + " => " + self.name)
|
debug.info(debug_space(level) + "- " + self.node_type + " => " + self.name)
|
||||||
elif access == 'protected':
|
elif access == 'protected':
|
||||||
debug.info(debug_space(level) + "# " + self.nodeType + " => " + self.name)
|
debug.info(debug_space(level) + "# " + self.node_type + " => " + self.name)
|
||||||
elif access == 'public':
|
elif access == 'public':
|
||||||
debug.info(debug_space(level) + "+ " + self.nodeType + " => " + self.name)
|
debug.info(debug_space(level) + "+ " + self.node_type + " => " + self.name)
|
||||||
else:
|
else:
|
||||||
debug.info(debug_space(level) + self.nodeType + " => " + self.name)
|
debug.info(debug_space(level) + self.node_type + " => " + self.name)
|
||||||
if self.subList!= None:
|
if self.sub_list!= None:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
if 'access' in element.keys():
|
if 'access' in element.keys():
|
||||||
element['node'].debug_display(level+1, element['access'])
|
element['node'].debug_display(level+1, element['access'])
|
||||||
else:
|
else:
|
||||||
element['node'].debug_display(level+1)
|
element['node'].debug_display(level+1)
|
||||||
|
|
||||||
def set_access(self, access):
|
def set_access(self, access):
|
||||||
if access not in accessList:
|
if access not in access_list:
|
||||||
debug.warning("This is not a valid access : '" + access + "' : availlable : " + str(accessList))
|
debug.warning("This is not a valid access : '" + access + "' : availlable : " + str(access_list))
|
||||||
return
|
return
|
||||||
if self.access == None:
|
if self.access == None:
|
||||||
debug.error("This Node does not support acces configuration...")
|
debug.error("This Node does not support acces configuration...")
|
||||||
@@ -170,18 +170,18 @@ class Node():
|
|||||||
|
|
||||||
def append(self, newSubElement):
|
def append(self, newSubElement):
|
||||||
# just add it in a sub List :
|
# just add it in a sub List :
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
debug.error("can not add a '" + newSubElement.nodeType + "' at this '" + self.nodeType + "'")
|
debug.error("can not add a '" + newSubElement.node_type + "' at this '" + self.node_type + "'")
|
||||||
return
|
return
|
||||||
if newSubElement.get_node_type() != 'namespace':
|
if newSubElement.get_node_type() != 'namespace':
|
||||||
if self.access == None:
|
if self.access == None:
|
||||||
self.subList.append({'node' : newSubElement})
|
self.sub_list.append({'node' : newSubElement})
|
||||||
else:
|
else:
|
||||||
self.subList.append({'access' : self.access, 'node' : newSubElement})
|
self.sub_list.append({'access' : self.access, 'node' : newSubElement})
|
||||||
return
|
return
|
||||||
|
|
||||||
# check if the element already exist
|
# check if the element already exist
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
if element['node'].get_node_type() == 'namespace':
|
if element['node'].get_node_type() == 'namespace':
|
||||||
if element['node'].get_name() == newSubElement.get_name():
|
if element['node'].get_name() == newSubElement.get_name():
|
||||||
debug.verbose("fusionate with previous declaration")
|
debug.verbose("fusionate with previous declaration")
|
||||||
@@ -189,16 +189,16 @@ class Node():
|
|||||||
return
|
return
|
||||||
# normal case adding :
|
# normal case adding :
|
||||||
if self.access == None:
|
if self.access == None:
|
||||||
self.subList.append({'node' : newSubElement})
|
self.sub_list.append({'node' : newSubElement})
|
||||||
else:
|
else:
|
||||||
self.subList.append({'access' : self.access, 'node' : newSubElement})
|
self.sub_list.append({'access' : self.access, 'node' : newSubElement})
|
||||||
|
|
||||||
##
|
##
|
||||||
## @ brief only for namespace :
|
## @ brief only for namespace :
|
||||||
##
|
##
|
||||||
##
|
##
|
||||||
def fusion(self, addedElement):
|
def fusion(self, addedElement):
|
||||||
for element in addedElement.subList:
|
for element in addedElement.sub_list:
|
||||||
self.append(element['node'])
|
self.append(element['node'])
|
||||||
|
|
||||||
##
|
##
|
||||||
@@ -209,13 +209,13 @@ class Node():
|
|||||||
##
|
##
|
||||||
def get_all_sub_type(self, type='all', sorted = False):
|
def get_all_sub_type(self, type='all', sorted = False):
|
||||||
if type == 'all':
|
if type == 'all':
|
||||||
return self.subList
|
return self.sub_list
|
||||||
if isinstance(type, list) == False:
|
if isinstance(type, list) == False:
|
||||||
type = [type]
|
type = [type]
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return []
|
return []
|
||||||
ret = []
|
ret = []
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
if element['node'].get_node_type() in type:
|
if element['node'].get_node_type() in type:
|
||||||
ret.append(element)
|
ret.append(element)
|
||||||
if sorted == True:
|
if sorted == True:
|
||||||
@@ -224,9 +224,9 @@ class Node():
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def get_doc_website_page(self):
|
def get_doc_website_page(self):
|
||||||
if self.moduleLink == None:
|
if self.module_link == None:
|
||||||
return ""
|
return ""
|
||||||
ret = self.moduleLink.get_website()
|
ret = self.module_link.get_website()
|
||||||
if ret[-1] != '/':
|
if ret[-1] != '/':
|
||||||
ret += '/'
|
ret += '/'
|
||||||
ret += self.get_node_type()
|
ret += self.get_node_type()
|
||||||
@@ -266,15 +266,15 @@ class Node():
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def set_module_link(self, module):
|
def set_module_link(self, module):
|
||||||
self.moduleLink = module
|
self.module_link = module
|
||||||
# set for all sub elements ...
|
# set for all sub elements ...
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return
|
return
|
||||||
if self.nodeType in ['class', 'namespace', 'struct']:
|
if self.node_type in ['class', 'namespace', 'struct']:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
element['node'].set_module_link(module)
|
element['node'].set_module_link(module)
|
||||||
elif self.nodeType in ['library', 'application']:
|
elif self.node_type in ['library', 'application']:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
element['node'].set_module_link(module)
|
element['node'].set_module_link(module)
|
||||||
|
|
||||||
def set_namespace(self, hierarchy = []):
|
def set_namespace(self, hierarchy = []):
|
||||||
@@ -283,16 +283,16 @@ class Node():
|
|||||||
for tmpName in hierarchy:
|
for tmpName in hierarchy:
|
||||||
self.namespace.append(tmpName)
|
self.namespace.append(tmpName)
|
||||||
# set for all sub elements ...
|
# set for all sub elements ...
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return
|
return
|
||||||
if self.nodeType in ['class', 'namespace', 'struct']:
|
if self.node_type in ['class', 'namespace', 'struct']:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
hierarchy.append(self.name)
|
hierarchy.append(self.name)
|
||||||
element['node'].set_namespace(hierarchy)
|
element['node'].set_namespace(hierarchy)
|
||||||
#debug.info(" ==> " + str(element['node'].get_namespace()))
|
#debug.info(" ==> " + str(element['node'].get_namespace()))
|
||||||
hierarchy.pop()
|
hierarchy.pop()
|
||||||
elif self.nodeType in ['library', 'application']:
|
elif self.node_type in ['library', 'application']:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
element['node'].set_namespace()
|
element['node'].set_namespace()
|
||||||
#debug.info(" ==> " + str(element['node'].get_namespace()))
|
#debug.info(" ==> " + str(element['node'].get_namespace()))
|
||||||
|
|
||||||
@@ -301,19 +301,19 @@ class Node():
|
|||||||
|
|
||||||
def complete_display(self):
|
def complete_display(self):
|
||||||
debug.info(str(self.namespace) + ' : ' + self.name)
|
debug.info(str(self.namespace) + ' : ' + self.name)
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return
|
return
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
element['node'].complete_display()
|
element['node'].complete_display()
|
||||||
|
|
||||||
def find(self, list):
|
def find(self, list):
|
||||||
debug.verbose("find : " + str(list) + " in " + self.nodeType + "(" + self.name + ")")
|
debug.verbose("find : " + str(list) + " in " + self.node_type + "(" + self.name + ")")
|
||||||
if len(list) == 0:
|
if len(list) == 0:
|
||||||
return None
|
return None
|
||||||
if self.nodeType in ['library', 'application']:
|
if self.node_type in ['library', 'application']:
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return None
|
return None
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
ret = element['node'].find(list)
|
ret = element['node'].find(list)
|
||||||
if ret != None:
|
if ret != None:
|
||||||
return ret
|
return ret
|
||||||
@@ -323,12 +323,12 @@ class Node():
|
|||||||
tmpList = list[1:]
|
tmpList = list[1:]
|
||||||
if len(tmpList) == 0:
|
if len(tmpList) == 0:
|
||||||
return self
|
return self
|
||||||
elif self.nodeType not in ['class', 'namespace', 'struct']:
|
elif self.node_type not in ['class', 'namespace', 'struct']:
|
||||||
# have other sub element and other elemetn than upper can have sub element ...
|
# have other sub element and other elemetn than upper can have sub element ...
|
||||||
return None
|
return None
|
||||||
if self.subList == None:
|
if self.sub_list == None:
|
||||||
return None
|
return None
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
ret = element['node'].find(tmpList)
|
ret = element['node'].find(tmpList)
|
||||||
if ret != None:
|
if ret != None:
|
||||||
return ret
|
return ret
|
||||||
@@ -338,8 +338,8 @@ class Node():
|
|||||||
def get_whith_specific_parrent(self, parrentName):
|
def get_whith_specific_parrent(self, parrentName):
|
||||||
ret = []
|
ret = []
|
||||||
# set for all sub elements ...
|
# set for all sub elements ...
|
||||||
if self.subList != None:
|
if self.sub_list != None:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
|
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
|
||||||
if len(tmpRet) != 0:
|
if len(tmpRet) != 0:
|
||||||
for tmp in tmpRet:
|
for tmp in tmpRet:
|
||||||
@@ -347,8 +347,8 @@ class Node():
|
|||||||
return ret
|
return ret
|
||||||
|
|
||||||
def have_methode(self, methodeName):
|
def have_methode(self, methodeName):
|
||||||
if self.subList != None:
|
if self.sub_list != None:
|
||||||
for element in self.subList:
|
for element in self.sub_list:
|
||||||
if element['node'].get_node_type() != 'methode':
|
if element['node'].get_node_type() != 'methode':
|
||||||
continue
|
continue
|
||||||
if element['access'] == "private":
|
if element['access'] == "private":
|
||||||
@@ -363,7 +363,7 @@ class Node():
|
|||||||
class MainNode(Node):
|
class MainNode(Node):
|
||||||
def __init__(self, type="library", name=""):
|
def __init__(self, type="library", name=""):
|
||||||
Node.__init__(self, type, name)
|
Node.__init__(self, type, name)
|
||||||
self.subList = []
|
self.sub_list = []
|
||||||
|
|
||||||
def get_doc_website_page_relative(base, dest):
|
def get_doc_website_page_relative(base, dest):
|
||||||
realBase = ""
|
realBase = ""
|
||||||
|
88
monkParse.py
88
monkParse.py
@@ -21,6 +21,8 @@ import monkMethode as Methode
|
|||||||
import monkEnum as Enum
|
import monkEnum as Enum
|
||||||
import monkVariable as Variable
|
import monkVariable as Variable
|
||||||
import monkNode as Node
|
import monkNode as Node
|
||||||
|
import monkUsing as Using
|
||||||
|
import monkTypedef as Typedef
|
||||||
|
|
||||||
tokens = [
|
tokens = [
|
||||||
'NUMBER',
|
'NUMBER',
|
||||||
@@ -178,24 +180,53 @@ lex.lex()
|
|||||||
## @return The new table. ex: ['class', 'Bar::Foo']
|
## @return The new table. ex: ['class', 'Bar::Foo']
|
||||||
##
|
##
|
||||||
def create_compleate_class_name(table):
|
def create_compleate_class_name(table):
|
||||||
debug.warning("table = " + str(table))
|
debug.verbose("table = " + str(table))
|
||||||
if "::" not in "".join(table):
|
# separate ["<XXX"] in ["<", "XXX"]
|
||||||
out = table
|
out = []
|
||||||
|
for name in table:
|
||||||
|
if len(name) > 1 \
|
||||||
|
and name[0] == "<":
|
||||||
|
out.append('<')
|
||||||
|
out.append(name[1:])
|
||||||
else:
|
else:
|
||||||
# we need to convert it :
|
out.append(name)
|
||||||
|
table = out
|
||||||
|
# convert [":", ":"] in ["::"]:
|
||||||
out = []
|
out = []
|
||||||
for name in table:
|
for name in table:
|
||||||
if len(out) == 0:
|
if len(out) == 0:
|
||||||
out.append(name)
|
out.append(name)
|
||||||
elif name == ":" \
|
elif name == ":" \
|
||||||
and out[-1].endswith(":"):
|
and out[-1] == ":":
|
||||||
out[-1] += name
|
out[-1] += name
|
||||||
elif out[-1].endswith("::"):
|
|
||||||
out[-2] += out[-1] + name
|
|
||||||
del out[-1]
|
|
||||||
else:
|
else:
|
||||||
out.append(name)
|
out.append(name)
|
||||||
table = out
|
table = out
|
||||||
|
# convert ["|", "|"] in ["||"]:
|
||||||
|
out = []
|
||||||
|
for name in table:
|
||||||
|
if len(out) == 0:
|
||||||
|
out.append(name)
|
||||||
|
elif name == "|" \
|
||||||
|
and out[-1] == "|":
|
||||||
|
out[-1] += name
|
||||||
|
else:
|
||||||
|
out.append(name)
|
||||||
|
table = out
|
||||||
|
# convert ["&", "&"] in ["&&"]:
|
||||||
|
out = []
|
||||||
|
for name in table:
|
||||||
|
if len(out) == 0:
|
||||||
|
out.append(name)
|
||||||
|
elif name == "&" \
|
||||||
|
and out[-1] == "&&":
|
||||||
|
out[-1] += name
|
||||||
|
else:
|
||||||
|
out.append(name)
|
||||||
|
table = out
|
||||||
|
#
|
||||||
|
|
||||||
|
# join operator ...
|
||||||
if 'operator' not in "".join(table):
|
if 'operator' not in "".join(table):
|
||||||
out = table
|
out = table
|
||||||
else:
|
else:
|
||||||
@@ -212,7 +243,7 @@ def create_compleate_class_name(table):
|
|||||||
out[-1] += name
|
out[-1] += name
|
||||||
else:
|
else:
|
||||||
out.append(name)
|
out.append(name)
|
||||||
debug.warning(" ==> out = " + str(out))
|
debug.verbose(" ==> out = " + str(out))
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
@@ -273,6 +304,7 @@ class parse_file():
|
|||||||
lex.input(headerFileStr)
|
lex.input(headerFileStr)
|
||||||
self.cur_line = 0
|
self.cur_line = 0
|
||||||
self.cur_char = 0
|
self.cur_char = 0
|
||||||
|
self.count_pthese = 0
|
||||||
while True:
|
while True:
|
||||||
tok = lex.token()
|
tok = lex.token()
|
||||||
if not tok:
|
if not tok:
|
||||||
@@ -319,6 +351,11 @@ class parse_file():
|
|||||||
if tok.type == 'COMMENT_SINGLELINE_DOC':
|
if tok.type == 'COMMENT_SINGLELINE_DOC':
|
||||||
self.last_comment.append(tok.value)
|
self.last_comment.append(tok.value)
|
||||||
if tok.type == 'OPEN_BRACE':
|
if tok.type == 'OPEN_BRACE':
|
||||||
|
if self.count_pthese >= 1:
|
||||||
|
# special case of lamba declaration inside initialisation of constructor
|
||||||
|
self.name_stack.append(tok.value)
|
||||||
|
debug.info("plop 0 " +str(self.count_pthese))
|
||||||
|
else:
|
||||||
# When we open a brace, this is the time to parse the stack ...
|
# When we open a brace, this is the time to parse the stack ...
|
||||||
# Clean the stack : (remove \t\r\n , and concatenate the 'xx', ':', ':', 'yy' in 'xx::yy',
|
# Clean the stack : (remove \t\r\n , and concatenate the 'xx', ':', ':', 'yy' in 'xx::yy',
|
||||||
self.name_stack = create_compleate_class_name(self.name_stack)
|
self.name_stack = create_compleate_class_name(self.name_stack)
|
||||||
@@ -340,6 +377,8 @@ class parse_file():
|
|||||||
self.brace_type_push('struct', self.name_stack)
|
self.brace_type_push('struct', self.name_stack)
|
||||||
elif 'typedef' in self.name_stack:
|
elif 'typedef' in self.name_stack:
|
||||||
self.brace_type_push('typedef', self.name_stack)
|
self.brace_type_push('typedef', self.name_stack)
|
||||||
|
elif 'using' in self.name_stack:
|
||||||
|
self.brace_type_push('using', self.name_stack)
|
||||||
elif 'union' in self.name_stack:
|
elif 'union' in self.name_stack:
|
||||||
self.brace_type_push('union', self.name_stack)
|
self.brace_type_push('union', self.name_stack)
|
||||||
else:
|
else:
|
||||||
@@ -348,6 +387,11 @@ class parse_file():
|
|||||||
self.name_stack = []
|
self.name_stack = []
|
||||||
self.last_comment = []
|
self.last_comment = []
|
||||||
elif tok.type == 'CLOSE_BRACE':
|
elif tok.type == 'CLOSE_BRACE':
|
||||||
|
if self.count_pthese >= 1:
|
||||||
|
debug.info("plop 2 " +str(self.count_pthese))
|
||||||
|
# special case of lamba declaration inside initialisation of constructor
|
||||||
|
self.name_stack.append(tok.value)
|
||||||
|
else:
|
||||||
if len(self.name_stack) != 0:
|
if len(self.name_stack) != 0:
|
||||||
if self.previous_is('enum') == True:
|
if self.previous_is('enum') == True:
|
||||||
self.brace_type_append('enum list', self.name_stack);
|
self.brace_type_append('enum list', self.name_stack);
|
||||||
@@ -359,8 +403,10 @@ class parse_file():
|
|||||||
self.brace_type_pop()
|
self.brace_type_pop()
|
||||||
self.name_stack = create_compleate_class_name(self.name_stack)
|
self.name_stack = create_compleate_class_name(self.name_stack)
|
||||||
if tok.type == 'OPEN_PAREN':
|
if tok.type == 'OPEN_PAREN':
|
||||||
|
self.count_pthese += 1
|
||||||
self.name_stack.append(tok.value)
|
self.name_stack.append(tok.value)
|
||||||
elif tok.type == 'CLOSE_PAREN':
|
elif tok.type == 'CLOSE_PAREN':
|
||||||
|
self.count_pthese -= 1
|
||||||
self.name_stack.append(tok.value)
|
self.name_stack.append(tok.value)
|
||||||
elif tok.type == 'OPEN_SQUARE_BRACKET':
|
elif tok.type == 'OPEN_SQUARE_BRACKET':
|
||||||
self.name_stack.append(tok.value)
|
self.name_stack.append(tok.value)
|
||||||
@@ -396,7 +442,7 @@ class parse_file():
|
|||||||
or tok.type == 'CHAR_LITERAL':
|
or tok.type == 'CHAR_LITERAL':
|
||||||
self.name_stack.append(tok.value)
|
self.name_stack.append(tok.value)
|
||||||
elif tok.type == 'COLON':
|
elif tok.type == 'COLON':
|
||||||
if self.name_stack[0] in Node.accessList:
|
if self.name_stack[0] in Node.access_list:
|
||||||
debug.debug(self.gen_debug_space() + "change visibility : " + self.name_stack[0]);
|
debug.debug(self.gen_debug_space() + "change visibility : " + self.name_stack[0]);
|
||||||
self.brace_type_change_access(self.name_stack[0])
|
self.brace_type_change_access(self.name_stack[0])
|
||||||
self.name_stack = []
|
self.name_stack = []
|
||||||
@@ -404,6 +450,11 @@ class parse_file():
|
|||||||
else :
|
else :
|
||||||
self.name_stack.append(tok.value)
|
self.name_stack.append(tok.value)
|
||||||
elif tok.type == 'SEMI_COLON':
|
elif tok.type == 'SEMI_COLON':
|
||||||
|
if self.count_pthese >= 1:
|
||||||
|
debug.info("plop 3 " +str(self.count_pthese))
|
||||||
|
# special case of lamba declaration inside initialisation of constructor
|
||||||
|
self.name_stack.append(tok.value)
|
||||||
|
else:
|
||||||
if len(self.name_stack) != 0:
|
if len(self.name_stack) != 0:
|
||||||
self.name_stack = create_compleate_class_name(self.name_stack)
|
self.name_stack = create_compleate_class_name(self.name_stack)
|
||||||
if is_a_function(self.name_stack):
|
if is_a_function(self.name_stack):
|
||||||
@@ -417,7 +468,11 @@ class parse_file():
|
|||||||
elif 'struct' in self.name_stack:
|
elif 'struct' in self.name_stack:
|
||||||
debug.debug(self.gen_debug_space() + "find a struct DECLARATION : " + str(self.name_stack));
|
debug.debug(self.gen_debug_space() + "find a struct DECLARATION : " + str(self.name_stack));
|
||||||
elif 'typedef' in self.name_stack:
|
elif 'typedef' in self.name_stack:
|
||||||
debug.info(self.gen_debug_space() + "find a typedef DECLARATION : " + str(self.name_stack));
|
debug.warning(self.gen_debug_space() + "find a typedef DECLARATION : " + str(self.name_stack) + " ==> lose it ...");
|
||||||
|
#self.brace_type_push('typedef', self.name_stack);
|
||||||
|
elif 'using' in self.name_stack:
|
||||||
|
debug.info(self.gen_debug_space() + "find a using DECLARATION : " + str(self.name_stack));
|
||||||
|
self.brace_type_append('using', self.name_stack);
|
||||||
elif 'union' in self.name_stack:
|
elif 'union' in self.name_stack:
|
||||||
debug.debug(self.gen_debug_space() + "find a union DECLARATION : " + str(self.name_stack));
|
debug.debug(self.gen_debug_space() + "find a union DECLARATION : " + str(self.name_stack));
|
||||||
else:
|
else:
|
||||||
@@ -449,9 +504,9 @@ class parse_file():
|
|||||||
elif type == 'struct':
|
elif type == 'struct':
|
||||||
ret = Struct.Struct(stack, self.header_file_name, self.cur_line, self.last_comment)
|
ret = Struct.Struct(stack, self.header_file_name, self.cur_line, self.last_comment)
|
||||||
elif type == 'typedef':
|
elif type == 'typedef':
|
||||||
#ret = Namespace.Namespace(stack, self.header_file_name, self.cur_line)
|
ret = Typedef.Typedef(stack, self.header_file_name, self.cur_line)
|
||||||
# TODO ...
|
elif type == 'using':
|
||||||
pass
|
ret = Using.Using(stack, self.header_file_name, self.cur_line)
|
||||||
elif type == 'union':
|
elif type == 'union':
|
||||||
ret = Union.Union(stack, self.header_file_name, self.cur_line, self.last_comment)
|
ret = Union.Union(stack, self.header_file_name, self.cur_line, self.last_comment)
|
||||||
elif type == 'function':
|
elif type == 'function':
|
||||||
@@ -522,7 +577,7 @@ class parse_file():
|
|||||||
self.brace_depth_type.pop()
|
self.brace_depth_type.pop()
|
||||||
|
|
||||||
def brace_type_change_access(self, newOne):
|
def brace_type_change_access(self, newOne):
|
||||||
if newOne not in Node.accessList:
|
if newOne not in Node.access_list:
|
||||||
debug.error("unknow access type : " + newOne)
|
debug.error("unknow access type : " + newOne)
|
||||||
return
|
return
|
||||||
id = len(self.brace_depth_type)-1
|
id = len(self.brace_depth_type)-1
|
||||||
@@ -565,6 +620,9 @@ def is_a_function(stack) :
|
|||||||
if stack[len(stack)-2] == '=' \
|
if stack[len(stack)-2] == '=' \
|
||||||
and stack[len(stack)-1] == '0':
|
and stack[len(stack)-1] == '0':
|
||||||
stack = stack[:len(stack)-2]
|
stack = stack[:len(stack)-2]
|
||||||
|
if stack[len(stack)-2] == '=' \
|
||||||
|
and stack[len(stack)-1] == 'delete':
|
||||||
|
stack = stack[:len(stack)-2]
|
||||||
# find ')' element :
|
# find ')' element :
|
||||||
id = len(stack)-1
|
id = len(stack)-1
|
||||||
while id >= 0:
|
while id >= 0:
|
||||||
|
@@ -7,7 +7,7 @@ class Struct(Node.Node):
|
|||||||
name = ""
|
name = ""
|
||||||
Node.Node.__init__(self, 'struct', name, file, lineNumber, documentation)
|
Node.Node.__init__(self, 'struct', name, file, lineNumber, documentation)
|
||||||
self.access = "public"
|
self.access = "public"
|
||||||
self.subList = []
|
self.sub_list = []
|
||||||
|
|
||||||
|
|
||||||
def to_str(self) :
|
def to_str(self) :
|
||||||
|
12
monkType.py
12
monkType.py
@@ -25,7 +25,8 @@ global_class_link = {
|
|||||||
"std::ostream" : "http://www.cplusplus.com/reference/ostream/ostream/",
|
"std::ostream" : "http://www.cplusplus.com/reference/ostream/ostream/",
|
||||||
"std::shared_ptr": "http://www.cplusplus.com/reference/memory/shared_ptr/",
|
"std::shared_ptr": "http://www.cplusplus.com/reference/memory/shared_ptr/",
|
||||||
"std::weak_ptr" : "http://www.cplusplus.com/reference/memory/weak_ptr/",
|
"std::weak_ptr" : "http://www.cplusplus.com/reference/memory/weak_ptr/",
|
||||||
"std::enable_shared_from_this" : "http://www.cplusplus.com/reference/memory/enable_shared_from_this/"
|
"std::enable_shared_from_this" : "http://www.cplusplus.com/reference/memory/enable_shared_from_this/",
|
||||||
|
"std::function" : "http://www.cplusplus.com/reference/functional/function/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -94,21 +95,20 @@ class Type():
|
|||||||
#Template separator ...
|
#Template separator ...
|
||||||
template_new_elem = True
|
template_new_elem = True
|
||||||
continue
|
continue
|
||||||
if element[0] in ['<']:
|
if element[0] == '<':
|
||||||
debug.info(" Start template")
|
debug.info(" Start template")
|
||||||
if self.template_parameter == None:
|
if self.template_parameter == None:
|
||||||
self.template_parameter = []
|
self.template_parameter = []
|
||||||
if element[1:] != "":
|
|
||||||
self.template_parameter.append(element[1:])
|
|
||||||
template_level += 1
|
template_level += 1
|
||||||
continue
|
continue
|
||||||
if element[0] in ['>']:
|
if element[0] == '>':
|
||||||
template_level -= 1
|
template_level -= 1
|
||||||
debug.info(" Stop template")
|
debug.info(" Stop template")
|
||||||
continue
|
continue
|
||||||
if template_level != 0:
|
if template_level != 0:
|
||||||
if element != "":
|
if element != "":
|
||||||
if template_new_elem == True:
|
if template_new_elem == True \
|
||||||
|
or len(self.template_parameter) == 0:
|
||||||
self.template_parameter.append(element)
|
self.template_parameter.append(element)
|
||||||
else:
|
else:
|
||||||
self.template_parameter[-1] += " " + element
|
self.template_parameter[-1] += " " + element
|
||||||
|
15
monkTypedef.py
Normal file
15
monkTypedef.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import monkDebug as debug
|
||||||
|
import monkNode as Node
|
||||||
|
|
||||||
|
class Typedef(Node.Node):
|
||||||
|
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
||||||
|
name = ""
|
||||||
|
debug.warning(" typedef : " + str(stack))
|
||||||
|
Node.Node.__init__(self, 'typedef', name, file, lineNumber, documentation)
|
||||||
|
|
||||||
|
|
||||||
|
def to_str(self) :
|
||||||
|
return "typedef " + self.name + " { ... };"
|
||||||
|
|
||||||
|
|
19
monkUsing.py
Normal file
19
monkUsing.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
import monkDebug as debug
|
||||||
|
import monkNode as Node
|
||||||
|
import monkType as Type
|
||||||
|
|
||||||
|
class Using(Node.Node):
|
||||||
|
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
|
||||||
|
name = stack[1]
|
||||||
|
self.access = "public"
|
||||||
|
Node.Node.__init__(self, 'using', name, file, lineNumber, documentation)
|
||||||
|
self.type = Type.Type(stack[3:])
|
||||||
|
debug.verbose(" using : " + str(stack) + " name=" + name + " " + self.type.to_str())
|
||||||
|
|
||||||
|
def to_str(self) :
|
||||||
|
return "using " + self.name + " { ... };"
|
||||||
|
|
||||||
|
def get_type(self):
|
||||||
|
return self.type
|
||||||
|
|
@@ -34,7 +34,7 @@ class Variable(Node.Node):
|
|||||||
|
|
||||||
Node.Node.__init__(self, 'variable', name, file, lineNumber, documentation)
|
Node.Node.__init__(self, 'variable', name, file, lineNumber, documentation)
|
||||||
# force the sublist error generation ...
|
# force the sublist error generation ...
|
||||||
self.subList = None
|
self.sub_list = None
|
||||||
# default variable :
|
# default variable :
|
||||||
self.type = Type.TypeNone()
|
self.type = Type.TypeNone()
|
||||||
self.static = False
|
self.static = False
|
||||||
|
Reference in New Issue
Block a user