[DEV] add better integration of typedef and using

This commit is contained in:
Edouard DUPIN 2016-03-25 22:52:03 +01:00
parent 8ace149e4f
commit 6740941590
14 changed files with 460 additions and 326 deletions

View File

@ -4,22 +4,22 @@ import monkDebug as debug
class ArgElement:
def __init__(self, option, value=""):
self.m_option = option;
self.m_arg = value;
self.option = option;
self.arg = value;
def get_option_name(self):
return self.m_option
return self.option
def get_arg(self):
return self.m_arg
return self.arg
def display(self):
if len(self.m_arg)==0:
debug.info("option : " + self.m_option)
elif len(self.m_option)==0:
debug.info("element : " + self.m_arg)
if len(self.arg)==0:
debug.info("option : " + self.option)
elif len(self.option)==0:
debug.info("element : " + self.arg)
else:
debug.info("option : " + self.m_option + ":" + self.m_arg)
debug.info("option : " + self.option + ":" + self.arg)
class ArgDefine:
@ -29,61 +29,61 @@ class ArgDefine:
list=[], # ["val", "description"]
desc="",
haveParam=False):
self.m_optionSmall = smallOption;
self.m_optionBig = bigOption;
self.m_list = list;
if len(self.m_list)!=0:
self.m_haveParam = True
self.option_small = smallOption;
self.option_big = bigOption;
self.list = list;
if len(self.list)!=0:
self.have_param = True
else:
if True==haveParam:
self.m_haveParam = True
self.have_param = True
else:
self.m_haveParam = False
self.m_description = desc;
self.have_param = False
self.description = desc;
def get_option_small(self):
return self.m_optionSmall
return self.option_small
def get_option_big(self):
return self.m_optionBig
return self.option_big
def need_parameters(self):
return self.m_haveParam
return self.have_param
def get_porperties(self):
return ""
def check_availlable(self, argument):
if len(self.m_list)==0:
if len(self.list)==0:
return True
for element,desc in self.m_list:
for element,desc in self.list:
if element == argument:
return True
return False
def display(self):
if self.m_optionSmall != "" and self.m_optionBig != "":
print(" -" + self.m_optionSmall + " / --" + self.m_optionBig)
elif self.m_optionSmall != "":
print(" -" + self.m_optionSmall)
elif self.m_optionSmall != "":
print(" --" + self.m_optionBig)
if self.option_small != "" and self.option_big != "":
print(" -" + self.option_small + " / --" + self.option_big)
elif self.option_small != "":
print(" -" + self.option_small)
elif self.option_small != "":
print(" --" + self.option_big)
else:
print(" ???? ==> internal error ...")
if self.m_description != "":
print(" " + self.m_description)
if len(self.m_list)!=0:
if self.description != "":
print(" " + self.description)
if len(self.list)!=0:
hasDescriptiveElement=False
for val,desc in self.m_list:
for val,desc in self.list:
if desc!="":
hasDescriptiveElement=True
break;
if hasDescriptiveElement==True:
for val,desc in self.m_list:
for val,desc in self.list:
print(" " + val + " : " + desc)
else:
tmpElementPrint = ""
for val,desc in self.m_list:
for val,desc in self.list:
if len(tmpElementPrint)!=0:
tmpElementPrint += " / "
tmpElementPrint += val
@ -97,8 +97,8 @@ class ArgSection:
def __init__(self,
sectionName="",
desc=""):
self.m_section = sectionName;
self.m_description = desc;
self.section = sectionName;
self.description = desc;
def get_option_small(self):
return ""
@ -107,10 +107,10 @@ class ArgSection:
return ""
def get_porperties(self):
return " [" + self.m_section + "]"
return " [" + self.section + "]"
def display(self):
print(" [" + self.m_section + "] : " + self.m_description)
print(" [" + self.section + "] : " + self.description)
def parse(self, argList, currentID):
return currentID;
@ -118,13 +118,13 @@ class ArgSection:
class MonkArg:
def __init__(self):
self.m_listProperties = []
self.list_properties = []
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):
self.m_listProperties.append(ArgSection(sectionName, sectionDesc))
self.list_properties.append(ArgSection(sectionName, sectionDesc))
def parse(self):
listArgument = [] # composed of list element
@ -147,7 +147,7 @@ class MonkArg:
argumentFound=False;
if option[:2]=="--":
# big argument
for prop in self.m_listProperties:
for prop in self.list_properties:
if prop.get_option_big()=="":
continue
if prop.get_option_big() == option[2:]:
@ -189,7 +189,7 @@ class MonkArg:
debug.error("UNKNOW argument : '" + argument + "'")
elif option[:1]=="-":
# small argument
for prop in self.m_listProperties:
for prop in self.list_properties:
if prop.get_option_small()=="":
continue
if prop.get_option_small() == option[1:1+len(prop.get_option_small())]:
@ -243,8 +243,8 @@ class MonkArg:
def display(self):
print("usage:")
listOfPropertiesArg = "";
for element in self.m_listProperties :
for element in self.list_properties :
listOfPropertiesArg += element.get_porperties()
print(" " + sys.argv[0] + listOfPropertiesArg + " ...")
for element in self.m_listProperties :
for element in self.list_properties :
element.display()

