That way is the certainly the best.  Just note that it is easy to 
manipulate the ast to get what you wanted.

julia> ex = """                 
       a = 1
       b = 2
       a + b
       """
"a = 1\nb = 2\na + b\n"

julia> ast = Base.parse_input_line(ex)
:($(Expr(:toplevel, :(a = 1), :(b = 2), :(+(a,b)))))

julia> ast.head = :block
:block

julia> ast
quote 
    a = 1
    b = 2
    +(a,b)
end

On Sunday, February 9, 2014 10:46:44 PM UTC-5, Fil Mackay wrote:
>
> It seems the best way to do this is (thanks to @JeffBezanson's patience):
>
> julia> parse("""begin
>        x = 1
>        y = 2
>        end""")
> quote  # none, line 2:
>     x = 1 # line 3:
>     y = 2
> end
>
> So obvious now.. :)
>

Reply via email to