Meta.parse failes on double newlines

Meta.parse("...") will only consume one toplevel expression and raise an error if there is anything after the first toplevel expression. You can use Meta.parse("...", 1) to only consume the first expression and get back the parsed expression and the index of the string it stopped parsing at. In Julia 1.6, there is also Meta.parseall, which will parse all toplevel expressions at once. If it’s just about trailing newlines though, you might also just want to remove those beforehand using strip.

4 Likes