Я рекомендую использовать пакет синтаксического анализатора Python Swift через R reticulate
.Мне не известен пакет Swift для R.
Python Swift Parser
https://github.com/danielquinn/mt103
Использование:
from mt103 import MT103
mt103 = MT103("some-mt-103-string")
print("basic header: {}, bank op code: {}, complete message: {}".format(
mt103.basic_header,
mt103.text.bank_operation_code
mt103
))
Пакет Reticulate R
https://blog.rstudio.com/2018/03/26/reticulate-r-interface-to-python/
install.packages("reticulate")
Использование:
library(reticulate)
mt103 <- import("mt103")
Консоль
> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin18.5.0 (64-bit)
Running under: macOS Mojave 10.14.4
Matrix products: default
BLAS: /Users/pkjar/.Renv/versions/3.5.3/lib/R/lib/libRblas.dylib
LAPACK: /Users/pkjar/.Renv/versions/3.5.3/lib/R/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.5.3
> library(reticulate)
> mt103 <- import("mt103")
> mt103
Module(mt103)
> mt103$
mt103$date mt103$MT103 mt103$re mt103$Text mt103$UserHeader