Skip to content

Commit

Permalink
Run inject (.#) in macro context
Browse files Browse the repository at this point in the history
  • Loading branch information
gilch committed Jul 23, 2024
1 parent 86ab5e3 commit 4472c31
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/hissp/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,13 @@ def parse_macro(self, tag: str, form):
if tag == ",@": return _Unquote(":*", form)
if tag == "_#": return DROP
if tag == "$#": return self.gensym(form)
if tag == ".#": return eval(readerless(form, self.ns), self.ns)
if m := re.fullmatch(r"((?:[^\\]|\\.)+)=#", tag): return Kwarg(m[1], form)
return self._custom_macro(form, tag)
# fmt: on
if tag == ".#":
with C.macro_context(self.ns):
return eval(readerless(form, self.ns), self.ns)
if m := re.fullmatch(r"((?:[^\\]|\\.)+)=#", tag):
return Kwarg(m[1], form)
return self._custom_macro(form, tag)

def template(self, form):
"""Process form as template."""
Expand Down

0 comments on commit 4472c31

Please sign in to comment.