View File

@ -60,11 +60,11 @@ class Class(Node.Node):
return
Node.Node.__init__(self, 'class', stack[1], file, lineNumber, documentation)
self.template = templateDeclatation
self.subList = []
self.sub_list = []
self.access = "private"
# heritage list :
self.templateType = None
self.templateTypeStr = ""
self.template_type = None
self.template_type_str = ""
self.inherit = []
if len(stack) == 2:
# just a simple class...
@ -74,23 +74,23 @@ class Class(Node.Node):
# This is a template
for iii in range(0, len(stack)):
if stack[iii] == '>':
self.templateType = stack[2:iii]
self.template_type = stack[2:iii]
stack = stack[:2] + stack[iii+1:]
break;
# 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 ...")
else:
copyTemplateType = self.templateType;
self.templateType = []
self.templateTypeStr = "<"
for val in copyTemplateType:
copytemplate_type = self.template_type;
self.template_type = []
self.template_type_str = "<"
for val in copytemplate_type:
if val[0] == '<':
val = val[1:]
if val != '>':
self.templateType.append(val)
self.templateTypeStr += val + " "
self.templateTypeStr = ">"
self.template_type.append(val)
self.template_type_str += val + " "
self.template_type_str = ">"
if len(stack) == 3:
debug.error("error in parsing class : " + str(stack))
return
@ -123,7 +123,7 @@ class Class(Node.Node):
def to_str(self) :
ret = "class " + self.name
ret += self.templateTypeStr
ret += self.template_type_str
if len(self.inherit) != 0 :
ret += " : "
isFirst = True
@ -155,8 +155,8 @@ class Class(Node.Node):
if parrentName == self.inherit[0]['class']:
ret.append(self.get_displayable_name())
# set for all sub elements ...
if self.subList != None:
for element in self.subList:
if self.sub_list != None:
for element in self.sub_list:
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
if len(tmpRet) != 0:
for tmp in tmpRet:

View File

@ -4,7 +4,7 @@ import monkNode as Node
class Enum(Node.Node):
def __init__(self, stack=[], file="", lineNumber=0, documentation=[]):
self.baseValue = 0;
self.base_value = 0;
# check input :
if len(stack) < 1:
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)
self.listElement = []
self.list_element = []
def to_str(self) :
return "enum " + self.name + " { ... };"
@ -60,23 +60,23 @@ class Enum(Node.Node):
for tmp in element[2:]:
value = tmp
if value == "":
if self.baseValue == None:
if self.base_value == None:
value = "???"
else:
value = str(self.baseValue)
self.baseValue += 1
value = str(self.base_value)
self.base_value += 1
else:
try:
tmpVal = int(value)
self.baseValue = tmpVal + 1
self.base_value = tmpVal + 1
except:
debug.debug("can not parse enum value : '" + value + "'")
self.baseValue = None
self.listElement.append({'name' : element[0], 'value' : value, 'doc' : comments})
self.base_value = None
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):
return self.listElement
return self.list_element

View File

@ -204,6 +204,7 @@ def calculate_methode_size(list):
methodeSize = 0;
haveVirtual = False
for element in list:
debug.info("node type = " + element['node'].get_node_type())
if element['node'].get_node_type() == 'methode' \
or element['node'].get_node_type() == 'constructor' \
or element['node'].get_node_type() == 'destructor':
@ -211,6 +212,8 @@ def calculate_methode_size(list):
haveVirtual = True
if element['node'].get_node_type() == 'variable':
retType = element['node'].get_type().to_str()
elif element['node'].get_node_type() == 'using':
retType = ""
else:
retType = element['node'].get_return_type().to_str()
tmpLen = len(retType)
@ -241,7 +244,11 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
else:
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:
ret += ' '
raw, decorated = element['node'].get_type().to_str_decorated()
@ -270,7 +277,7 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
else:
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)) + ' ('
listParam = element['node'].get_param()
first = True
@ -289,12 +296,14 @@ def write_methode(element, namespaceStack, displaySize = None, link = True):
ret += " "
ret += "<span class=\"code-argument\">" + param.get_name() + "</span>"
ret += ')'
if element['node'].get_virtual_pure() == True:
ret += ' = 0'
if element['node'].get_constant() == True:
ret += module.display_color(' const')
if element['node'].get_override() == True:
ret += module.display_color(' override')
if element['node'].get_virtual_pure() == True:
ret += ' = 0'
if element['node'].get_delete() == True:
ret += ' = delete'
ret += ';'
ret += '<br/>'
@ -318,8 +327,8 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
debug.print_element("code-doc", name_lib, "<==", element.name)
currentPageSite = element.get_doc_website_page()
namespaceStack = element.get_namespace()
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct', 'enum', 'union']:
listBase = element.get_all_sub_type(['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', 'using'])
for elem in listBase:
generate_page(outFolder, header, footer, elem['node'], name_lib)
filename = outFolder + '/' + generate_html_page_name(element)
@ -366,7 +375,7 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
file.write('</ul>\n');
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)
if len(listBase) == 0:
continue
@ -385,12 +394,11 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
file.write('</ul>\n');
# 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)
if element.get_node_type() == 'class' \
or element.get_node_type() == 'struct':
if len(element.get_all_sub_type(['constructor', 'destructor'])) != 0:
globalWrite = ""
listBaseConstructor = element.get_all_sub_type(['constructor'])
@ -411,7 +419,7 @@ def generate_page(outFolder, header, footer, element, name_lib=""):
file.write('<br/>\n')
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:
globalWrite = ""
globalWriteProperties = ""
@ -697,7 +705,9 @@ def generate(my_lutin_doc, outFolder) :
continue
generic_header += '<ul class="niveau1">'
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 += "/"
generic_header += '<li><a href="' + link + 'index.html">' + modd.name + '</a></li>\n'
generic_header += '</ul>'

