-
Notifications
You must be signed in to change notification settings - Fork 608
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
Create julia lexer and tags parser #2584
Conversation
I didn't review the code, just an early note: We want to stay inline with the upstream projects and so the code should be accepted there first. |
Ok, thanks. |
And a reminder to those who test it to comment, that lets @getzze know its working (or what needs fixing :) and it lets Geany project devs know there is a demand. |
Upstream merge: |
Thanks for your efforts so far @getzze. I'd be happy to see this merged.
|
Thanks for testing it, I commited a correction, you should be able to compile it now. Happy to hear your feedback. |
Thanks, that fixed it. Looking pretty good already. I will continue to test this in the coming days and report back. Two points I noticed instantly:
shows that the struct contains Symbols |
@elextr @getzze I have not discovered any further issues. If more testers or feedback on the level of demand is required, I suggest announcing this on https://discourse.julialang.org/. |
@AndiMD Thanks for reporting these problems! I think it would be great to announce it on Julia discourse.
Interpolation highlighting is only done for single-quote strings, but I am planning to allow it in triple-quote and commands also.
Thanks for reporting, that are actually two bugs:
@eval fun1(x) = $pi # recognizes `fun1` short function definition
Base.@eval fun1(x) = $pi # does not recognize `fun1` short function definition |
Love this initiative! Thank you all. |
Found another edge case: |
Thanks for the feedback.
|
What's the status on this? I love both Julia and Geany and this looks like a really good improvement. |
@oscardssmith three problems:
oops thats 4, anyway at least you could build your own test if the merge was fixed. |
I just pushed new commits to solve conflicts. |
LexJulia has been merged upstream by Scintilla (ScintillaOrg/lexilla@6ee6b08 and later commits for minor corrections). |
The PR has been rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First glance at it only a few comments, also for the Julia lexer could you add a diff that applies the three lines (I think you said) to backport it from Lexilla, probably best in the same place as scintilla_changes.patch and add a prompt to update_scintilla.sh to use it so the changes are known and can be re-applied if another backport is needed.
[Edit: to be clear something to update_scintilla.sh like echo "Don't forget to manually copy the julia lexer from Lexilla and apply 'julia_lexer.patch' to it
no point in trying to automate getting it from Lexilla, leave that for Scintilla 5 update]
There are still some open issues with Lexilla: ScintillaOrg/lexilla#13 |
I didn't look at the lexer code, but most lexers load the "keyword" lists from Geany. Not sure how you can approach the two word keywords (curse Jeff and his femtolisp parser :-) where each word is a valid variable in other contexts. Unless you simply build it into the lexer, have it know and find the two word keywords first and do not test any of the keyword list keywords in that case. A similar (unsolved) issue happens with C++ where names like So its not unprecedented if some edge cases are wrongly highlighted, just raise an issue after this is committed. |
@getzze can you push some inconsequential change (or a big change if you have one :) to see if CI has been fixed? |
Yay CI works again!! One thing you might like to consider (can be later) is a test for the ctags parser, see |
Have approved the changes (pending build-menu :) and LGTM, but havn't tested it yet, might have time in a few days then should be mergable. |
That's a good idea. What is the format of this file? There are unit test for julia in the ctag repository, these files can be used maybe. |
IIUC most of the tests are simply from ctags anyway, many of their names relate to ctags bug reports IIUC the tests are just one (or more) source file(s) mentioned in |
I pushed some changed from Lexilla (like using a new keyword list for coloring builtin functions). I added a patch file in the |
The issue with Lexilla is solved. It's ready to merge. |
I just rebased to two commits. I left the ctags test file in a separate commit because I am not sure it is needed, julia parser is well tested in ctags upstream. |
WFM, although testing limited, thanks @getzze |
Thanks so much for getting this pushed through! |
@elextr Any idea when's the next release? |
Hopefully it will happen in September, if not at least this year :). |
Hello, ok=true
for r=2:R+1,c=2:C+1
if table[r,c]=='#'
all(table[r+d[1],c+d[2]]!='#' for d=[(1,0),(-1,0),(0,1),(0,-1)])&&(ok=false;break)
end
end it can be resolved by putting an extra space after the operator. |
That's not a correct fix. The correct fix would be to check whether you're inside or outside quotation marks. |
Its actually lexing the first Lexers come from the Lexilla project. Since Geany folks don't know Julia, please post the issue there so the Julia lexer maintainer can talk to you directly. Post a link to the issue here. |
@oscardssmith: i did not mean it as a fix, just as a how to get rid of it. :-) |
Thanks for catching this bug! |
resolves #434
[Edit2] Lexer
...
and%
make the end of the line being recognized as commentbegin
andend
as numbers inside indexing brackets, so code folding works.r"text"
) - the list of keywords that work as raw string literals is modifiable infiletypes.julia
usingrawliterals
in thekeywords
section.[Edit] Link to official Julia parser: https://github.com/JuliaLang/julia/blob/master/src/julia-parser.scm
and the C library used in Julia for unicode parsing: https://github.com/JuliaStrings/utf8proc