Use a file-local constant for non-prefixing nodes.

This commit is contained in:
Dan 2019-05-15 21:14:44 -04:00 committed by Wenzel Jakob
parent 2c8c5c4ed3
commit e0b8bbbce9

6
tools/mkdoc.py Normal file → Executable file
View File

@ -41,6 +41,10 @@ PRINT_LIST = [
CursorKind.FIELD_DECL CursorKind.FIELD_DECL
] ]
PREFIX_BLACKLIST = [
CursorKind.TRANSLATION_UNIT
]
CPP_OPERATORS = { CPP_OPERATORS = {
'<=': 'le', '>=': 'ge', '==': 'eq', '!=': 'ne', '[]': 'array', '<=': 'le', '>=': 'ge', '==': 'eq', '!=': 'ne', '[]': 'array',
'+=': 'iadd', '-=': 'isub', '*=': 'imul', '/=': 'idiv', '%=': '+=': 'iadd', '-=': 'isub', '*=': 'imul', '/=': 'idiv', '%=':
@ -192,7 +196,7 @@ def extract(filename, node, prefix, output):
return 0 return 0
if node.kind in RECURSE_LIST: if node.kind in RECURSE_LIST:
sub_prefix = prefix sub_prefix = prefix
if node.kind != CursorKind.TRANSLATION_UNIT: if node.kind not in PREFIX_BLACKLIST:
if len(sub_prefix) > 0: if len(sub_prefix) > 0:
sub_prefix += '_' sub_prefix += '_'
sub_prefix += d(node.spelling) sub_prefix += d(node.spelling)