Update octave.xml to Octave 4.2.0
ClosedPublic

Authored by sirgienko on Feb 4 2019, 7:39 PM.

Details

Summary

I have updated keywords, commands, builtions and functions. As you can see, i move all builtins with normal name to functions list (like it was done before in third version), because builtins have highlight different from functions (for example, acos is builtin and acot is function, so if we *really* fill builtins list by octave builtions, file will turn into colour mess).

I aslo have added new blocks for classes. But some of them (events, methods, etc.) valid only into classdef block, how I could add resctriction for this?

Test Plan

As I see, there aren't tests for octave, right?

Diff Detail

Repository
R216 Syntax Highlighting
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
sirgienko created this revision.Feb 4 2019, 7:39 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptFeb 4 2019, 7:39 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
sirgienko requested review of this revision.Feb 4 2019, 7:39 PM

Could you also switch to WordDetect for the trivial cases, and set kateversion="5.0" ?

data/syntax/octave.xml
2716–2717

While you are working on this, could you change all RegExpr that use the simple \b...\b form into a WordDetect form? See: https://docs.kde.org/trunk5/en/applications/katepart/highlight.html

<WordDetect attribute=... String="function" .../>

This would be much faster than general purpose RegExps.

...And there are also new Default Styles for kateversion="5.0", see: https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/

Maybe you could also use these for the itemData, like for Operator dsOperator, or for Builtin dsBuiltIn, for Variable dsVariable. Ideally, the itemDatas would not have any hard-coded color anymore at all, since then the highlighting will work with all color schemas out of the box.

@dhaumann, look on the eps (this word contained in command list) on this image. The word have wrong highlighting.


I am testing my octave.xml file on v5.49.0 (current master need ecm 5.55 and I haven't it). Is it bug and I should create bug report, or it is already fixed?

sirgienko updated this revision to Diff 50963.EditedFeb 5 2019, 4:26 PM

Added requested changes

sirgienko marked an inline comment as done.Feb 5 2019, 4:27 PM
sirgienko added inline comments.Feb 5 2019, 4:33 PM
data/syntax/octave.xml
2745–2746

Could one word (end) be in several region?
Because, in Octave, you could end if statement by endif or just end.
In this variant, this syntax supported, but correct implementation also allow wrong Octave sytnax, like ending while via endfor (because we are using one region for them in code above).

cullmann requested changes to this revision.Feb 12 2019, 7:33 PM
cullmann added a subscriber: cullmann.

I think this is fine now, but I would like to have some autotests input file to have something we can later check for regressions.
Could you provide some MIT or otherwise freely licensed test file?
It must not cover all things, but at least some basic syntax and perhaps include some of your new things.
Thanks!

This revision now requires changes to proceed.Feb 12 2019, 7:33 PM

I think this is fine now, but I would like to have some autotests input file to have something we can later check for regressions.
Could you provide some MIT or otherwise freely licensed test file?
It must not cover all things, but at least some basic syntax and perhaps include some of your new things.
Thanks!

Is there documentation for writing tests? For example, I see input/Makefile and correct tests results like folding/Makefile.fold, html/Makefile.html, html/Makefile.html, but I don't understand, how I make the correct results, manually?

Good question:

I added a minimal howto to the README.md:

https://commits.kde.org/syntax-highlighting/9343341f91274f899f74b1ffe3fa260dadbc0978

Does that help you?

sirgienko added a comment.EditedFeb 13 2019, 2:23 PM

Good question:

I added a minimal howto to the README.md:

https://commits.kde.org/syntax-highlighting/9343341f91274f899f74b1ffe3fa260dadbc0978

Does that help you?

Partially. I have written the test file (test.octave), but after make test, I have errors in testhighlighter_test, htmlhighlighter_test and folding_test like this

FAIL!  : TestHighlighterTest::testHighlight(test.octave) 'ref.open(QIODevice::ReadOnly | QIODevice::Text)' returned FALSE. ()

If I change the filename to test.octave.syntax, I have only one error in testhighlighter_test:

TestHighlighterTest::cleanupTestCase() 'coveredList.open(QFile::WriteOnly)' returned FALSE. ()
   Loc: [/home/mmmm1998/Документы/Репозитории/syntax-highlighting/autotests/testhighlighter.cpp(108)]

I can't reproduce this build fail on my KDE Neon virtual machine, should I ignore this?

Also, what difference between highlight.tex and test.tex, for example? Octave have highlight_octave.m.syntax, which, I guess, is test file, should I remove it?

Good question:

I added a minimal howto to the README.md:

https://commits.kde.org/syntax-highlighting/9343341f91274f899f74b1ffe3fa260dadbc0978

Does that help you?

Partially. I have written the test file (test.octave), but after make test, I have errors in testhighlighter_test, htmlhighlighter_test and folding_test like this

FAIL!  : TestHighlighterTest::testHighlight(test.octave) 'ref.open(QIODevice::ReadOnly | QIODevice::Text)' returned FALSE. ()

If I change the filename to test.octave.syntax, I have only one error in testhighlighter_test:

TestHighlighterTest::cleanupTestCase() 'coveredList.open(QFile::WriteOnly)' returned FALSE. ()
   Loc: [/home/mmmm1998/Документы/Репозитории/syntax-highlighting/autotests/testhighlighter.cpp(108)]

I can't reproduce this build fail on my KDE Neon virtual machine, should I ignore this?

Also, what difference between highlight.tex and test.tex, for example? Octave have highlight_octave.m.syntax, which, I guess, is test file, should I remove it?

Hi,

I think test.octave is the right name.

That you get errors is clear, as there is no reference yet.

After running make test, you can run ./autotests/update-reference-data.sh

Then you should see new reference files in the source dirs (git status)

Take a look at them, if the look fine (e.g. the HTML output).

A new "make test" should succeed then

Could I specify, what dot is also word delimiter? Because, for example, "p.poly" has a wrong highlighting: "poly" highlighted as function, but it is not a function, it is a part of object "p".

sirgienko updated this revision to Diff 52441.Feb 24 2019, 1:48 PM

Add tests for Octave highlighting

sirgienko updated this revision to Diff 52442.Feb 24 2019, 1:53 PM

Remove outdate Octave tests

For the . stuff in keywords, have you tried to specify some

<keywords casesensitive="1"

weakDeliminator=":!+,-&lt;=&gt;%&amp;*/?[]^|~\\"
additionalDeliminator="&charsdelim;" />

style stuff?

data/syntax/octave.xml
2745–2746

At the moment you can't say that it opens multiple regions.

cullmann accepted this revision.Feb 24 2019, 4:54 PM

But beside the stuff with the xcvxv.xcvc stuff, I think you can commit this already as a first step to have a nicer highlighting, nice to see all hard coded colors gone!

This revision is now accepted and ready to land.Feb 24 2019, 4:54 PM
This revision was automatically updated to reflect the committed changes.