Added Intel HEX file support for the Syntax highlighting database
ClosedPublic

Authored by martonmiklos on Aug 17 2017, 2:54 PM.

Details

Summary

I have created an syntax highlight file for the Kate.

The coloring scheme tries to match the coloring use by the VIM. Unfortunately the Kate syntax highlight does not support changing the background color, so in some cases the VIM scheme was modified to make it better looking.

For more information about the Intel HEX files please see:
https://en.wikipedia.org/wiki/Intel_HEX

Ps.: I have filed a KDE bug 383610 about this patch.

Test Plan

Open an Intel HEX file with syntax highlight installed.

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.
martonmiklos created this revision.Aug 17 2017, 2:54 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 17 2017, 2:54 PM
Restricted Application added a subscriber: Frameworks. · View Herald Transcript

Cool, I use them at work ;=)

Could you add a minimal example as unit test?

And could we have as license something like "MIT"?

For the coloring: it is preferred to use some of our default styles and no hard coded colors to make color schemes possible.

Please change the kateversion, and as Christoph mentioned please remove hard-coded colors. You can find a list of all valid default styles here: https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/

data/syntax/hex.xml
3 ↗(On Diff #18291)

kateversion 16.04 is not a valid number. Please change to kateversion="5.0"

Could you add a minimal example as unit test?

Sure, I have just seen that these xmls could be autotested.

And could we have as license something like "MIT"?

Sure, I have no objections about it.

For the coloring: it is preferred to use some of our default styles and no hard coded colors to make color schemes possible.

Please change the kateversion, and as Christoph mentioned please remove hard-coded colors. You can find a list of all valid default styles here: https://kate-editor.org/2014/03/07/kate-part-kf5-new-default-styles-for-better-color-schemes/

Thanks for the tips, I will change the license, colors and add autotest.

martonmiklos updated this revision to Diff 18310.EditedAug 17 2017, 9:11 PM

Okay so:

  • License updated to MIT
  • Added detection for invalid RecordType (05<)
  • Changed formatting to use builtin formats
  • Added autotest case with a sample file with two malformed lines and a HTML output
  • I think folding tests are not acceptible for this file type.

@cullmann Since you seem to know this, please take care of this change request :-)

cullmann requested changes to this revision.Aug 21 2017, 5:48 AM

I am happy beside one thing I missed: I think the file should be called intelhex.xml, given its for the intel hex format only (the name is already fine, did miss that the filename is only hex).
Otherwise: very nice, thanks again for the contribution.

This revision now requires changes to proceed.Aug 21 2017, 5:48 AM
martonmiklos marked an inline comment as done.Aug 21 2017, 5:38 PM

I am happy beside one thing I missed: I think the file should be called intelhex.xml, given its for the intel hex format only (the name is already fine, did miss that the filename is only hex).
Otherwise: very nice, thanks again for the contribution.

I agree with the renaming, uploaded a new diff with the proper filename. I am not really familiar with the Phabricator (yet), do I need to do anything else?

Hmm, the diff still looks like it has the old names, perhaps the update went wrong somehow?

martonmiklos edited edge metadata.

Hmm, the diff still looks like it has the old names, perhaps the update went wrong somehow?

Yepp, I have missed the second page after the diff upload. It should be correct now.

cullmann accepted this revision.Aug 21 2017, 10:11 PM

Ok, I am happy with that ;=)

Now I can look at colorful numbers at work, hehe ;=)

This revision is now accepted and ready to land.Aug 21 2017, 10:11 PM
aacid added a subscriber: aacid.Sep 5 2017, 8:23 PM

Which repo is this for?

Has this landed?

aacid requested changes to this revision.Sep 5 2017, 8:24 PM
This revision now requires changes to proceed.Sep 5 2017, 8:24 PM

syntax-highlighting.git, on first glance not landed atm.

Can you commit on your own or should I push it for you Miklos?

aacid set the repository for this revision to R216 Syntax Highlighting.Sep 5 2017, 8:52 PM
martonmiklos added a comment.EditedSep 5 2017, 8:58 PM

syntax-highlighting.git, on first glance not landed atm.

Can you commit on your own or should I push it for you Miklos?

Hi Cullmann,
I am on holiday ATM so if you could push it that would be awesome. Otherwise I can take care of it next week.

Thanks in advance!

This revision was automatically updated to reflect the committed changes.

I see, the ref file is missing in autotests/reference

Should be fixed now:

commit fd79b6842c6f33a1aca4f500354ca2a69c52689e
Author: Christoph Cullmann <cullmann@kde.org>
Date: Wed Sep 6 08:08:49 2017 +0200

add missing reference files for tests, looks ok, I think

Differential Revision: https://phabricator.kde.org/D7367

Should be fixed now:

commit fd79b6842c6f33a1aca4f500354ca2a69c52689e
Author: Christoph Cullmann <cullmann@kde.org>
Date: Wed Sep 6 08:08:49 2017 +0200

add missing reference files for tests, looks ok, I think

Differential Revision: https://phabricator.kde.org/D7367

Thanks guy and I appologize for the missing file.