from .LibraryParser import LibraryParser class JSONLibraryParser (LibraryParser): def cstyle_strip_comments(self, val): val2 = "" # possible values for comment: 0 = none, 1 = multiline, 2 = singleline comment = 0 xr = iter(range(0, len(val) - 1)) for i in xr: if val[i] == '\n' and comment == 2: comment = 0 check = val[i:i+2] if check == "/*" and comment == 0: comment = 1 next(xr) elif check == "*/" and comment == 1: comment = 0 next(xr) elif check == "//": comment = 2 next(xr) elif comment == 0: val2 += val[i] val2 += val[-1:] return val2