# https://stackoverflow.com/questions/46364922/how-to-parse-multiline-string-in-julia function parseall(str) pos = start(str) exs = [] while !done(str, pos) ex, pos = parse(str, pos) # returns next starting point as well as expr ex.head == :toplevel ? append!(exs, ex.args) : push!(exs, ex) #see comments for info end if length(exs) == 0 throw(ParseError("end of input")) elseif length(exs) == 1 return exs[1] else return Expr(:block, exs...) # convert the array of expressions # back to a single expression end end # Meta.show_sexpr(expr) parseallfile(file) = parseall(readstring(file)) findfunc(any, func::Symbol) = false function findfunc(s::Symbol, func::Symbol) if s == func return true end false end function findfunc(expr::Expr, func::Symbol) for exp in expr.args if findfunc(exp, func) println(expr.args[2]) # better to get aliases end end false end