Support for native Matlab strings
ClosedPublic

Authored by bbuch on Aug 27 2019, 4:40 PM.

Details

Summary

As of Matlab 2016b, a separate string data type and literal was introduced
in Matlab.

https://de.mathworks.com/help/matlab/matlab_prog/create-string-arrays.html

The new literals are syntactically equivalent to the old character verctors
except that they are delimited by double quote. The term 'character vector'
is now consistently used for the old single quote literales.

The patch renames single quote literals to CharVector and adds double
quote literals as String.

CharVector's are associated with the theme category dsSpecialString.
String's are associated with the theme category dsString. Incomplete
CharVector's and String's are consequently associated with the theme
category dsError.

The examples at the end of the file were extended by the new literals.

Diff Detail

Repository
R216 Syntax Highlighting
Branch
arcpatch-D23500
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15803
Build 15821: arc lint + arc unit
bbuch created this revision.Aug 27 2019, 4:40 PM
Restricted Application added projects: Kate, Frameworks. · View Herald TranscriptAug 27 2019, 4:40 PM
Restricted Application added subscribers: kde-frameworks-devel, kwrite-devel. · View Herald Transcript
bbuch requested review of this revision.Aug 27 2019, 4:40 PM
cullmann requested changes to this revision.Aug 27 2019, 4:59 PM

Hi, I think it is very nice that you pickup the matlab file!

Three things I would like to have changed:

  1. please move the example from the comment in the XML to autotests/input/test.m, then we can have reference results for this and see changes
  2. version of the file must be increased, otherwise the updating mechanism is tricked
  3. I would prefer not to have hardcoded colors if possible

Thanks!

This revision now requires changes to proceed.Aug 27 2019, 4:59 PM

If you use kateversion="5.0" then you can use the new text styles we introduced with KDE 5:
https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/

This allows to remove many of the hardcoded colors so that the highlighting works with all color themes.

bbuch updated this revision to Diff 64854.Aug 28 2019, 2:49 PM

increase file version, kateversion to 5, remove hard coded colors, example to autotests input

bbuch added a comment.Aug 28 2019, 2:50 PM

Should I add the changes from D23498 here as well?

You can also add the changes from your other review request if you want, since the changes are rather small. But on general it's a good idea to have many small manageable review request instead of one big one.

bbuch updated this revision to Diff 64926.Aug 29 2019, 9:27 AM

Highlighting of keywords, variables and operators as such for Matlab source files

Currently, Matlab source files display keywords, variables, and operators as
normal text. So they don't get any special highlighting and their presentation
can't be varied by themes. Especially for keywords this is very annoying.

The patch assigns them to the appropriate theme category to fix this.

cullmann accepted this revision.Aug 29 2019, 8:19 PM

Thanks, this seems ok for me, will add the needed test references myself (make test complaints about missing ones).

This revision is now accepted and ready to land.Aug 29 2019, 8:19 PM

I see, there is already some highlight.m test, I will just add your test case to that stuff.

This revision was automatically updated to reflect the committed changes.