def __script(self,mode='script'):
        self.__tokenPop()
        text = dedent(self.__tokenText(strip=0))
        scriptMode = 'script'==mode
        if text:
            try:
                stmt = self._cparse(text,scriptMode and 'exec' or 'eval').node
            except:
                self.__error()
        t = self.__tokenPop()
        end = 'end'+mode
        try:
            assert self._tokens[self._tokenX][0]==end
            self.__tokenPop()
        except:
            self.__error(end+' expected')
        if not text: return []
        _renumber(stmt,t[1]-1)

        if scriptMode: return stmt.nodes
        from compiler.ast import Discard, CallFunc, Name, Const
        return Discard(CallFunc(Name('__swrite__'), [stmt.getChildren()[0]],None,None))
dataset/ETHPy150Open CGATOxford/cgat/obsolete/preppy.py/PreppyParser.__script/original