Skip to content
This repository was archived by the owner on Jan 4, 2025. It is now read-only.

Commit e0ef639

Browse files
committed
fix bug with parsing nested sexprs. rename types to avoid clash with standard module.
1 parent d9ef37a commit e0ef639

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

types.py renamed to larktypes.py

File renamed without changes.

sexpr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def feed(self, tokens):
162162
else:
163163
build = self.build_stack.pop()
164164
if self.build_stack:
165-
nconc1(self.build_stack[-1], build)
165+
self.build_stack[-1] = nconc1(self.build_stack[-1], build)
166166
else:
167167
self.feed_next(build)
168168
return self

test_sexpr.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,9 @@ def testlist(self):
3434
self.assertEqual(sexpr.str2sexpr('(a b c)')[0],
3535
list(Symbol('a'), Symbol('b'), Symbol('c')))
3636

37+
def testfncall(self):
38+
self.assertEqual(sexpr.str2sexpr('((fn (a) a) 1)')[0],
39+
list(list(Symbol('fn'), list(Symbol('a')), Symbol('a')), 1))
40+
3741
if __name__ == '__main__':
3842
unittest.main()

0 commit comments

Comments
 (0)