View File

@ -10,11 +10,12 @@ class Methode(Node.Node):
type = 'methode'
self.override = False
self.virtual = False
self.virtualPure = False
self.virtual_pure = False
self.static = False
self.inline = False
self.const = False # the end of line cont methode is sont for the class ...
self.noexcept = False
self.delete = False
# remove constructer inside declaration ...
if ':' in stack:
@ -26,8 +27,9 @@ class Methode(Node.Node):
break
stack = res
#check if it is a template class:
if stack[0] == "template":
#check if it is a template methode:
# note: A methode template can contain multiple methode handle ...
while stack[0] == "template":
debug.debug("find a template methode: " + str(stack))
#remove template properties ==> not manage for now ...
newStack = []
@ -52,38 +54,55 @@ class Methode(Node.Node):
if stack[len(stack)-2] == '=' \
and stack[len(stack)-1] == '0':
stack = stack[:len(stack)-2]
self.virtualPure = True
self.virtual_pure = True
if stack[0] == 'virtual':
self.virtual = True
stack = stack[1:]
if stack[0] == 'static':
self.static = True
stack = stack[1:]
if stack[0] == 'inline':
self.inline = True
stack = stack[1:]
if stack[len(stack)-1] == 'override':
self.override = True
stack = stack[:len(stack)-1]
if stack[len(stack)-1] == 'noexcept':
self.noexcept = True
stack = stack[:len(stack)-1]
if stack[len(stack)-1] == 'const':
self.const = True
stack = stack[:len(stack)-1]
if stack[len(stack)-2] == '=' \
and stack[len(stack)-1] == 'delete':
stack = stack[:len(stack)-2]
self.delete = True
namePos = -1
while stack[0] in ['virtual', 'static', 'inline']:
if stack[0] == 'virtual':
self.virtual = True
stack = stack[1:]
if stack[0] == 'static':
self.static = True
stack = stack[1:]
if stack[0] == 'inline':
self.inline = True
stack = stack[1:]
while stack[-1] in ['override', 'noexcept', 'const']:
if stack[-1] == 'override':
self.override = True
stack = stack[:-1]
if stack[-1] == 'noexcept':
self.noexcept = True
stack = stack[:-1]
if stack[-1] == 'const':
self.const = True
stack = stack[:-1]
debug.debug("methode parse : " + str(stack))
for iii in range(0, len(stack)-2):
if stack[iii+1] == '(':
name = stack[iii]
namePos = -1
# form start to '(' char we will concatenate the name of the function wit template attributes
# 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
break;
if namePos == 0:
debug.debug("start with '" + str(name[0]) + "'")
if iii != 0 \
and not ( stack[iii-1] in ["::", "<", ">", ","]
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 className == name[1:]:
type = 'destructor'
@ -93,15 +112,15 @@ class Methode(Node.Node):
debug.debug("methode name : " + name)
Node.Node.__init__(self, type, name, file, lineNumber, documentation)
self.returnType = Type.TypeNone()
self.return_type = Type.TypeNone()
self.variable = []
# create the return Type (Can be Empty)
retTypeStack = stack[:namePos]
retTypeStack = stack[:namePosStart]
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))
paramTmp = []
braceOpen = 0
@ -110,16 +129,16 @@ class Methode(Node.Node):
if element == ',':
self.variable.append(Variable.Variable(paramTmp))
paramTmp = []
elif element == '(':
elif element in ['(', '<']:
paramTmp.append(element)
braceOpen += 1
else:
paramTmp.append(element)
else:
paramTmp.append(element)
if element == '(':
if element in ['(', '<']:
braceOpen += 1
elif element == ')':
elif element in [')', '>']:
braceOpen -= 1
if len(paramTmp) != 0:
self.variable.append(Variable.Variable(paramTmp))
@ -139,7 +158,7 @@ class Methode(Node.Node):
if self.inline == True:
ret += "inline "
retDecorated += module.display_color("inline") + " "
raw, decorated = self.returnType.to_str_decorated()
raw, decorated = self.return_type.to_str_decorated()
ret += raw
retDecorated += decorated
ret += " "
@ -147,7 +166,7 @@ class Methode(Node.Node):
ret += "("
# ...
ret += ")"
if self.virtualPure == True:
if self.virtual_pure == True:
ret += " = 0"
retDecorated += " = 0"
if self.const == True:
@ -159,6 +178,9 @@ class Methode(Node.Node):
if self.override == True:
ret += " override"
retDecorated += " " + module.display_color("override")
if self.delete == True:
ret += " = delete"
retDecorated += " = " + module.display_color("delete")
return [ret, retDecorated]
##
@ -176,7 +198,14 @@ class Methode(Node.Node):
## @note Availlable only if the virtual is active
##
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(...);)
@ -206,7 +235,7 @@ class Methode(Node.Node):
## @return Return methode type (type: Type.Type)
##
def get_return_type(self):
return self.returnType
return self.return_type
##
## @brief Get the list of parameter of the methode

