• Login
Community
  • Login

Conflict between user defined languages

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 2 Posters 566 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    John Kollar
    last edited by Nov 22, 2021, 8:19 PM

    I have multiple user defined languages and they often conflict, particularly in the definition of comment characters. For example, I have a language named Fortran90 that defines “C” and “c” as the “Open” strings for line comments with “Line comment position” set to “Force at beginning of line”. I also have a language named “Notes” that defines “##” as the “Open” string, but with “Line comment position” set to “Allow anywhere”. In a file with “Notes” set as the language I have “C” and “c” characters switching the style to the Fortran90 comment.
    This looks like a bug, but I wanted to get other opinions before I try and submit a bug report.

    The information from my “?|Debug Info…” menu option is as follows:

    Notepad++ v7.8.6 (64-bit)
    Build time : Apr 21 2020 - 15:23:03
    Path : C:\NotePad++\notepad++.exe
    Admin mode : OFF
    Local Conf mode : ON
    OS Name : Windows 10 Pro (64-bit)
    OS Version : 2009
    OS Build : 19042.1348
    Plugins : CodeAlignmentNpp.dll ComparePlugin.dll mimeTools.dll NppConverter.dll NppExport.dll NppFTP.dll OpenSelection.dll qkNppReverseLines.dll Remove Duplicate Lines.dll XMLTools.dll

    My “userDefineLang.xml” file has the following sections:

        <UserLang name="Fortran90" ext="for inc" udlVersion="2.1">
            <Settings>
                <Global caseIgnored="yes" allowFoldOfComments="yes" foldCompact="no" forcePureLC="1" decimalSeparator="0" />
                <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
            </Settings>
            <KeywordLists>
                <Keywords name="Comments">00C 00c 01 02 03! 04((EOL))</Keywords>
                <Keywords name="Numbers, prefix1"></Keywords>
                <Keywords name="Numbers, prefix2"></Keywords>
                <Keywords name="Numbers, extras1"></Keywords>
                <Keywords name="Numbers, extras2"></Keywords>
                <Keywords name="Numbers, suffix1"></Keywords>
                <Keywords name="Numbers, suffix2"></Keywords>
                <Keywords name="Numbers, range"></Keywords>
                <Keywords name="Operators1">- ( ) * , / : [ ] + = &gt;</Keywords>
                <Keywords name="Operators2"></Keywords>
                <Keywords name="Folders in code1, open"></Keywords>
                <Keywords name="Folders in code1, middle"></Keywords>
                <Keywords name="Folders in code1, close"></Keywords>
                <Keywords name="Folders in code2, open">THEN</Keywords>
                <Keywords name="Folders in code2, middle">ELSE</Keywords>
                <Keywords name="Folders in code2, close">ELSEIF ENDIF END</Keywords>
                <Keywords name="Folders in comment, open"></Keywords>
                <Keywords name="Folders in comment, middle"></Keywords>
                <Keywords name="Folders in comment, close"></Keywords>
                <Keywords name="Keywords1">PROGRAM SUBROUTINE FUNCTION INTERFACE RETURN CALL ENTRY STOP END STRUCTURE UNION MAP</Keywords>
                <Keywords name="Keywords2">IF THEN ELSEIF ELSE ENDIF DO ENDDO CONTINUE GOTO WHILE</Keywords>
                <Keywords name="Keywords3">INTEGER LOGICAL REAL CHARACTER RECORD POINTER BYTE PARAMETER COMMON</Keywords>
                <Keywords name="Keywords4">INCLUDE EXTERNAL IMPLICIT DATA SAVE NONE INTENT OPTIONAL USE FORMAT</Keywords>
                <Keywords name="Keywords5">%val %ref</Keywords>
                <Keywords name="Keywords6">.and. .or. .not. .TRUE. .FALSE. .LE. .LT. .GE. .GT. .EQ. .NE.</Keywords>
                <Keywords name="Keywords7">WRITE READ PRINT</Keywords>
                <Keywords name="Keywords8"></Keywords>
                <Keywords name="Delimiters">00&apos; 01\ 02&apos; 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" fgColor="FFFFFF" bgColor="303030" colorStyle="1" fontName="Consolas" fontStyle="0" fontSize="10" nesting="0" />
                <WordsStyle name="COMMENTS" fgColor="6C9C5C" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="LINE COMMENTS" fgColor="9CCE9B" bgColor="FFFFFF" colorStyle="1" fontName="Consolas" fontStyle="0" fontSize="10" nesting="0" />
                <WordsStyle name="NUMBERS" fgColor="FA9492" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS1" fgColor="D3D885" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                <WordsStyle name="KEYWORDS2" fgColor="D3D885" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                <WordsStyle name="KEYWORDS3" fgColor="CC9695" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS4" fgColor="CC9695" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS5" fgColor="CC9695" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS6" fgColor="85E0DE" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS7" fgColor="DCB38D" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="OPERATORS" fgColor="C0C0C0" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN CODE1" fgColor="EED991" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                <WordsStyle name="FOLDER IN CODE2" fgColor="EED991" bgColor="FFFFFF" fontName="" fontStyle="1" nesting="0" />
                <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS1" fgColor="A7BBDC" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            </Styles>
        </UserLang>
        <UserLang name="Notes" ext="" udlVersion="2.1">
            <Settings>
                <Global caseIgnored="no" allowFoldOfComments="yes" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
                <Prefix Keywords1="yes" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
            </Settings>
            <KeywordLists>
                <Keywords name="Comments">00## 01 02 03/* 04*/</Keywords>
                <Keywords name="Numbers, prefix1"></Keywords>
                <Keywords name="Numbers, prefix2"></Keywords>
                <Keywords name="Numbers, extras1"></Keywords>
                <Keywords name="Numbers, extras2"></Keywords>
                <Keywords name="Numbers, suffix1"></Keywords>
                <Keywords name="Numbers, suffix2"></Keywords>
                <Keywords name="Numbers, range"></Keywords>
                <Keywords name="Operators1">\&quot;</Keywords>
                <Keywords name="Operators2"></Keywords>
                <Keywords name="Folders in code1, open">{</Keywords>
                <Keywords name="Folders in code1, middle"></Keywords>
                <Keywords name="Folders in code1, close">}</Keywords>
                <Keywords name="Folders in code2, open"></Keywords>
                <Keywords name="Folders in code2, middle"></Keywords>
                <Keywords name="Folders in code2, close"></Keywords>
                <Keywords name="Folders in comment, open"></Keywords>
                <Keywords name="Folders in comment, middle"></Keywords>
                <Keywords name="Folders in comment, close"></Keywords>
                <Keywords name="Keywords1">RTRV-</Keywords>
                <Keywords name="Keywords2"></Keywords>
                <Keywords name="Keywords3"></Keywords>
                <Keywords name="Keywords4"></Keywords>
                <Keywords name="Keywords5"></Keywords>
                <Keywords name="Keywords6"></Keywords>
                <Keywords name="Keywords7"></Keywords>
                <Keywords name="Keywords8"></Keywords>
                <Keywords name="Delimiters">00&quot; 01\ 02&quot; 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>
            </KeywordLists>
            <Styles>
                <WordsStyle name="DEFAULT" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="COMMENTS" fgColor="7F9F7F" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="LINE COMMENTS" fgColor="7F9F7F" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="NUMBERS" fgColor="8CD0D3" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS1" fgColor="ECE488" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS2" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS4" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="OPERATORS" fgColor="EAEC84" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN CODE1" fgColor="EAEC84" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS1" fgColor="CC9393" bgColor="FFFFFF" colorStyle="1" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS2" fgColor="000000" bgColor="FFFFFF" colorStyle="0" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS3" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS4" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS5" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS6" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS7" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
                <WordsStyle name="DELIMITERS8" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
            </Styles>
        </UserLang>
    
    1 Reply Last reply Reply Quote 0
    • J
      John Kollar
      last edited by Nov 22, 2021, 8:25 PM

      Before anyone asks why I don’t use one of the two “Fortran” options that are already available in Notepad++, my company has legacy code in a special dialect of Fortran that is not adequately covered by either of the standard options, so I decided to just create my own version. The name “Fortran90” that I used is, perhaps, not the best name choice since my user defined version isn’t pure Fortran90.

      1 Reply Last reply Reply Quote 0
      • J
        John Kollar
        last edited by Nov 22, 2021, 8:30 PM

        Some additional information:
        In my “Fortran90” files the comment lines that begin with “C” or “c” are not always recognized as being comment lines. I can trigger a “reload” of the file into NotePad++ and it will correct the issue for the section of the file that is displayed, but when I scroll to another part of the file the comments are not displayed with the expected style again.

        L 1 Reply Last reply Nov 23, 2021, 4:35 AM Reply Quote 0
        • L
          ludamo 0 @John Kollar
          last edited by Nov 23, 2021, 4:35 AM

          @john-kollar There is another post re UDL issues (https://community.notepad-plus-plus.org/topic/20755/syntax-highlighting-works-for-a-time-then-irreproducibly-bleeds-only-restarting-npp-fixes-it) which you may find helpful if you haven’t already seen it. I had somewhat similar problems with AutoHotkey UDL and found that making the comment close character a ((EOL)) (that may not be possible for you) and ending the comment lines with a space rather than just tabs seemed to help a lot. Also making a toolbar button (Use Customize Toolbar plugin) with a macro for the Language menu and clicking on your language is a quick way to recolor the code.

          J 1 Reply Last reply Nov 23, 2021, 4:12 PM Reply Quote 1
          • J
            John Kollar @ludamo 0
            last edited by Nov 23, 2021, 4:12 PM

            @ludamo-0 , Thank you for the link to the other discussion thread.
            Unfortunately I’ve tried all the suggestions in that thread and none fix the problem. It does, however, confirm that there must be a bug since you and others are experiencing similar issues with user defined languages.

            Just to add to my earlier posts, I had the same experiences with the syntax highlighting and the code folding as others in that other discussion thread. That is, my user defined languages were working fine (including code folding and comment folding) in an earlier release of NotePad++ but at some point an update broke the behavior of all my user defined languages.

            I’ll investigate if there’s a way to send a bug report to the developers and mention the two discussion threads in this community forum.

            J 1 Reply Last reply Nov 23, 2021, 6:31 PM Reply Quote 1
            • J
              John Kollar @John Kollar
              last edited by Nov 23, 2021, 6:31 PM

              I found the following issues posted on GitHub that look like they’re related to this discussion thread:

              UDL syntax highlighting and folding regions are completely broken. #10007
              https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10007

              [UDL] “Force at beginning of line” for comments is buggy #9193
              https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9193

              Notepad++ User-Defined Language syntax coloring occasionally mess up in 64-bit version #5156
              https://github.com/notepad-plus-plus/notepad-plus-plus/issues/5156

              1 Reply Last reply Reply Quote 1
              4 out of 6
              • First post
                4/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors