## lazy way to check member docs ## does so in a very primitive way from objnames import translate import os from pprint import pprint def parseMethodDec(): with open('../pol-core/bscript/objmethods.h','r') as f: in_dec=False decs=[] for l in f.readlines(): l=l.strip(); if l=='enum MethodID': in_dec=True continue if not in_dec: continue if l.startswith('MTH_'): decs.append([l.split(',')[0],None]) elif l.startswith('};'): break return decs def parseMethodDef(decs): defs=dict() with open('../pol-core/bscript/parser.cpp','r') as f: in_def=False for l in f.readlines(): l=l.strip(); if l.startswith('ObjMethod object_methods[]'): in_def=True continue if not in_def: continue if l.startswith('{MTH_'): l=l.replace('{','').replace('"','') l=[_.strip() for _ in l.split(',')] for d in decs: if d[0]==l[0]: defs[d[0]]=l[1].lower() del d break elif l.startswith('};'): break return defs def parseFile(file,defs,methods): with open(file,'r') as f: in_d=False active=None supported=[] openb=0 linec=0 in_c=False for l in f.readlines(): linec+=1 l=l.strip() if l.startswith('//'): continue cs=l.rfind('/*') ce=l.rfind('*/') if cs>ce: in_c=True elif ce>cs: in_c=False if in_c: continue if not in_d and '::call_method' in l: l=l[:l.find('::call_method')] active=l.split()[-1] in_d=True elif not in_d and '::script_method_id' in l: l=l[:l.find('::script_method_id')] active=l.split()[-1] in_d=True elif not in_d and 'CallPropertyListMethod_id' in l: active='!CPROP!' in_d=True elif in_d: if '{' in l: openb+=1 if '}' in l: openb-=1 if not openb and in_d: if len(supported): if active in methods: methods[active]+=supported else: methods[active]=supported supported=[] in_d=False if l.startswith('case'): try: if '::' in l: m=l.split('::')[1] else: m=l m=m.split(':')[0].split()[-1] supported.append(defs[m]) except Exception as e: print(e) print(file) print(l) print(linec) raise if 'if ( stricmp' in l: m=l.split('"')[1] supported.append(m) if 'CallPropertyListMethod' in l: supported.append('!CPROP!') return methods def checkDocs(methods): docs=dict() with open('../docs/docs.polserver.com/pol100/objref.xml','r') as f: in_c=None for l in f.readlines(): l=l.strip() if l.startswith(''): in_c=None elif in_c and l.startswith('