View File

@ -9,6 +9,7 @@ import monkNode as Node
import monkParse as Parse
import monkHtml
import re
import json
class Module:
##
@ -22,21 +23,21 @@ class Module:
##
def __init__(self, file, moduleName, moduleType):
## Remove all variable to prevent error of multiple deffinition of the module ...
self.originFile=''
self.originFolder=''
self.origin_file=''
self.origin_folder=''
# type of the module:
self.type='LIBRARY'
# Name of the module
self.name=moduleName
self.list_doc_file = []
self.list_tutorial_file = []
self.webSite = ""
self.webSource = ""
self.pathParsing = ""
self.pathGlobalDoc = ""
self.externalLink = []
self.web_site = ""
self.web_source = ""
self.path_parsing = ""
self.path_global_doc = ""
self.external_link = []
self.title = moduleName + " Library"
self.styleHtml = ""
self.style_html = ""
## end of basic INIT ...
if moduleType.upper() == 'APPLICATION':
self.type = 'application'
@ -46,27 +47,27 @@ class Module:
debug.error('for module "%s"' %moduleName)
debug.error(' ==> error : "%s" ' %moduleType)
raise 'Input value error'
self.structureLib = Node.MainNode(self.type, moduleName)
self.originFile = file;
self.originFolder = tools.get_current_path(self.originFile)
self.structure_lib = Node.MainNode(self.type, moduleName)
self.origin_file = file;
self.origin_folder = tools.get_current_path(self.origin_file)
##
## @brief Set the module website (activate only when compile in release mode, else "../moduleName/)
## @param[in] url New Website url
## @brief Set the module web_site (activate only when compile in release mode, else "../moduleName/)
## @param[in] url New web_site url
##
def set_website(self, url):
self.webSite = url
self.web_site = url
def get_website(self):
return self.webSite
return self.web_site
def set_website_sources(self, url):
self.webSource = url
self.web_source = url
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
##
def set_path(self, path):
self.pathParsing = path
self.path_parsing = path
##
## @brief set the glabal documentation parsing folder
## @param[in] path New path to parse
##
def set_path_general_doc(self, path):
self.pathGlobalDoc = path
self.path_global_doc = path
##
## @brief List of validate external library link (disable otherwise)
## @param[in] availlable List of all module link availlable
##
def set_external_link(self, availlable):
self.externalLink = availlable
self.external_link = availlable
##
## @brief Set the library title
@ -102,15 +103,15 @@ class Module:
## @param[in] file File of the css style sheet
##
def set_html_css(self, cssFile):
self.styleHtml = cssFile
self.style_html = cssFile
##
## @brief Create the module documentation:
##
def parse_code(self):
debug.info('Parse documantation code : ' + self.name)
if self.pathParsing != "":
for root, dirnames, filenames in os.walk(self.pathParsing):
if self.path_parsing != "":
for root, dirnames, filenames in os.walk(self.path_parsing):
tmpList = fnmatch.filter(filenames, "*.h")
# Import the module :
for filename in tmpList:
@ -118,20 +119,20 @@ class Module:
debug.debug(" Find a file : '" + fileCompleteName + "'")
self.add_file(fileCompleteName)
# all file is parset ==> now we create the namespacing of all elements:
self.structureLib.set_namespace()
self.structureLib.set_module_link(self)
#self.structureLib.complete_display()
self.structure_lib.set_namespace()
self.structure_lib.set_module_link(self)
#self.structure_lib.complete_display()
# display the hierarchie of all the class and namespace ...
#self.structureLib.debug_display()
if self.pathGlobalDoc != "":
for root, dirnames, filenames in os.walk(self.pathGlobalDoc):
#self.structure_lib.debug_display()
if self.path_global_doc != "":
for root, dirnames, filenames in os.walk(self.path_global_doc):
tmpList = fnmatch.filter(filenames, "*.bb")
# Import the module :
for filename in tmpList:
fileCompleteName = os.path.join(root, filename)
tutorialPath = os.path.join(self.pathGlobalDoc, "tutorial/")
pathBase = fileCompleteName[len(self.pathGlobalDoc):len(fileCompleteName)-3]
tutorialPath = os.path.join(self.path_global_doc, "tutorial/")
pathBase = fileCompleteName[len(self.path_global_doc):len(fileCompleteName)-3]
debug.verbose(" Find a doc file : fileCompleteName='" + fileCompleteName + "'")
if fileCompleteName[:len(tutorialPath)] == tutorialPath:
self.add_tutorial_doc(fileCompleteName, pathBase)
@ -206,7 +207,7 @@ class Module:
#parsedFile = Parse.parse_file("Widget.h")
#debug.error("plop")
parsedFile = Parse.parse_file(filename)
self.structureLib = parsedFile.fusion(self.structureLib)
self.structure_lib = parsedFile.fusion(self.structure_lib)
return True
@ -217,14 +218,16 @@ class Module:
##
def generate(self):
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);
if monkHtml.generate(self, destFolder) == False:
if monkHtml.generate(self, destFolder + '/') == False:
debug.warning("Generation Documentation ==> return an error for " + self.name)
def get_base_doc_node(self):
return self.structureLib
return self.structure_lib
##
## @brief Get the heritage list (parent) of one element.
@ -234,8 +237,8 @@ class Module:
def get_heritage_list(self, element):
list = []
# get element class :
if element in self.listClass.keys():
localClass = self.listClass[element]
if element in self.list_class.keys():
localClass = self.list_class[element]
if len(localClass['inherits']) != 0:
# TODO : Support multiple heritage ...
isFirst = True
@ -255,8 +258,8 @@ class Module:
def get_down_heritage_list(self, curentClassName):
list = []
# get element class :
for element in self.listClass:
localClass = self.listClass[element]
for element in self.list_class:
localClass = self.list_class[element]
if len(localClass['inherits']) != 0:
for heritedClass in localClass['inherits']:
if curentClassName == heritedClass['class']:
@ -266,11 +269,11 @@ class Module:
return list
def get_whith_specific_parrent(self, name, appName=None):
if self.structureLib.get_node_type() == "library":
return self.structureLib.get_whith_specific_parrent(name)
if appName != self.structureLib.get_name():
if self.structure_lib.get_node_type() == "library":
return self.structure_lib.get_whith_specific_parrent(name)
if appName != self.structure_lib.get_name():
return []
return self.structureLib.get_whith_specific_parrent(name)
return self.structure_lib.get_whith_specific_parrent(name)

