def readAndAutocomplete(source, root_env=gcl.Environment({})): source, line, col = find_cursor(source) tree = gcl.reads(source, filename='input.gcl', allow_errors=True) return ast_util.find_completions_at_cursor(tree, 'input.gcl', line, col, root_env=root_env)
def testCompositionWithDict(self): env = {} env['fn'] = lambda arg : {'b': arg} x = parse_tuple(''' x = { a = 'a' }; y = x (fn 'b'); ''', env=gcl.Environment(env)) self.assertEquals('b', x['y']['b'])
def parse(self, fname, s): return gcl.loads(s, filename=fname, loader=self.loader, env=gcl.Environment({'thing': 'yes'}))