The given example is not a parseable string.

julia> a "b" c
> ERROR: syntax: extra token """ after end of expression
>

This works:

julia> eval(parse("""y = "c" """))
> "c"
>
julia> y
> "c"
>

(note: the space after the inner quote is required or else the parser
assumes another escapable quote in the set of four double-quotes)






On Sun, Jul 6, 2014 at 5:30 PM, Laszlo Hars <laszloh...@gmail.com> wrote:

> I wanted to parse a string, which I can enter in the Julia REPL console:
> """a "b" c"""
> with the desired result:
> "a \"b\" c"
>
> These all fail:
> julia> eval(parse(""" "a \"b\" c" """))
> ERROR: no method *(ASCIIString, Array{Uint8,1})
>
> julia> eval(parse("a \"b\" c"))
> ERROR: ParseError("extra token \"\"\" after end of expression")
>  in parse at string.jl:1210
>
> julia> eval(parse(""" "a "b" c" """))
> ERROR: no method *(ASCIIString, Array{Uint8,1})
>
> This one does not even get accepted as a proper input
> eval(parse(""""a "b" c""""))
>
> What is the right method?
>

Reply via email to