View File

@ -8,7 +8,7 @@ class Namespace(Node.Node):
debug.error("Can not parse namespace : " + str(stack))
Node.Node.__init__(self, 'namespace', stack[1], file, lineNumber, documentation)
# enable sub list
self.subList = []
self.sub_list = []
debug.verbose("find namespace : " + self.to_str())

View File

@ -2,7 +2,7 @@
import monkDebug as debug
import monkModule as module
accessList = ['private', 'protected', 'public']
access_list = ['private', 'protected', 'public']
def debug_space(level):
ret = ""
@ -13,23 +13,23 @@ def debug_space(level):
genericUID = 0
class Node():
def __init__(self, type, name="", file="", lineNumber=0, documentation=[]):
def __init__(self, type, name="", file="", line_number=0, documentation=[]):
global genericUID
genericUID+=1
self.uid = genericUID
self.documenatationCode = []
self.nodeType = type
self.documenatation_code = []
self.node_type = type
self.name = name
self.doc = None
self.fileName = file
self.lineNumber = lineNumber
self.subList = None
self.file_name = file
self.line_number = line_number
self.sub_list = None
self.access = None
# namespace elements : (set when all element are parsed ...
self.namespace = []
self.moduleLink = 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.previousRequest = False # @previous
self.module_link = None # this is a link on the main application node or library node (usefull to get the website ...)
self.hidden_request = False # @not-in-doc
self.previous_request = False # @previous
self.template = []
self.add_doc(documentation)
@ -40,7 +40,7 @@ class Node():
return self.to_str()
def get_node_type(self):
return self.nodeType
return self.node_type
def get_name(self):
ret = ""
@ -65,18 +65,18 @@ class Node():
def add_doc(self, doc):
for element in doc:
self.documenatationCode.append(element)
self.documenatation_code.append(element)
if element.find("@not-in-doc") != -1 :
self.hiddenRequest = True
self.hidden_request = True
if element.find("@previous") != -1 :
self.previousRequest = True
self.previous_request = True
def get_request_hidden(self):
return self.hiddenRequest
return self.hidden_request
def get_request_in_previous(self):
return self.previousRequest
return self.previous_request
def get_displayable_name(self):
@ -91,16 +91,16 @@ class Node():
def get_doc(self):
#debug.info(str(self.doc))
if len(self.documenatationCode) > 0:
if len(self.documenatation_code) > 0:
ret = ""
isFirst = True
for req in self.documenatationCode:
for req in self.documenatation_code:
if isFirst == False:
ret += '\n'
isFirst = False
ret += req
return ret
if self.nodeType not in ['methode']:
if self.node_type not in ['methode']:
return ""
#try to get previous element :
if len(self.namespace) == 0:
@ -130,35 +130,35 @@ class Node():
heveMethode, pointerMethode = element.have_methode(self.name)
if heveMethode == False:
continue
if len(pointerMethode.documenatationCode) != 0:
if len(pointerMethode.documenatation_code) != 0:
return pointerMethode.get_doc()
return ""
def get_lib_name(self):
if self.moduleLink == None:
if self.module_link == 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):
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':
debug.info(debug_space(level) + "# " + self.nodeType + " => " + self.name)
debug.info(debug_space(level) + "# " + self.node_type + " => " + self.name)
elif access == 'public':
debug.info(debug_space(level) + "+ " + self.nodeType + " => " + self.name)
debug.info(debug_space(level) + "+ " + self.node_type + " => " + self.name)
else:
debug.info(debug_space(level) + self.nodeType + " => " + self.name)
if self.subList!= None:
for element in self.subList:
debug.info(debug_space(level) + self.node_type + " => " + self.name)
if self.sub_list!= None:
for element in self.sub_list:
if 'access' in element.keys():
element['node'].debug_display(level+1, element['access'])
else:
element['node'].debug_display(level+1)
def set_access(self, access):
if access not in accessList:
debug.warning("This is not a valid access : '" + access + "' : availlable : " + str(accessList))
if access not in access_list:
debug.warning("This is not a valid access : '" + access + "' : availlable : " + str(access_list))
return
if self.access == None:
debug.error("This Node does not support acces configuration...")
@ -170,18 +170,18 @@ class Node():
def append(self, newSubElement):
# just add it in a sub List :
if self.subList == None:
debug.error("can not add a '" + newSubElement.nodeType + "' at this '" + self.nodeType + "'")
if self.sub_list == None:
debug.error("can not add a '" + newSubElement.node_type + "' at this '" + self.node_type + "'")
return
if newSubElement.get_node_type() != 'namespace':
if self.access == None:
self.subList.append({'node' : newSubElement})
self.sub_list.append({'node' : newSubElement})
else:
self.subList.append({'access' : self.access, 'node' : newSubElement})
self.sub_list.append({'access' : self.access, 'node' : newSubElement})
return
# 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_name() == newSubElement.get_name():
debug.verbose("fusionate with previous declaration")
@ -189,16 +189,16 @@ class Node():
return
# normal case adding :
if self.access == None:
self.subList.append({'node' : newSubElement})
self.sub_list.append({'node' : newSubElement})
else:
self.subList.append({'access' : self.access, 'node' : newSubElement})
self.sub_list.append({'access' : self.access, 'node' : newSubElement})
##
## @ brief only for namespace :
##
##
def fusion(self, addedElement):
for element in addedElement.subList:
for element in addedElement.sub_list:
self.append(element['node'])
##
@ -209,13 +209,13 @@ class Node():
##
def get_all_sub_type(self, type='all', sorted = False):
if type == 'all':
return self.subList
return self.sub_list
if isinstance(type, list) == False:
type = [type]
if self.subList == None:
if self.sub_list == None:
return []
ret = []
for element in self.subList:
for element in self.sub_list:
if element['node'].get_node_type() in type:
ret.append(element)
if sorted == True:
@ -224,9 +224,9 @@ class Node():
return ret
def get_doc_website_page(self):
if self.moduleLink == None:
if self.module_link == None:
return ""
ret = self.moduleLink.get_website()
ret = self.module_link.get_website()
if ret[-1] != '/':
ret += '/'
ret += self.get_node_type()
@ -266,15 +266,15 @@ class Node():
return ret
def set_module_link(self, module):
self.moduleLink = module
self.module_link = module
# set for all sub elements ...
if self.subList == None:
if self.sub_list == None:
return
if self.nodeType in ['class', 'namespace', 'struct']:
for element in self.subList:
if self.node_type in ['class', 'namespace', 'struct']:
for element in self.sub_list:
element['node'].set_module_link(module)
elif self.nodeType in ['library', 'application']:
for element in self.subList:
elif self.node_type in ['library', 'application']:
for element in self.sub_list:
element['node'].set_module_link(module)
def set_namespace(self, hierarchy = []):
@ -283,16 +283,16 @@ class Node():
for tmpName in hierarchy:
self.namespace.append(tmpName)
# set for all sub elements ...
if self.subList == None:
if self.sub_list == None:
return
if self.nodeType in ['class', 'namespace', 'struct']:
for element in self.subList:
if self.node_type in ['class', 'namespace', 'struct']:
for element in self.sub_list:
hierarchy.append(self.name)
element['node'].set_namespace(hierarchy)
#debug.info(" ==> " + str(element['node'].get_namespace()))
hierarchy.pop()
elif self.nodeType in ['library', 'application']:
for element in self.subList:
elif self.node_type in ['library', 'application']:
for element in self.sub_list:
element['node'].set_namespace()
#debug.info(" ==> " + str(element['node'].get_namespace()))
@ -301,19 +301,19 @@ class Node():
def complete_display(self):
debug.info(str(self.namespace) + ' : ' + self.name)
if self.subList == None:
if self.sub_list == None:
return
for element in self.subList:
for element in self.sub_list:
element['node'].complete_display()
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:
return None
if self.nodeType in ['library', 'application']:
if self.subList == None:
if self.node_type in ['library', 'application']:
if self.sub_list == None:
return None
for element in self.subList:
for element in self.sub_list:
ret = element['node'].find(list)
if ret != None:
return ret
@ -323,12 +323,12 @@ class Node():
tmpList = list[1:]
if len(tmpList) == 0:
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 ...
return None
if self.subList == None:
if self.sub_list == None:
return None
for element in self.subList:
for element in self.sub_list:
ret = element['node'].find(tmpList)
if ret != None:
return ret
@ -338,8 +338,8 @@ class Node():
def get_whith_specific_parrent(self, parrentName):
ret = []
# set for all sub elements ...
if self.subList != None:
for element in self.subList:
if self.sub_list != None:
for element in self.sub_list:
tmpRet = element['node'].get_whith_specific_parrent(parrentName)
if len(tmpRet) != 0:
for tmp in tmpRet:
@ -347,8 +347,8 @@ class Node():
return ret
def have_methode(self, methodeName):
if self.subList != None:
for element in self.subList:
if self.sub_list != None:
for element in self.sub_list:
if element['node'].get_node_type() != 'methode':
continue
if element['access'] == "private":
@ -363,7 +363,7 @@ class Node():
class MainNode(Node):
def __init__(self, type="library", name=""):
Node.__init__(self, type, name)
self.subList = []
self.sub_list = []
def get_doc_website_page_relative(base, dest):
realBase = ""

