• Login
Community
  • Login

Mathematica UDL

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
6 Posts 3 Posters 848 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.
  • F
    Fraw Farewell
    last edited by Nov 5, 2019, 4:11 AM

    Hi, I just started using NPP for Mathematica and I wonder where I can find a UDL for it that supposedly exists (see mentions here and here ). I can’t find it anywhere else except on the defunct wiki and the sourceforge project that’s also down. Anyone know where I can find it or another Mathematica UDL? Thanks.

    1 Reply Last reply Reply Quote 0
    • P
      PeterJones
      last edited by PeterJones Nov 5, 2019, 5:30 PM Nov 5, 2019, 5:29 PM

      Using wayback machine to follow links and find old versions of files that no longer exist, I was able to dig up the mma.udl.xml from 2013, which I uploaded to pastebin . No idea if that matches what was linked in 2016, but it’s a starting place.

      Unlike was mentioned in 2016, you don’t have to use the “import” button anymore; you can just save mma.udl.xml into your %AppData%\Notepad++\userDefineLangs folder, and reload Notepad++.

      1 Reply Last reply Reply Quote 1
      • P
        PeterJones
        last edited by Nov 5, 2019, 5:34 PM

        Nope, sorry, there’s an error in the file somewhere, so it won’t load/import… let’s see if I can figure out how to clean it up.

        1 Reply Last reply Reply Quote 0
        • P
          PeterJones
          last edited by PeterJones Nov 5, 2019, 9:03 PM Nov 5, 2019, 9:02 PM

          I don’t know exactly what was wrong with the original: well, it included comments, and accidentally included the markdown ``` … so those weren’t valid. But even after I did that, it was doing strange things, where the UDL would load, but it would color the text black-on-black and worse.

          I started over from scratch, and then started copying the keyword lists, etc. I thought maybe it was because there were ~19000 bytes in each of the three main keyword lists from the original; I split it into 5 keyword lists, with ~12000 bytes in each. That modified mma.udl.xml seems to work – it properly loads, and applies syntax-colors to a Mathematica file I downloaded (though I don’t know if it’s a reasonable color scheme).

          Mathematica has a lot of keywords/functions!

          (Also, I am not sure why the original kept each of :, ::, and # as separate keyword categories… I tried looking up what those do in mathematica… and they do different things, but don’t seem any more wildly different than other operators from each other. I kept them separate in mine as well, though if they could be combined with something else, I could have gotten down to fewer words per keyword category. )

          1 Reply Last reply Reply Quote 1
          • G
            guy038
            last edited by Nov 5, 2019, 9:18 PM

            Hello, @fraw-farewell, @peterjones,

            Here is, below, the modified version of the UDL file for Mathematica. I simply rewrote all terms with the exact case, as it is, for instance, in the userDefinedLang-markdown.default.modern.xml UDL file for MardDown language !

            After starting N++, you should see the Mathematica language, at the end of the drop-down list, when clicking on Language


            IMPORTANT :

            In order to keep my post’s size under 16384 bytes, I simply omit all the keywords in Keywords1, Keywords2 and Keywords3 sections. Of course, just re-paste these 3 keywords list, respectively ;-))

            <!-- END WAYBACK TOOLBAR INSERT -->
            <NotepadPlus>
                <UserLang name="Mathematica" ext="m nb" udlVersion="2.1">
                    <Settings>
                        <Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0"/>
                        <Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="yes" Keywords5="no" Keywords6="yes" Keywords7="no" Keywords8="no"/>
                    </Settings>
                    <KeywordLists>
                        <Keywords name="Comments"></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">&amp; _ , := = [ ] { } ( ) :&gt; - &gt; &lt; + @ / ; | . ~ ! ? * ^ % &apos;</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"></keywords>    <!-- Do NOT forget to insert ALL the appropriate keywords -->
                        <Keywords name="Keywords2"></keywords>    <!-- Do NOT forget to insert ALL the appropriate keywords -->
                        <Keywords name="Keywords3"></keywords>    <!-- Do NOT forget to insert ALL the appropriate 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="0000A0" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
                        <WordsStyle name="LINE COMMENTS" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
                        <WordsStyle name="NUMBERS" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS1" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS2" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS3" fgColor="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS4" fgColor="008000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS5" fgColor="008000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="KEYWORDS6" fgColor="808080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" 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="000000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="FOLDER IN CODE1" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
                        <WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
                        <WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0"/>
                        <WordsStyle name="DELIMITERS1" fgColor="808080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                        <WordsStyle name="DELIMITERS2" fgColor="808080" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" 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>
            </NotepadPlus>
            <!--
                FILE ARCHIVED ON 15:56:51 Dec 13, 2013 AND RETRIEVED FROM THE
                INTERNET ARCHIVE ON 17:22:19 Nov 05, 2019.
                JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
             
                ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
                SECTION 108(a)(3)).
            -->
            

            Note that since I do not know the Mathematica language and I do not have any appropriate source text, I did not go any further to test this UDL language !

            Best Regards,

            guy038

            1 Reply Last reply Reply Quote 1
            • G
              guy038
              last edited by guy038 Nov 5, 2019, 9:40 PM Nov 5, 2019, 9:40 PM

              Hi, @fraw-farewell, @peterjones,

              Actually, I did a simple test :

              First, I slightly changed the fgColor of these 3 sections below :

                          <WordsStyle name="KEYWORDS1" fgColor="0000ff" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                          <WordsStyle name="KEYWORDS2" fgColor="00ff00" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
                          <WordsStyle name="KEYWORDS3" fgColor="ff0000" bgColor="FFFFFF" fontName="Courier New" fontStyle="1" fontSize="10" nesting="0"/>
              
              • Then I re-started N++

              • I opened a new file

              • I selected the Mathematica UDL language

              • I pasted the last keyword of the Keywords1, Keywords2 and Keywords3 sections. So, the text :

              GeneratedParameters
              
              PointSize
              
              $VersionNumber
              

              And, as expected, these 3 commands, were highlighted in blue, green and red colors ;-))

              Cheers,

              guy038

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