Closed cnrrobertson closed 2 years ago
Should be (mostly) working now. The julia parser has some issues, probably because of the ability to override operators Mainly, the following lines aren't properly parsed:
import Base.+
(+)(x::Int,y::Float64) = x*y
Base.:+(x::Int,y::Float64) = x*y
Other than that, it should be working, let me know if you find any issues!
Amazing! Thank you for the very quick response.
I've noticed a couple little edge cases it's not quite working in that I should have mentioned.
One simple case:
function standard(x)
print(x)
x += 11
x /= 11
x *= 11
x -= 11
end
The highlighting doesn't show up on the x += 11,x /= 11
etc.
Another case (from some real code):
function run_simulation!(prob,equation,vars,params,grid,nsteps,tjump,sjump,ld0,mu0)
an.set_ic!(prob, ld0, mu0)
ld = zeros(eltype(vars.ld),size(vars.ld)...)
mu = zeros(eltype(vars.ld),size(vars.mu)...)
ldh = zeros(eltype(vars.ldh),size(vars.ldh)...)
muh = zeros(eltype(vars.ldh),size(vars.muh)...)
copyto!(ld, vars.ld)
copyto!(mu, vars.mu)
copyto!(ldh, prob.sol[:,:,1])
copyto!(muh, prob.sol[:,:,2])
kr = 1:length(grid.kr)
l = 1:length(grid.l)
Dlta = @. sqrt(ld^2+mu^2)
S = @. 2*Dlta
Ev1 = @. (ld + Dlta) / sqrt((ld+Dlta)^2 + mu^2)
Ev2 = @. mu / sqrt((ld+Dlta)^2 + mu^2)
xout, yout, tpe = vec.(mxcall(:DefectLoc6a, 3, ld0, mu0))
end
I'm not sure what's happening here. The highlighting for the variables works on the first line, doesn't work on lines 2-5, works on lines 6-9, doesn't for the rest. I hope there is something helpful there.. Is this possibly just an issue with the treesitter parser?
Thanks for the report! What happened is that the parser treats some function definitions the same way it treats assignments (for example, the StructConstructor in the original sample file). I got around this, but I didn't realize that identifiers used in an assignment statement weren't being recognized as such. Should be working now
It looks great now. Thanks for getting it all ship shape so quickly!
Language support request
Test file: