def __init__(self, spec=None): ''' Init L{SpecTokenList} @param spec: file or string to be parsed @type spec: string/file @return: None @rtype: None ''' self.current = 0 self.pointer = 0 self.token_list = [] # TODO: pass spec in another method if spec is None: return line = 1 specFile = SpecFile(spec) while True: t = SpecToken(specFile) self.token_list.append(t) line += t.eol_count_prepend t.line = line line += t.eol_count_append if t.token == None: break