Ticket #3690 (closed enhancement: fixed)

Opened 2 years ago

Last modified 22 months ago

Initial support of OpenCL syntax

Reported by: sergey Owned by:
Priority: major Milestone: 4.8.19
Component: mcedit Version: master
Keywords: Cc:
Blocked By: #3691 Blocking:
Branch state: no branch Votes for changeset: committed-master


Similar to all previous GPU-related syntax files from self, this adds an OpenCL syntax. Based on opencl-mode from Emacs with some own tweaks to the keywords.

While the syntax itself seems to work fine for our projects here, there is one thing we i'm not sure how to solve. Commonly used file extension for OpenCL programs is .cl, however in mcedit this extension is already taken by LISP syntax.

For now i've used a placeholder-ish extension of .opencl, so at least it's possible to choose OpenCL syntax from the menu (or tweak config in your ~/.config).

Any suggestions about how to move forward with this?


0001-Initial-support-of-OpenCL-syntax-highlighting.patch (7.1 KB) - added by sergey 2 years ago.

Change History

comment:1 Changed 2 years ago by mooffie

I think we should disassociate "cl" from Lisp. I dabbled in Common Lisp in the past for a while and I don't recall seeing .cl files. An experience user on SO says `cl` is mostly not used. You can see it sometimes in older code or projects which use several different Lisp dialects. MC's editor isn't suitable for editing Lisp code anyway.

comment:2 Changed 2 years ago by sergey

That's cool to hear :)

I've went ahead and created ticket #3691 with the patch which removes .cl from LISP. Seems kind of reasonable to do it as a separate commit.

Will update OpenCL patch now.

comment:3 Changed 2 years ago by andrew_b

  • Blocked By 3691 added

comment:4 Changed 2 years ago by andrew_b

  • Component changed from mc-core to mcedit

comment:5 Changed 2 years ago by andrew_b

Could you please provide some comment about opencl.syntax:122?

keyword '\{\s!"#$%&()\*\+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ\}' brightgreen 

comment:6 Changed 2 years ago by sergey

opencl.syntax is based on c.syntax and that line comes directly from c.syntax. To be honest, i've failed to deduct what exactly it matches and just left it as-is.

comment:7 follow-up: ↓ 8 Changed 2 years ago by zaytsev

I think this is some dark magic to highlight C character constants, like char a = '$'; for example...

comment:8 in reply to: ↑ 7 Changed 2 years ago by sergey

Ah, you're absolutely right! It's indeed character constant.

Shall we perhaps mention this in the comment for the pattern so there will be no confusion in the future?

comment:9 Changed 22 months ago by andrew_b

  • Status changed from new to closed
  • Votes for changeset set to committed-master
  • Resolution set to fixed
  • Milestone changed from Future Releases to 4.8.19
Note: See TracTickets for help on using tickets.