Up to date Python highlighting

Up to date Python highlighting

1
NewbieNewbie
1

    Mar 08, 2008#1

    Hi all. I am hoping somebody has a more up to date Python syntax highlighting file (2.5) that they wouldn't mind sharing?

    Also I am a little disappointed that UltraEdit 14 still does not include Python highlighting by default when it includes Ruby and MySQL, etc.

    Many thanks in advance.

    Morgan

    236
    MasterMaster
    236

      Mar 08, 2008#2

      Well, I use the following one - it's not perfect but works well enough for me. Since I couldn't find a way to attach it as a file ("The extension txt is not allowed"), I have pasted it below:

      Code: Select all

      OLD version deleted - check below for new, correct version
      
      Best regards,
      Tim

      P.S.: One thing that bugs me is that ":" will cause indentation even it occurs within a slice. I (and several other people) have asked IDM to create a configuration option that an indent string should only work if it's the last thing on the line (except for whitespace and comments). This would require indent strings to allow regexes like :[ \t]*($|#.*$), but so far no luck. Maybe if some more people ask IDM ([email protected]) for this feature, it will get bumped up on the wish list...so please chime in if you at all agree that that would be a good idea. If it works for function strings, why not for indent strings. (Why not for the entire wordfile, come to that. Other editors can do it, too).

      1
      NewbieNewbie
      1

        Mar 16, 2008#3

        I just asked about the python indent string issue last week. There are other things too...but this is one of the biggest pains...please Ian....put it in there!

        OLIVER

        236
        MasterMaster
        236

          Mar 17, 2008#4

          Just FYI:

          I'm currently working on a completely new Python wordfile that will include a lot more methods, attributes and modules. I will send it to IDM for inclusion in the download area soon. One question to the forum:

          There are some modules within modules (like distutils.dist) in Python's "Global module index". If I put distutils.dist (next to distutils) into the wordfile, only distutils will be "colored". I guess that the dot (delimiter) causes the highlighting engine to stop after the distutils part already matched a definition in the wordfile.

          So the alternative is to include all the submodules as "normal" modules, i.e., put "dist distutils" into the wordfile. This will, of course, lead to highlighting the word "dist" even if it's not in a distutils.dist context. So what do you think is the lesser of two evils? Dropping the submodules and have them un-highlighted - or including them and have them highlighted in places where they shouldn't be?

          Thanks for your input,
          Tim

          P.S.: Of course, if regular expressions were allowed here, if wouldn't be a problem. Again...

          6,686585
          Grand MasterGrand Master
          6,686585

            Mar 17, 2008#5

            I have 2 suggestions:

            1) Remove . from the delimiters and specify distutils distutils.dist.

            2) Since UE v10.00 it is allowed that a word in the word lists starts with a delimiter. So you can specify

            .dist
            distutils


            to highlight only ".dist" but not "dist".
            Best regards from an UC/UE/UES for Windows user from Austria

            236
            MasterMaster
            236

              Mar 17, 2008#6

              Hi Mofi,

              thanks a lot! Suggestion #2 sounds very good for my needs.

              It seems that definitions without a delimiter will overrule ones with a delimiter regardless of the order of the sections in which they turn up in the wordfile. Sometimes there are function names that are identical to method names, so I would have liked to define "dist" (as in dist()) separately from ".dist" (as in distutils.dist). But the highlighting scheme for the section in which "dist" is defined always overrides the definition for ".dist" - probably no way around that, is there - other than following suggestion #1? Because if I do that, all the highlighting for methods gets lost, so that's not a viable option...

              Thanks,
              Tim

              6,686585
              Grand MasterGrand Master
              6,686585

                Mar 17, 2008#7

                You are absolutely right with your observation. I don't have any idea how to solve your problem with identical function and method names with the current available syntax highlighting rules.
                Best regards from an UC/UE/UES for Windows user from Austria

                236
                MasterMaster
                236

                  Mar 18, 2008#8

                  OK, I've updated my wordfile and used Mofi's wordfile tools to sort it, check for duplicates and invalid strings. This was enormously helpful since the original wordfile I had started working on had quite a few errors and omissions that I had never looked at in more detail. So I guess this one is quite a lot better than the old one posted above. I have refrained from adding too many modules, attributes and methods since a "comprehensive" wordfile created from the Python documentation would have been vast but still incomplete, not to mention fraught with problems arising from duplicate words.

                  The wordfile was available for downloaded from user-submitted wordfiles for UltraEdit/UEStudio page.

                  Update: The wordfile is not available anymore as separate download. The Python wordfile is included installation package of UltraEdit and UEStudio.

                  HTH,
                  Tim

                  11
                  NewbieNewbie
                  11

                    Dec 12, 2008#9

                    I've taken your wordfile and enriched it with mine.

                    Folding somehow works, but as python doesn't has a closing tag, the closing boundary is not exact. And don't bug me about it.

                    enjoy
                    wordfile_python.zip (3.07 KiB)   2158
                    Enriched Python syntax highlighting wordfile (with corrections from Mofi).

                    6,686585
                    Grand MasterGrand Master
                    6,686585

                      Dec 13, 2008#10

                      Hi petertable,

                      I have made some corrections in your version of the syntax highlighting wordfile for Python and attached this version compressed with ZIP to your post. Compare it with your version on your hard disk to see what I have changed.
                      Best regards from an UC/UE/UES for Windows user from Austria