View File

@ -21,6 +21,8 @@ import monkMethode as Methode
import monkEnum as Enum
import monkVariable as Variable
import monkNode as Node
import monkUsing as Using
import monkTypedef as Typedef
tokens = [
'NUMBER',
@ -178,24 +180,53 @@ lex.lex()
## @return The new table. ex: ['class', 'Bar::Foo']
##
def create_compleate_class_name(table):
debug.warning("table = " + str(table))
if "::" not in "".join(table):
out = table
else:
# we need to convert it :
out = []
for name in table:
if len(out) == 0:
out.append(name)
elif name == ":" \
and out[-1].endswith(":"):
out[-1] += name
elif out[-1].endswith("::"):
out[-2] += out[-1] + name
del out[-1]
else:
out.append(name)
debug.verbose("table = " + str(table))
# separate ["<XXX"] in ["<", "XXX"]
out = []
for name in table:
if len(name) > 1 \
and name[0] == "<":
out.append('<')
out.append(name[1:])
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
# 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):
out = table
else:
@ -212,7 +243,7 @@ def create_compleate_class_name(table):
out[-1] += name
else:
out.append(name)
debug.warning(" ==> out = " + str(out))
debug.verbose(" ==> out = " + str(out))
return out
@ -273,6 +304,7 @@ class parse_file():
lex.input(headerFileStr)
self.cur_line = 0
self.cur_char = 0
self.count_pthese = 0
while True:
tok = lex.token()
if not tok:
@ -319,48 +351,62 @@ class parse_file():
if tok.type == 'COMMENT_SINGLELINE_DOC':
self.last_comment.append(tok.value)
if tok.type == 'OPEN_BRACE':
# 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',
self.name_stack = create_compleate_class_name(self.name_stack)
if len(self.name_stack) <= 0:
#open brace with no name ...
self.brace_type_push('empty', [])
elif is_a_function(self.name_stack):
# need to parse sub function internal description...
self.sub_module_count_brace = 1
self.brace_type_push('function', self.name_stack)
debug.verbose("openBrace *** " + str(self.name_stack))
elif 'namespace' in self.name_stack:
self.brace_type_push('namespace', self.name_stack)
elif 'class' in self.name_stack:
self.brace_type_push('class', self.name_stack)
elif 'enum' in self.name_stack:
self.brace_type_push('enum', self.name_stack)
elif 'struct' in self.name_stack:
self.brace_type_push('struct', self.name_stack)
elif 'typedef' in self.name_stack:
self.brace_type_push('typedef', self.name_stack)
elif 'union' in self.name_stack:
self.brace_type_push('union', self.name_stack)
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:
self.brace_type_push('unknow', self.name_stack)
self.stack = []
self.name_stack = []
self.last_comment = []
elif tok.type == 'CLOSE_BRACE':
if len(self.name_stack) != 0:
if self.previous_is('enum') == True:
self.brace_type_append('enum list', self.name_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',
self.name_stack = create_compleate_class_name(self.name_stack)
if len(self.name_stack) <= 0:
#open brace with no name ...
self.brace_type_push('empty', [])
elif is_a_function(self.name_stack):
# need to parse sub function internal description...
self.sub_module_count_brace = 1
self.brace_type_push('function', self.name_stack)
debug.verbose("openBrace *** " + str(self.name_stack))
elif 'namespace' in self.name_stack:
self.brace_type_push('namespace', self.name_stack)
elif 'class' in self.name_stack:
self.brace_type_push('class', self.name_stack)
elif 'enum' in self.name_stack:
self.brace_type_push('enum', self.name_stack)
elif 'struct' in self.name_stack:
self.brace_type_push('struct', self.name_stack)
elif 'typedef' in 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:
self.brace_type_push('union', self.name_stack)
else:
debug.warning(self.gen_debug_space() + "end brace DROP : " + str(self.name_stack));
self.stack = []
self.name_stack = []
self.last_comment = []
self.brace_type_pop()
self.name_stack = create_compleate_class_name(self.name_stack)
self.brace_type_push('unknow', self.name_stack)
self.stack = []
self.name_stack = []
self.last_comment = []
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 self.previous_is('enum') == True:
self.brace_type_append('enum list', self.name_stack);
else:
debug.warning(self.gen_debug_space() + "end brace DROP : " + str(self.name_stack));
self.stack = []
self.name_stack = []
self.last_comment = []
self.brace_type_pop()
self.name_stack = create_compleate_class_name(self.name_stack)
if tok.type == 'OPEN_PAREN':
self.count_pthese += 1
self.name_stack.append(tok.value)
elif tok.type == 'CLOSE_PAREN':
self.count_pthese -= 1
self.name_stack.append(tok.value)
elif tok.type == 'OPEN_SQUARE_BRACKET':
self.name_stack.append(tok.value)
@ -396,7 +442,7 @@ class parse_file():
or tok.type == 'CHAR_LITERAL':
self.name_stack.append(tok.value)
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]);
self.brace_type_change_access(self.name_stack[0])
self.name_stack = []
@ -404,32 +450,41 @@ class parse_file():
else :
self.name_stack.append(tok.value)
elif tok.type == 'SEMI_COLON':
if len(self.name_stack) != 0:
self.name_stack = create_compleate_class_name(self.name_stack)
if is_a_function(self.name_stack):
self.brace_type_append('function', self.name_stack);
elif 'namespace' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a namespace DECLARATION : " + str(self.name_stack));
elif 'class' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a class DECLARATION : " + str(self.name_stack));
elif 'enum' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a enum DECLARATION : " + str(self.name_stack));
elif 'struct' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a struct DECLARATION : " + str(self.name_stack));
elif 'typedef' in self.name_stack:
debug.info(self.gen_debug_space() + "find a typedef DECLARATION : " + str(self.name_stack));
elif 'union' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a union DECLARATION : " + str(self.name_stack));
else:
if self.previous_is('enum') == True:
self.brace_type_append('enum list', self.name_stack);
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:
self.name_stack = create_compleate_class_name(self.name_stack)
if is_a_function(self.name_stack):
self.brace_type_append('function', self.name_stack);
elif 'namespace' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a namespace DECLARATION : " + str(self.name_stack));
elif 'class' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a class DECLARATION : " + str(self.name_stack));
elif 'enum' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a enum DECLARATION : " + str(self.name_stack));
elif 'struct' in self.name_stack:
debug.debug(self.gen_debug_space() + "find a struct DECLARATION : " + str(self.name_stack));
elif 'typedef' in 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:
debug.debug(self.gen_debug_space() + "find a union DECLARATION : " + str(self.name_stack));
else:
# TODO : Check if it is true in all case :
self.brace_type_append('variable', self.name_stack);
#debug.warning(self.gen_debug_space() + "variable : " + str(self.name_stack));
self.stack = []
self.name_stack = []
self.last_comment = []
if self.previous_is('enum') == True:
self.brace_type_append('enum list', self.name_stack);
else:
# TODO : Check if it is true in all case :
self.brace_type_append('variable', self.name_stack);
#debug.warning(self.gen_debug_space() + "variable : " + str(self.name_stack));
self.stack = []
self.name_stack = []
self.last_comment = []
#self.debug_display();
def debug_display(self):
@ -449,9 +504,9 @@ class parse_file():
elif type == 'struct':
ret = Struct.Struct(stack, self.header_file_name, self.cur_line, self.last_comment)
elif type == 'typedef':
#ret = Namespace.Namespace(stack, self.header_file_name, self.cur_line)
# TODO ...
pass
ret = Typedef.Typedef(stack, self.header_file_name, self.cur_line)
elif type == 'using':
ret = Using.Using(stack, self.header_file_name, self.cur_line)
elif type == 'union':
ret = Union.Union(stack, self.header_file_name, self.cur_line, self.last_comment)
elif type == 'function':
@ -522,7 +577,7 @@ class parse_file():
self.brace_depth_type.pop()
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)
return
id = len(self.brace_depth_type)-1
@ -565,6 +620,9 @@ def is_a_function(stack) :
if stack[len(stack)-2] == '=' \
and stack[len(stack)-1] == '0':
stack = stack[:len(stack)-2]
if stack[len(stack)-2] == '=' \
and stack[len(stack)-1] == 'delete':
stack = stack[:len(stack)-2]
# find ')' element :
id = len(stack)-1
while id >= 0:

