Community
    • 登入

    COBOL Comment lines are not displaying correctly if there is a character in Column 6

    已排程 已置頂 已鎖定 已移動 Help wanted · · · – – – · · ·
    15 貼文 8 Posters 4.1k 瀏覽
    正在載入更多貼文
    • 從舊到新
    • 從新到舊
    • 最多點贊
    回覆
    • 在新貼文中回覆
    登入後回覆
    此主題已被刪除。只有擁有主題管理權限的使用者可以查看。
    • Will LamersW
      Will Lamers
      最後由 編輯

      Hello team -

      For introduction I have been a COBOL programmer for over twenty years.

      Comment lines for COBOL do not display correctly in Notepad++ if there are any characters in column 6. By definition a comment line is any line with an asterisk (*) or slash (/) in the indicator area (column 7) of the line, and should not be dependent on any preceding characters.

      (https://www.ibm.com/support/knowledgecenter/en/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/ref/rlfmtcom.htm)

      The first three lines below are displaying comments correctly, but the fourth and fifth lines are displaying as active code rather than a comment. The sixth line and others following are again displaying correctly. The only time that the comment line is not formatted correctly is when there is a character in Column 6 and a comment indicator in Column 7.

      CobolComment1.PNG

      Eventually the formatting gives up:

      CobolComment2.PNG

      From this point on, for the next 11,000+ lines, there is no formatting at all.

      This program does compile, so the highlighting does not affect the actual code, but it is a frustration that the highlighting of Comment Lines goes funky.

      Would it be possible to correct the definition of a COBOL comment line? Is there somewhere I can change the highlighting myself to match the actual COBOL definition?

      Thanks in advance!

      Will

      PeterJonesP EkopalypseE Alan KilbornA mpheathM 4 條回覆 最後回覆 回覆 引用 0
      • PeterJonesP
        PeterJones @Will Lamers
        最後由 編輯

        @Will-Lamers ,

        I get the same behavior in Notepad++. So I tried in SciTE (Notepad++ uses the Scintilla editor component, which is also in charge of syntax highlighting; the SciTE editor is the Scintilla’s testbed editor using the Scintilla editor component). It has the same bug, which means the bug is in the codebase of the Scintilla library, rather than something specific in Notepad++.

        To get a Scintilla bug fixed in Notepad++:

        1. you’ll have to file a bug with Scinitlla (start here), then wait for them to fix it

        2. once/if Scintilla fixes the COBOL lexer, then you will have to ask the Notepad++ developers (start here) to update to the new version of Scintilla, and wait for that to be done

        Sorry that I don’t have better news for you.

        1 條回覆 最後回覆 回覆 引用 1
        • EkopalypseE
          Ekopalypse @Will Lamers
          最後由 編輯

          Seems there is some interest for Cobol lately.

          PeterJonesP 1 條回覆 最後回覆 回覆 引用 1
          • PeterJonesP
            PeterJones @Ekopalypse
            最後由 編輯

            @Ekopalypse said in COBOL Comment lines are not displaying correctly if there is a character in Column 6:

            Seems there is some interest for Cobol lately.

            Possibly related to current events?

            1 條回覆 最後回覆 回覆 引用 2
            • Robert PlaggeR
              Robert Plagge
              最後由 編輯

              I noticed it helps when you add a space between whatever is before the leading asterisk, and then add a > after.

              * Notepad++ "claims" the next line is not a comment even though it is.
              * Therefore, Notepad++ does not mark it as a comment.
              1234* I really am a comment.
              
              * Notepad++ thinks the next line is a comment, so it marks accordingly
              1234 *> I be a comment.
              

              But I agree, the language definition should be updated to correct the defect.

              PeterJonesP 1 條回覆 最後回覆 回覆 引用 0
              • PeterJonesP
                PeterJones @Robert Plagge
                最後由 編輯

                @Robert-Plagge said in COBOL Comment lines are not displaying correctly if there is a character in Column 6:

                But I agree, the language definition should be updated to correct the defect.

                As I described in May, the problem is in the Scintilla library, which is not under Notepad++-developer’s control. The update process needs to start on the Scintilla end. Until someone starts that process by filing a bug report with Scintilla, nothing will happen.

                1 條回覆 最後回覆 回覆 引用 0
                • Alan KilbornA
                  Alan Kilborn @Will Lamers
                  最後由 編輯

                  @Will-Lamers

                  Peter said:

                  Sorry that I don’t have better news for you.

                  And the news gets worse, regarding :

                  you will have to ask the Notepad++ developers (start here) to update to the new version of Scintilla, and wait for that to be done

                  This type of update is sadly done very infrequently. You may be waiting a long time.

                  1 條回覆 最後回覆 回覆 引用 0
                  • Xuân-Thơ HOÀNGX
                    Xuân-Thơ HOÀNG
                    最後由 編輯

                    This bug is still not fixed in Scinitlla/Notepad++ :(

                    I prefer using Notepad++ to read COBOL code in multi-tabs because of its lightweight.

                    Alan KilbornA mpheathM 2 條回覆 最後回覆 回覆 引用 0
                    • Alan KilbornA
                      Alan Kilborn @Xuân-Thơ HOÀNG
                      最後由 編輯

                      @xuân-thơ-hoàng said in COBOL Comment lines are not displaying correctly if there is a character in Column 6:

                      This bug is still not fixed in Scinitlla/Notepad++

                      Have you freshened a similar complaint on the Scintilla site?

                      1 條回覆 最後回覆 回覆 引用 0
                      • mpheathM
                        mpheath @Xuân-Thơ HOÀNG
                        最後由 mpheath 編輯

                        @xuân-thơ-hoàng

                        An open bug report at Scintilla:

                        #1893 Bug comments Language Cobol columns 7

                        Note:

                        Maintenance of particular languages depends on contributions from users of that language. Reporting a problem here may result in a fix but its possible that no fix is forthcoming or it may be some time before a fix.

                        If you can contribute, then perhaps it can be fixed.

                        Lexilla now handles lexers so contribute there.

                        1 條回覆 最後回覆 回覆 引用 0
                        • Paul BakerP
                          Paul Baker
                          最後由 編輯

                          I know this is an old post but maybe this will help someone. I recently started programming in Unisys COBOL and noticed the issue you are referring to. To fix it, you will need to rebuild NPP. It is open source on Git.

                          LexCOBOL.cxx is the program that needs to be updated. Around line 210 is an if statement that starts if (isCOBOLwordstart(ch) || … You need to add an additional condition that checks if the column number is 7 or greater. The new if statement starts like this:

                          if (column > 6 && (isCOBOLwordstart(ch) || ....)
                          

                          This may break some code that works with other compilers like Microfocus COBOL. For me, this change worked perfectly.

                          PeterJonesP 1 條回覆 最後回覆 回覆 引用 2
                          • PeterJonesP
                            PeterJones @Paul Baker
                            最後由 編輯

                            @Paul-Baker ,

                            Thanks for sharing that.

                            As the Scintilla developer said in the original report about this, lexer updates in the Scintilla/Lexilla base code are more likely to happen if a user of that language submits a PR in the Lexilla repo to get it fixed.

                            You seem to have the skills to provide such a PR. As a service to Notepad++ (and all users of the Scintilla/Lexilla libraries), you might consider making that PR.

                            In an ideal world, there might be an added bit of logic to include a lexer-specific option that can turn it on or off, which would then avoid “breaking” other people’s use of the COBOL; such things are controlled by scintilla “properties” – you can look for the DefineProperty and similar code in other of the lexers to see how that’s done; LexCOBOL itself doesn’t have any properties yet. Of course, if it’s an option, then after the new Lexilla was released with that LexCOBOL implementation, then after Notepad++ updated to use the newest Lexilla, you’d have to ask Notepad++ to also give access to that property (maybe similarly to the SQL backslash-as-escape in the Language Preferences), or you’d have to use PythonScript or another plugin to edit the property value.

                            Paul BakerP 1 條回覆 最後回覆 回覆 引用 2
                            • Paul BakerP
                              Paul Baker @PeterJones
                              最後由 編輯

                              @PeterJones said in COBOL Comment lines are not displaying correctly if there is a character in Column 6:

                              As the Scintilla developer said in the original report about this , lexer updates in the Scintilla/Lexilla base code are more likely to happen if a user of that language submits a PR in the Lexilla repo to get it fixed.

                              Hi Peter, Thanks for the PR info. I looked at the site. I’ll read up on the steps on how to create a PR. There is one more small change I made to LexCOBOL.cxx. That was to handle the keyword “Varying”. LexCOBOL looks for a “V” as in PIC 99V99 and does not check if it is followed by an alphabetic character. So basically keywords that starts with a “V” are not highlighted as such.

                              Thanks again!
                              -PB

                              1 條回覆 最後回覆 回覆 引用 3
                              • mpheathM
                                mpheath @Will Lamers
                                最後由 編輯

                                3 commits at Lexilla fixes some COBOL issues including the OP issue.

                                1. COBOL: Stop string literal continuing over line end. Issue #229 .
                                2. COBOL: Recognize keywords that start with ‘V’. Issue #230 .
                                3. COBOL: Recognize comments after tag or that start with ‘/’. Issue #231 .

                                1 = fix for https://community.notepad-plus-plus.org/topic/25575/cobol-syntax-and-wrap-strings mentioned by @RiaanPretoriusRIP
                                2 = fix for V issue with keywords mentioned by @Paul-Baker
                                3 = fix for the OP issue with comment lines with * and added support for / in column 7 mentioned by @Will-Lamers .

                                So when Lexilla releases a new version and is committed into Notepad++ repository for Notepad++ release, then hopefully COBOL editing will be more enjoyable. Probably expect in Notepad++ around mid-year 2024.

                                Xuân-Thơ HOÀNGX 1 條回覆 最後回覆 回覆 引用 4
                                • Xuân-Thơ HOÀNGX Xuân-Thơ HOÀNG referenced this topic on
                                • Xuân-Thơ HOÀNGX
                                  Xuân-Thơ HOÀNG @mpheath
                                  最後由 編輯

                                  @mpheath
                                  Thanks!
                                  Checked! These fixes are included in version 8.6.6 (currently in the RC2 phase).

                                  1 條回覆 最後回覆 回覆 引用 2
                                  • 第一個貼文
                                    最後的貼文
                                  The Community of users of the Notepad++ text editor.
                                  Powered by NodeBB | Contributors