the trick with macros is that everything should be generating code, not
actually evaluating that code. think of it as a series of functions that do
a text transformation to a new structured document, not a [partial]
execution of that document. for example:

function parseDefinition(name::String, expr::Expr, pdata::ParserData)
#...
elseif expr.head === :curly
  action_expr = expand_names(expr.args[2])
  rule_expr = parseDefinition(name, expr.args[1], action_expr, pdata)
else
#...
return rule_expr
end
macro doAction(expr)
  return parseDefinition(..., expr, ...)
end

On Sun, Mar 22, 2015 at 8:15 AM Abe Schneider [email protected]
<http://mailto:[email protected]> wrote:

I'm in the process of trying to figure out how to do something similar to
> that, but it's unfortunately not easy. I was hoping that there might be a
> method to insert an expression into the AST without an eval required, as it
> would greatly simplify the code Jameson suggested using the `insert` macro,
> which does as advertised, expect for the namespace issue.
>
> ​

Reply via email to