-
Notifications
You must be signed in to change notification settings - Fork 2
/
_jl.ado
32 lines (29 loc) · 1.06 KB
/
_jl.ado
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
*! jl 1.0.0 9 April 2024
cap program drop _jl
program define _jl, rclass
_on_colon_parse `0'
_assert strlen(`"`s(after)'"')<4991, rc(1003) msg("_jl command line longer than 4990 characters")
local qui = cond(substr(`"`s(after)'"', strlen(`"`s(after)'"'), 1) == ";", "qui", "")
cap noi plugin call _julia `=cond(c(k),"*","")', eval`qui' `"`s(after)'"'
if _rc {
local rc = _rc
local __jlans: subinstr local __jlans "`" "'", all
c_local ans: copy local __jlans
cap noi if `"`__jlans'"' != "nothing" {
if `rc' { // print error type in red
local t = strpos(`"`__jlans'"', ":")
di as err substr(`"`__jlans'"', 1, `t') _c
local __jlans = substr(`"`__jlans'"', `t'+1, .)
}
local t = strpos(`"`__jlans'"', char(10))
while `t' {
di as txt substr(`"`__jlans'"', 1, `t'-1)
local __jlans = substr(`"`__jlans'"', `t'+1, .)
local t = strpos(`"`__jlans'"', char(10))
}
di as txt `"`__jlans'"'
}
}
return local ans: copy local __jlans
end
program _julia, plugin using(jl.plugin)