On Mon, Aug 15, 2016 at 4:53 PM, Adrian Salceanu <[email protected]>
wrote:

>
> > parse() supports this by allowing you to parse expression by expression
> within the string
>
> I searched the docs (on the website and using Dash) but I could not find
> that - is it undocumented or something?
>

It's the two-argument form:

  parse(str, start; greedy=true, raise=true)

  Parse the expression string and return an expression (which could later
be passed to eval for execution).
  start is the index of the first character to start parsing. If greedy is
true (default), parse will try
  to consume as much input as it can; otherwise, it will stop as soon as it
has parsed a valid expression.
  Incomplete but otherwise syntactically valid expressions will return
Expr(:incomplete, "(error
  message)"). If raise is true (default), syntax errors other than
incomplete expressions will raise an
  error. If raise is false, parse will return an expression that will raise
an error upon evaluation.

It returns the parsed code and the end position. You may want to use
greedy=false.

Reply via email to