Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline expression fails: "extra token after end of expression" #197

Open
DominiqueMakowski opened this issue May 19, 2023 · 1 comment

Comments

@DominiqueMakowski
Copy link

This issue is a follow-up on this one, but the solutions provided there did not solve the case.

This works:

x <- julia_eval("a = 1+1; a + 2")
x
[1] 4

But this doesn't:

juliacode <- "
a = 1+1
a + 2
"

x <- julia_eval(juliacode)
Error: Error happens in Julia.
Base.Meta.ParseError("extra token after end of expression")
Stacktrace:
 [1] parse(str::SubString{String}; raise::Bool, depwarn::Bool)
   @ Base.Meta .\meta.jl:272
 [2] parse
   @ .\meta.jl:266 [inlined]
 [3] eval_string(x::String)
   @ Main.JuliaCall C:\Users\domma\AppData\Local\R\win-library\4.2\JuliaCall\julia\setup.jl:203
 [4] docall(call1::Ptr{Nothing})
   @ Main.JuliaCall C:\Users\domma\AppData\Local\R\win-library\4.2\JuliaCall\julia\setup.jl:176
>

Trimming the string or changing the position of the opening/closing quotes did not seem to help... Any help is welcome :)

@AdrienNguyenHuu
Copy link

I have the same problem, and the only solution I found is to break the code in single lines julia_command("...").

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants