Julia backend: syntax highlighting
ClosedPublic

Authored by ivanlakhtanov on Jun 26 2016, 4:29 PM.

Details

Summary

Implementation of syntax highlighting

* Keywords highlight
* Simple functions highlight
* Correct highlight of oneline/multiline strings and comments
- There is no update of variables list (will do after doing variable management)

I think, that managing of comments and string should be ported from my changes to Python backend. It seems to handle right things like: "some text # it's not a comment". Also it starts highlighting string while you entering its contents.

If I have time, I will try to fix handling of brackets pairs that are not placing on one line (it's a common fail of DefaultHighlighter).

Diff Detail

Repository
R55 Cantor
Lint
Lint Skipped
Unit
Unit Tests Skipped
ivanlakhtanov retitled this revision from to Julia backend: syntax highlighting.
ivanlakhtanov updated this object.
ivanlakhtanov edited the test plan for this revision. (Show Details)
ivanlakhtanov set the repository for this revision to R55 Cantor.
ivanlakhtanov added a project: Cantor.
ivanlakhtanov added a subscriber: Cantor.
ivanlakhtanov updated this object.
filipesaraiva edited edge metadata.Jul 10 2016, 1:29 PM

Waiting for changes in D2006.

Hi @ivanlakhtanov please could you update this patch in order to it be applicable after the modifications in D2006?

Hi @ivanlakhtanov please could you update this patch in order to it be applicable after the modifications in D2006?

I have modified execution by git rebase on local branch. Nothing changed in diff, so there is nothing to update.

If I run arc patch D2015 I get an error informing I can not apply the patch.
I applied the patch D2006 and downloaded D2015 to apply 'manually' (git apply D2015.diff) and I get an error too. See below (error messages n Portuguese):

[kdevil@anubis cantor (arcpatch-D2006)]$ git apply D2015.diff
error: falha ao aplicar o patch: src/backends/julia/CMakeLists.txt:5
error: src/backends/julia/CMakeLists.txt: patch não se aplica com sucesso
error: falha ao aplicar o patch: src/backends/julia/juliabackend.cpp:40
error: src/backends/julia/juliabackend.cpp: patch não se aplica com sucesso
error: falha ao aplicar o patch: src/backends/julia/juliasession.cpp:27
error: src/backends/julia/juliasession.cpp: patch não se aplica com sucesso
ivanlakhtanov edited edge metadata.

I am now updating all revisions to the recent versions in my branch. Now it should be OK.

filipesaraiva requested changes to this revision.Aug 20 2016, 2:28 PM
filipesaraiva edited edge metadata.

Please, make the changes below and, if necessary, update the other patches which require this one

src/backends/julia/CMakeLists.txt
17

You can remove that ${JuliaBackend_RSCS}, it was not defined (I think I reviewed this same error in a other review request).

src/backends/julia/julia.qrc
2–7

You can remove this *.qrc file and use the CMake command to install files, like in Sage backend.

src/backends/julia/juliakeywords.cpp
45

Once more, give a look in Sage backend to get how to do it.

src/backends/julia/keywords.xml
9–45

It is more like a question. Do you know if julia has some command to print all their special keywords? If yes the approach to use this command is more interesting than the use of a XML file. This way the special keywords of julia can change (sometimes it happens in new releases) and we don't need to change the implementation of the backend in Cantor.

This revision now requires changes to proceed.Aug 20 2016, 2:28 PM
ivanlakhtanov marked an inline comment as done.Aug 20 2016, 3:09 PM
ivanlakhtanov added inline comments.
src/backends/julia/CMakeLists.txt
17

It's defined in a line just above

ivanlakhtanov marked an inline comment as done.Aug 20 2016, 3:23 PM
ivanlakhtanov added inline comments.
src/backends/julia/julia.qrc
2–7

What's wrong with current approach? If I manage files without QtResources I will need to use magic paths in code, instead of elegant ":xml/keywords.xml". And another point is that, next variable management patch adds 3 additional files. I've impelemented this moment accordnigly with Python backend

ivanlakhtanov added inline comments.Aug 20 2016, 3:49 PM
src/backends/julia/keywords.xml
9–45

I have Googled about it. Most of Julia editors use predefined lists of keywords (including IJulia). Also there is no clues that desired functions exists.

ivanlakhtanov marked an inline comment as done.Aug 20 2016, 3:50 PM
filipesaraiva added inline comments.Aug 20 2016, 5:55 PM
src/backends/julia/CMakeLists.txt
17

Oh really. But remove it because you must to drop that qrc file.

src/backends/julia/julia.qrc
2–7

This approach the resources are inserted directly in the binary file. So, for now, we are using the approach where the software loads the resources from out the binary.

Other reason is we are trying to use the same approaches for all backends, this way we can to make Cantor more easy to maintain. That implementation in Python backend is wrong, we need to change that.

Maybe in the future this approach can change, but for now use the CMake way.

src/backends/julia/keywords.xml
9–45

Ok. In past Scilab backend used this approach of XML file to keyword list, but we had several problems when Scilab released new versions. So we could to fix it for Scilab backend when we discover a function to print all the keywords used.

But for now it is ok, you can mark this as Done.

ivanlakhtanov edited edge metadata.

Moved from Qt Resources to raw files.

ivanlakhtanov marked 3 inline comments as done.Aug 20 2016, 9:54 PM
filipesaraiva accepted this revision.Aug 21 2016, 3:41 AM
filipesaraiva edited edge metadata.
This revision is now accepted and ready to land.Aug 21 2016, 3:41 AM
This revision was automatically updated to reflect the committed changes.