mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-03 23:47:08 +00:00
doc: improve API parsing
This commit is contained in:
parent
e7a997a598
commit
4c76ee7e35
@ -38,10 +38,26 @@ api_description = """
|
|||||||
code_ref = """GITHUB/FPATH#LLINENR"""
|
code_ref = """GITHUB/FPATH#LLINENR"""
|
||||||
|
|
||||||
def isEndOfComment(line):
|
def isEndOfComment(line):
|
||||||
return re.match(r'\s*\*/.*', line)
|
parts = re.match(r'\s*\*\/.*', line)
|
||||||
|
if parts:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def isStartOfComment(line):
|
def isStartOfComment(line):
|
||||||
return re.match(r'\s*\/\*/.*', line)
|
parts = re.match(r'\s*\/\*\*.*', line)
|
||||||
|
if parts:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def isComment(line):
|
||||||
|
parts = re.match(r'\s*\/\/.*', line)
|
||||||
|
if parts:
|
||||||
|
return True
|
||||||
|
parts = re.match(r'\s*\*.*', line)
|
||||||
|
if parts:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return isStartOfComment(line) or isEndOfComment(line)
|
||||||
|
|
||||||
def isTypedefStart(line):
|
def isTypedefStart(line):
|
||||||
return re.match(r'.*typedef\s+struct.*', line)
|
return re.match(r'.*typedef\s+struct.*', line)
|
||||||
@ -110,10 +126,7 @@ def createIndex(fin, filename, api_filepath, api_title, api_label, githuburl):
|
|||||||
state = State.DoneAPI
|
state = State.DoneAPI
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if multiline_function_def:
|
if isComment(line):
|
||||||
function_end = re.match('.*;\n', line)
|
|
||||||
if function_end:
|
|
||||||
multiline_function_def = 0
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
param = re.match(".*@brief.*", line)
|
param = re.match(".*@brief.*", line)
|
||||||
@ -129,6 +142,9 @@ def createIndex(fin, filename, api_filepath, api_title, api_label, githuburl):
|
|||||||
if param:
|
if param:
|
||||||
continue
|
continue
|
||||||
param = re.match(".*@note.*", line)
|
param = re.match(".*@note.*", line)
|
||||||
|
if param:
|
||||||
|
continue
|
||||||
|
param = re.match(".*return.*", line)
|
||||||
if param:
|
if param:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -354,6 +370,9 @@ def main(argv):
|
|||||||
references = functions.copy()
|
references = functions.copy()
|
||||||
references.update(typedefs)
|
references.update(typedefs)
|
||||||
|
|
||||||
|
for function_name, url in references.items():
|
||||||
|
print(function_name, url)
|
||||||
|
|
||||||
# with open(indexfile, 'w') as fout:
|
# with open(indexfile, 'w') as fout:
|
||||||
# for function, reference in references.items():
|
# for function, reference in references.items():
|
||||||
# fout.write("[" + function + "](" + reference + ")\n")
|
# fout.write("[" + function + "](" + reference + ")\n")
|
||||||
|
Loading…
Reference in New Issue
Block a user