Bug 462944 - FR: add Syntax highlighting for COBOL
Summary: FR: add Syntax highlighting for COBOL
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: unspecified
Platform: unspecified All
: NOR wishlist
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-12 09:04 UTC by Simon Sobisch
Modified: 2023-01-14 19:00 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Sobisch 2022-12-12 09:04:34 UTC
Currently this is missing.
I would be able to help with this (providing language information like reserved words) but seek someone "knowledgable" who would be able to place it correctly in the syntax definition file and can commit that.

The first question would be what dialect and reference-format to support (or deciding to have for example 2 definitions).
Background for the later: there is the "commonly used" and "historical" format which has (normally) up to 80 columns, where only column 8-72 contain "code" (column 6 is a marker for line comments and similar, named "indicator", column 1-6,73+ ignored there) and the modern "free-form reference-format" (no marker line, code everywhere).
I don't know if the framework allows to use a reference, like "based on X" in which case variants may be possible.

In general - because this is still what is used most - I'd be mainly interested in "fixed-form reference-format" (the one with the "indicator").

As a starter: that would be the comment definition:

        <DetectChar attribute="Comment" context="comment" char="*" column="6"/>
        <DetectChar attribute="Comment" context="comment" char="/" column="6"/>
        <Detect2Chars attribute="Comment" context="comment" char="*" char2=">"/>

extension (ACUCOBOL-GT, can be added in "general" definitions as it would be otherwise invalid outside of a string literal):

        <DetectChar attribute="Comment" context="comment" char="|" />
Comment 1 Christoph Cullmann 2022-12-12 09:53:31 UTC
https://invent.kde.org/frameworks/syntax-highlighting/-/blob/master/README.md

has some hints how to add stuff.

Given we have no definition at all ATM I think you can decide which format to support.
Comment 2 Simon Sobisch 2022-12-12 10:00:16 UTC
(In reply to Christoph Cullmann from comment #1)
> Given we have no definition at all ATM I think you can decide which format
> to support.

The main question is: What would be accepted :-) along with "is there an option to 'base' a definition on another" (if for example a separate "cobolfree" and "cobolfixed" [like with a bunch of markdown highlighters] could be send in)?
Comment 3 Simon Sobisch 2022-12-12 10:03:18 UTC
Just found https://github.com/KDE/syntax-highlighting/compare/master...MihailJP:syntax-highlighting:cobol, this might be a good start (or possibly also a simple pull?)
Comment 4 Christoph Cullmann 2022-12-12 11:02:34 UTC
(In reply to Simon Sobisch from comment #3)
> Just found
> https://github.com/KDE/syntax-highlighting/compare/master...MihailJP:syntax-
> highlighting:cobol, this might be a good start (or possibly also a simple
> pull?)

If you can get this MIT licensed, sure.
Comment 5 Simon Sobisch 2022-12-12 11:44:29 UTC
(In reply to Christoph Cullmann from comment #4)
> (In reply to Simon Sobisch from comment #3)
> > Just found
> > https://github.com/KDE/syntax-highlighting/compare/master...MihailJP:syntax-
> > highlighting:cobol, this might be a good start (or possibly also a simple
> > pull?)
> 
> If you can get this MIT licensed, sure.

Just have seen that you've asked before: https://gist.github.com/MihailJP/4424622 - I've just sent a mail checking with the author and also suggesting some changes which could be done here otherwise.

I'll drop a note when I've got a response.
Comment 6 Bug Janitor Service 2023-01-08 17:20:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/417
Comment 7 Bug Janitor Service 2023-01-08 17:20:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/418
Comment 8 Christoph Cullmann 2023-01-08 18:26:53 UTC
Git commit d0363ba274fade404de41b898aed03e43c2b6b1f by Christoph Cullmann, on behalf of jonathan poelen.
Committed on 08/01/2023 at 18:26.
Pushed by cullmann into branch 'master'.

Add COBOL syntax

I took what was proposed on bugs.kde.org: https://bugs.kde.org/show_bug.cgi?id=462944#c3 and made several changes.

However, I don't know what to do about the license, when can it be considered as a new creation?

For the moment I added `author="Jonathan Poelen (jonathan.poelen@gmail.com);github.com/MihailJP" license="MIT"`. So there are 2 authors, is it a problem?

A  +105  -0    autotests/folding/highlight.cbl.fold
A  +112  -0    autotests/html/highlight.cbl.dark.html
A  +112  -0    autotests/html/highlight.cbl.html
A  +105  -0    autotests/input/highlight.cbl
A  +105  -0    autotests/reference/highlight.cbl.ref
A  +733  -0    data/syntax/cobol.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/d0363ba274fade404de41b898aed03e43c2b6b1f
Comment 9 Christoph Cullmann 2023-01-14 19:00:35 UTC
Git commit b7c89c7820e826a3d1e6b865b5ef0d611ae7c81d by Christoph Cullmann, on behalf of jonathan poelen.
Committed on 14/01/2023 at 19:00.
Pushed by cullmann into branch 'kf5'.

Add COBOL syntax

I took what was proposed on bugs.kde.org: https://bugs.kde.org/show_bug.cgi?id=462944#c3 and made several changes.

However, I don't know what to do about the license, when can it be considered as a new creation?

For the moment I added `author="Jonathan Poelen (jonathan.poelen@gmail.com);github.com/MihailJP" license="MIT"`. So there are 2 authors, is it a problem?

A  +105  -0    autotests/folding/highlight.cbl.fold
A  +112  -0    autotests/html/highlight.cbl.dark.html
A  +112  -0    autotests/html/highlight.cbl.html
A  +105  -0    autotests/input/highlight.cbl
A  +105  -0    autotests/reference/highlight.cbl.ref
A  +733  -0    data/syntax/cobol.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/b7c89c7820e826a3d1e6b865b5ef0d611ae7c81d