From 756ca3e86118a027d119ce38d2477fbac899db94 Mon Sep 17 00:00:00 2001 From: Nathan Musoke Date: Mon, 15 Jan 2024 16:50:24 -0500 Subject: [PATCH] chore: Update to MathLink 0.5.2 MathLink v0.5.2 introduced a few breaking changes as compared to 0.5.1, see e.g.https://github.com/JuliaInterop/MathLink.jl/pull/66. Update to account for them and set minimum version to 0.5.2. Fixes: https://github.com/musoke/WolframExpr.jl/issues/27 --- Project.toml | 2 +- src/WolframExpr.jl | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index 3841ce1..917f65d 100644 --- a/Project.toml +++ b/Project.toml @@ -8,6 +8,6 @@ MathLink = "18c93696-a329-5786-9845-8443133fa0b4" SyntaxTree = "a4af3ec5-f8ac-5fed-a759-c2e80b4d74cb" [compat] -MathLink = "=0.5.1" +MathLink = "0.5.2" SyntaxTree = "1.0.1" julia = "1.8" diff --git a/src/WolframExpr.jl b/src/WolframExpr.jl index 4f8a11d..a6ae0f0 100644 --- a/src/WolframExpr.jl +++ b/src/WolframExpr.jl @@ -66,11 +66,11 @@ Very shallow wrapper around `MathLink`'s parsing. julia> using WolframExpr julia> string_to_wexpr("Sin[1]") -W"Sin"(1) +W`Sin[1]` ``` """ -function string_to_wexpr(string) - MathLink.W`$string` +function string_to_wexpr(string)::Union{MathLink.WSymbol,MathLink.WExpr} + MathLink.parseexpr(string) end """ @@ -84,7 +84,7 @@ Convert a Wolfram expression from a `MathLink.WExpr` to a Julia expression. julia> using MathLink, WolframExpr julia> wexpr_to_expr(W`1. + 1`) -:(1.0 + 1) +:(1.0 + 1.0) ``` """ function wexpr_to_expr(symb::MathLink.WSymbol)