Syntax highlighting with downloaded wordfiles.txt

Syntax highlighting with downloaded wordfiles.txt

1
NewbieNewbie
1

    Aug 10, 2006#1

    I downloaded wordfiles.txt, appended it to my default wordfile.txt as /L13, it appears on my list (View/View As/UltraEdit Word List), but the colors are not right after about the 15th line.

    Here it is, after the default wordfile.txt. Am I doing something wrong?
    Thanks.

    Edit: Posted wordfile for syntax highlighting UE/UES wordfiles was replaced by the wordfile which can be download from Downloads - Extras - Wordfiles page by clicking on Wordfile Editing.

    6,677581
    Grand MasterGrand Master
    6,677581

      Aug 11, 2006#2

      Well, the words are not sorted and Nocase is wrong because the keywords are case-sensitive. Also HTML_LANG is nonsense.

      But maybe my definition for wordfiles is better. My function string includes only the language definitions, but not the color sections. However, with my language definition the color sections can be folded.

      Do you wonder why the word definitions starting with / work, although / is also a delimiter? I, too.

      Edited on 2006-01-06: I answer my own question with following line found in readme.txt for v10.00:
      Syntax Highlighting allows delimiters to be start character of word
      Well this also means, you will need at least UltraEdit v10.00 or any version of UEStudio for this wordfile.

      Edited on 2006-01-07: Added UWF to the file extensions.

      Use File Names = wordfile.txt wordfile.new wordfile.old instead of File Extensions = UWD UWF to highlight the standard wordfiles of IDM in the program directory of UltraEdit or UEStudio.

      Edited on 2007-03-04: The best wordfile for syntax highlighting wordfiles can be downloaded from the Downloads - Extras - Wordfiles page with a click on Wordfile Editing. See the date on the download page when it was last updated to highlight also new keywords.

      236
      MasterMaster
      236

        Aug 11, 2006#3

        Great! Thanks Mofi!

        111
        Basic UserBasic User
        111

          Jan 06, 2007#4

          Hello Mofi,
          I have played with your language file and here is my version, which I believe is slightly better.
          What I have changed:
          • added comments to explain it better
          • added a comment highligting (only for #SPACE comments)
          • added a new File Extension UWF as someone uses it as well
          • added File Names to automatically highlight the default file names
          • added TAB into delimiter.
          • added "/C1" and "/L1" to Close Fold Strings as the section might not be in order
          There are still some slight problems which I cannot solve.

          Maybe you or someone else will be able to help.
          Please have a look at it as I would like to hear your opinion as
          I am not 100% sure that I did not broke anything by making your file better.

          Regards, Dalibor

          Edit: Posted wordfile for syntax highlighting UE/UES wordfiles was replaced by the wordfile which can be download from Downloads - Extras - Wordfiles page by clicking on Wordfile Editing.

          6,677581
          Grand MasterGrand Master
          6,677581

            Jan 06, 2007#5

            • added comments to explain it better

              Could be really useful for newbies. Thanks.
            • added a comment highligting (only for #SPACE comments)

              There is no official comment specification for wordfiles. Using # or // for comment lines as discussed at Comments in wordfile.txt..... How? are not official although working and // also suggested by UE support. My wordfile suggestions contain always only official techniques and not tricks maybe not working anymore in future versions. However, every user can add such tricks for himself. So it's okay.
            • added a new File Extension UWF as someone uses it as well

              A second file extension does not matter, so why not!
            • added File Names to automatically highlight the default file names

              Till today I did not know that both - File Extensions = and File Names = - can be specified at the same time for a language. The UltraEdit syntax highlighting help is not detailed enough for this point. But it looks like it is working. So it is a good idea and I have done this now also in my standard personal wordfile. Thanks for this hint.

              Edited on 2006-01-07: Correction: a combination of File Extensions = and File Names = is not allowed, although it looks like it is working. See below my my post for the reason.
            • added TAB into delimiter.

              A TAB is not an official delimiter in wordfiles as far as I know. I know, that UltraEdit allows it, but I would not use it in a wordfile except in the list of delimiter characters. The problem with tabs is that the tab width is not fixed and so a file looking good for person A could look awful for person B because of different tab stop values. That's why I have not added it in my syntax highlighting definition for wordfiles.
            • added "/C1" and "/L1" to Close Fold Strings as the section might not be in order

              Even if a wrong order is allowed by UltraEdit, it's a very bad idea not to fix it as soon as possible. My ultimate word definitions sorting macro requires a correct order for the color groups. So I would not add /C1 and /L1 to the close fold strings to maybe see already with the code folding engine that something is not correct.

            111
            Basic UserBasic User
            111

              Jan 07, 2007#6

              Hello,
              thank you for your reply. Do you possibly know a solution to those problems mentioned?
              Especially I cannot understand why #define is colored in blue when using my word file.

              I would like to send this wordfile to the guys maintaing this site so they would add it to the downloads section and replace the wordfile which is there now. That one does not work and it is very confusing to start with it (according to my own experience). But as you did 99.9% of the work on this file, you might want to send your file to them to be uploaded.

              Dalibor

              6,677581
              Grand MasterGrand Master
              6,677581

                Jan 07, 2007#7

                I have edited a little bit your forum post with your version of the language definition. I corrected some small spelling mistakes in the comments, inserted 2 non breaking spaces after 2# to display in HTML also the 2 spaces required for your line comment definition and reordered the language definition line.

                You should never write in your comments color names like "red" or "blue". You don't know which color a user uses for color 1 - 8. Write "color 1" or "color 4".


                # #define is colored in blue and I do not know why and how to get rid of it

                As already explained there is no real line comment definition for syntax highlighting wordfiles. Everything between /Lx and /Cx will be interpreted by UE as keyword definition line for color group 1 if it does not start with the known and documented case-sensitive definition strings.

                So your comment lines starting with #SPACE are for UltraEdit a list of some valid and many invalid keywords starting with character # for color group 1. UltraEdit interprets from your comment lines the keywords #, #SPACE and #define (listed twice in the "comments") as valid keywords for color group 1 and the rest as not valid keywords because the other words start not with the same character as the line.

                So if a wordfile contains anywhere a single # or #SPACE or #define it will be highlighted with color 1 from language definition "UltraEdit Word Files".

                Again I can only suggest not to write "comments" into a wordfile because there is no real comment line definition for wordfiles. In all my wordfiles are only real definition lines, no pseudo comment lines. IDM will not accept a wordfile for their download page which contains invalid specifications caused by "comment lines".


                # "Characters" is displayed in red in /Cx"Reserved Characters" - this is because " is in /Delimiters, but it must be there so folding works correctly
                # "String" is displayed in red in language definition line, because it belongs to both "Tags" and "Functions"


                It is a fact that only words can be specified for syntax highlighting and not strings with a space which is always a delimiter character. Ian has surely not thought about highlighting wordfiles as he has written the first syntax highlighting engine and created the first definition strings. /Function_String = and String_Chars = would be much better for syntax highlighting the wordfiles, but that cannot be changed anymore.


                I will sent IDM my slightly improved version of the wordfile for highlighting wordfiles (see my post above) because it is really 100% correct and does not contain tricky (= invalid) things.

                111
                Basic UserBasic User
                111

                  Jan 07, 2007#8

                  Mofi, thanks for the explanation.

                  I have written a template for creating a language file in the meantime.
                  It helps me to avoid looking in help file while creating a new language file
                  and I believe that the others might find it useful as well.

                  Template for syntax highlighting language wordfile

                  I would welcome if you could have a look at it as you are an expert in this matter.
                  Of course there are comments in it. :-)

                  Dalibor

                  6,677581
                  Grand MasterGrand Master
                  6,677581

                    Jan 07, 2007#9

                    A combination of File Extensions = and File Names = is not allowed. A test shows me that UltraEdit will interpret every string after File Extensions = also as a file extension.

                    So the definition

                    File Extensions = UWD UWF File Names = WordFile.txt WordFile.new WordFile.old

                    would not only highlight files with the extension "UWD" or "UWF", it would also highlight all files with the extension "FILE" or "NAMES" or "=". The other 3 strings are invalid file extension definitions because of the '.' inside.

                    A reverse definition like

                    File Names = WordFile.txt WordFile.new WordFile.old File Extensions = UWD UWF

                    is also not possible because now the files "FILE" "EXTENSIONS" "=" "UWD" and "UWF" would be highlighted too.

                    You can still combine File Extensions = and File Names = in a language (and I too for my personal usage only because I'm already low with the language numbers in my standard personal wordfile), but this dirty trick should not be used in a wordfile for the download area. Better would be to copy the whole language definition to a new and higher language number and specify for the copy the File Extensions = and for the first definition the File Names =.

                    File Extensions = OR File Names = must be the last definition on the language definition line because of the variable number of strings which can be associated.

                    111
                    Basic UserBasic User
                    111

                      Jan 08, 2007#10

                      This is very surprising finding. Thank you for pointing this out.
                      A combination of File Extensions = and File Names = is not allowed. A test shows me that UltraEdit will interpret every string after File Extensions = also as a file extension.
                      I do not agree with this conclusion.
                      It is a clear bug in my opinion.
                      There is nothing about the need of File Extension or File Names be the last on the language definition line written in the user guide. When they are not last, then you have the same problem with the other keywords like Comment, Block, ...
                      It does not seem as an indented behaviour and it seems that UltraEdit just does not stop adding a new extensions/file names when it hits another keyword in the language definition line.
                      I suggest that you should report this to IDM to get it fixed.

                      Dalibor

                      6,677581
                      Grand MasterGrand Master
                      6,677581

                        Jan 08, 2007#11

                        chrabros wrote:There is nothing about the need of File Extension or File Names be the last on the language definition line written in the user guide. When they are not last, then you have the same problem with the other keywords like Comment, Block, ...
                        It is a not documented fact that the file extensions or file names must be at end of the language definition line because of the variable number of strings. But IDM will not share your opinion that it is a bug because nobody till you today have complained about that fact. All wordfiles are with file extensions at the end of the line and for downwards compatibility I guess, IDM will not change that. File extensions and file names definitions on the same line would be fine. But I think there are not many language definitions which would need it like here for the wordfiles.