[julia-users] Re: Parsing a Julia file

2016-09-20 Thread Cedric St-Jean
That solved the issue, thank you. I was wondering if there was a Base function to do it, but that's simple enough. On Tuesday, September 20, 2016 at 9:17:04 AM UTC-4, Steven G. Johnson wrote: > > I'm not sure exactly what you want, but: > > function parse_file(filename) > str =

[julia-users] Re: Parsing a Julia file

2016-09-20 Thread Steven G. Johnson
I'm not sure exactly what you want, but: function parse_file(filename) str = readstring(filename) exprs = Any[] pos = 1 while pos <= endof(str) ex, pos = parse(str, pos) push!(exprs, ex) end return exprs end will return an array of the parsed expressions