View File

@ -7,7 +7,7 @@ class Struct(Node.Node):
name = ""
Node.Node.__init__(self, 'struct', name, file, lineNumber, documentation)
self.access = "public"
self.subList = []
self.sub_list = []
def to_str(self) :

View File

@ -25,7 +25,8 @@ global_class_link = {
"std::ostream" : "http://www.cplusplus.com/reference/ostream/ostream/",
"std::shared_ptr": "http://www.cplusplus.com/reference/memory/shared_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_new_elem = True
continue
if element[0] in ['<']:
if element[0] == '<':
debug.info(" Start template")
if self.template_parameter == None:
self.template_parameter = []
if element[1:] != "":
self.template_parameter.append(element[1:])
template_level += 1
continue
if element[0] in ['>']:
if element[0] == '>':
template_level -= 1
debug.info(" Stop template")
continue
if template_level != 0:
if element != "":
if template_new_elem == True:
if template_new_elem == True \
or len(self.template_parameter) == 0:
self.template_parameter.append(element)
else:
self.template_parameter[-1] += " " + element

15
monkTypedef.py Normal file
View 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
View 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

View File

@ -34,7 +34,7 @@ class Variable(Node.Node):
Node.Node.__init__(self, 'variable', name, file, lineNumber, documentation)
# force the sublist error generation ...
self.subList = None
self.sub_list = None
# default variable :
self.type = Type.TypeNone()
self.static = False