Tapatalk

Readme for the Syntax Highlighting forum

Readme for the Syntax Highlighting forum

6,685587
Grand MasterGrand Master
6,685587

    Jan 01, 2008#1

    Please read this large article first before you write a question in the Syntax Highlighting forum!


    1. Determine version of UltraEdit or UEStudio.

    For many syntax highlighting questions the version of UltraEdit (short: UE) or UEStudio (short: UES) is very important.

    Click on ribbon/menu File on About at bottom, or on right side of ribbon bar on Support and next on menu item About, or in menu Help on menu item About depending on version of UE/UES and used user interface mode to determine version of used UE/UES. All version related information below are of UltraEdit for Windows.

    The exact version of UE/UES is essential if you think you have found a bug (coding error in program code) and you want to verify it by other users.
    Real bugs must be reported by email to IDM support as explained on technical support page.


    2. Where to get a syntax highlighting wordfile for ... ?

    UltraEdit/UEStudio is installed with a standard syntax highlighting wordfile for several languages (UE < v15.00 and UES < v9.10) or several wordfiles with 1 wordfile per language (UE ≥ v15.00 and UES ≥ v9.10).
    • For UE up to UE v14.00 and UES up to v6.50:

      The standard syntax highlighting wordfile was installed in the UE/UES program directory and has the file name wordfile.txt. This wordfile was used by default for all users using UE/UES on this computer.

      The standard wordfile.txt was continuously improved. On every UE/UES update up to UE v14.00 respectively UES v6.50, this wordfile was also updated. During the installation process a dialog was shown asking the user to copy existing wordfile.txt to wordfile.old and then overwrite existing wordfile.txt with the new one, or not overwriting wordfile.txt and installing new wordfile as wordfile.new.

      Care has to been taken to make the correct decision if the standard wordfile.txt was modified in any way. When a modified wordfile was saved with a new name or to a different directory as recommended below, it was always possible to agree to overwrite the standard wordfile.txt. But it was good practice to compare the new wordfile.txt with wordfile.old, or wordfile.new with wordfile.txt after the update to see what has been changed if there were any changes at all. After analyzing the modifications the not needed copy (wordfile.new or wordfile.old) could have been deleted to keep the UE/UES program directory clean.
       
    • For UE v14.00a to v14.00b+1 and UES v6.50a to v6.50b+1:

      Starting with UE v14.00a and UES v6.50a, the standard syntax highlighting wordfile was named wordfile.uew and was managed by UltraEdit/UEStudio itself and not by the installer. The installer just installed wordfile.uew into the UE/UES program directory. An existing wordfile.txt from a previous version remained in the UE/UES program directory and should have been deleted if the decision was made to use now wordfile.uew to keep the UE/UES program directory clean.

      If UE/UES detected after an update from a previous version that the syntax highlighting wordfile specified in the INI or the registry was wordfile.txt in the UE/UES program directory, UE/UES copied wordfile.uew from the UE/UES program directory into the directory of the INI file, normally %APPDATA%\IDMComp\UltraEdit for UltraEdit or %APPDATA%\IDMComp\UEStudio for UEStudio, and replaced in the INI or registry the complete name of wordfile.txt in the UE/UES program directory with the complete name of the new standard wordfile.uew in the directory of the INI file.

      That replacement of previous standard wordfile with new standard wordfile was not carried out if UE/UES was started with the command line option /i="complete name of INI file". In this special case the wordfile from the previous version was used further even if it was standard wordfile.txt in the UE/UES program directory. In all other cases, where the INI file was found in one of the standard directories or in the directory specified by environment variable UEINIDIR (for UE) or UESINIDIR (for UES), the replacement was carried out.

      The full name of the wordfile in the INI or registry was never changed if it has had not the name wordfile.txt or was not stored in the program directory of UE/UES. A custom wordfile was therefore never replaced automatically by the standard wordfile. Nevertheless it was advisable to replace the extension txt of the custom wordfile with uew with a file manager or within UE/UES by using File - Rename File on the already opened wordfile, and to adapt the extension of the custom wordfile also in the syntax highlighting configuration dialog.

      The standard wordfile was copied by UE/UES to the directory of the INI file because of write permission problems in the program directory for Windows Vista users and users working with a restricted user account. Those users can't easily modify the wordfile if it is stored in the program directory of UE/UES because of security reasons. Also with 1 wordfile in the program directory multiple user environments on 1 computer would require that every user copies the wordfile to one of the private directories and specify this wordfile in the syntax highlighting configuration dialog to be able to make modifications only for himself/herself. Therefore UE/UES made this copy and file name setting process automatically.

      UltraEdit for MAC (UEM) and UltraEdit for Linux (UEX) prior v2.2.0.4 also use a single wordfile named by default wordfile.uew supporting only up to 20 languages. Use the button Open in the syntax highlighting configuration dialog in UEX or UEM to open the syntax highlighting wordfile currently used by these versions of UEX or UEM.
       
    • For any UE v14.10 and any UES v6.60:

      The wordfile was now version controlled by the entry

      [Version]
      WordFile=


      in uedit32.ini or uedit64.ini or uestudio.ini. On every start UE/UES compared this version with the wordfile version included in the EXE. If the wordfile version in the EXE was not present in an already existing INI file from a previous version or the version number in the EXE was greater than those in the INI, UE/UES displayed a profile updating dialog.

      The user has had the choice to update the wordfile currently used by replacing it with the new standard wordfile or don't do that. If the decision was taken to update the wordfile, the backup option should have been checked to be able to switch back to previously used wordfile. This update did no longer depend on the file name or the file location of the wordfile. Even custom wordfiles with a file name not equal the standard name wordfile.uew were updated without changing the file name and location, but with changing the content. The backup of the wordfile was created always in the directory of the currently used INI independent of the location of the wordfile.
       
    • For any UE v14.20 and UES v9.00:

      The special version controlled update process of the wordfile was disabled internally. The version number for the wordfile in the INI was always updated, but the wordfile itself was managed again as explained above for UE v14.00a. I don't know if that change on the update process back to a partly version controlled update process for the wordfile without backup mechanism was on purpose or by mistake. I suppose, it was a bug of these versions of UE/UES.
       
    • For UE v15.00 to v19.10 and UES v9.10 to v13.10:

      Hint: Special German version 15.20.1.1000 SE of UltraEdit is like UE v14.20 regarding syntax highlighting.

      Starting with UE v15.00 and UES v9.10 there is no longer a single wordfile. Instead of specifying a single wordfile in the syntax highlighting configuration dialog, a directory is specified which contains wordfiles with file extension uew for the syntax highlighting languages. The standard wordfiles are installed into a subdirectory named wordfiles in the UE/UES program directory. On every start UE/UES checks if the directory %APPDATA%\IDMComp\UltraEdit\wordfiles or %APPDATA%\IDMComp\UEStudio\wordfiles exists (without checking if the directory contains also wordfiles). If this directory does not exist, the whole directory wordfiles from the UE/UES program directory is copied to the application data directory of UltraEdit/UEStudio and this directory is used when uedit32.ini or uedit64.ini or uestudio.ini is also created new.

      The update process of the wordfiles is now more complicated than before because 2 completely different configurations must be taken into account.

      When UE/UES was upgraded from a previous version which used a single wordfile, UE/UES continues to use this single wordfile. The subdirectory wordfiles is copied to the application data directory, but this directory and the wordfiles are not used. In the syntax highlighting configuration dialog the single wordfile is still specified. On exit UE/UES moves the color and font style settings for the languages in this single wordfile from the INI or registry into the wordfile. In the INI or registry only the color and font style settings of those languages (1-20) remain which are not present in the single wordfile. If you want to use the new wordfiles, you have to select the wordfiles directory in the syntax highlighting configuration dialog. That can be done easily by simply deleting the entire name of the single wordfile in the syntax highlighting configuration dialog and closing the dialog with button OK.

      When UE/UES uses already the wordfiles directory in the application data directory and according to the wordfile version number one or more of the wordfiles have been updated, following update dialog is shown:

      profile_updating.png (3.01KiB)
      Dialog window for profile updating

      Or this slightly improved dialog window is shown depending on version of UE/UES:

      configuration_file_updates.png (3.39KiB)
      Dialog window for configuration file updates

      When you continue with the settings shown above UE/UES copies first the entire subdirectory wordfiles in the application data directory to the directory of the INI file (normally also the application data directory) with the new name wordfiles Saved [dd.mm.yy]. Then the subdirectory wordfiles in the application data directory is deleted completely. Last the entire subdirectory wordfiles in the UE/UES program directory with the updated wordfiles is copied to the application data directory.
      This update process is applied only on the standard wordfiles directory %APPDATA%\IDMComp\UltraEdit\wordfiles or %APPDATA%\IDMComp\UEStudio\wordfiles. If you have specified in the syntax highlighting configuration dialog a different directory with your wordfiles, the wordfile update process do not change anything in this directory.
      This update process is definitely not good when you have made any modification on the wordfiles or the language color settings because the wordfiles with your color settings and your modifications and your additional wordfiles are now in the wordfiles backup directory and you have to move your wordfiles back and analyze with a file compare the modifications on the standard wordfiles. So with customized wordfiles it is often better to deny the update and make file comparisons between the updated standard wordfiles in the UE/UES program directory with the wordfiles in application data directory.

      With multiple wordfiles in a directory instead of a single wordfile there is no limit of 20 syntax highlighting languages anymore. The language number at start of a syntax highlighting language definition line has no meaning anymore. Additionally UE/UES store the color and font style settings now in the wordfiles and not in the INI or registry as the previous versions of UE/UES have done. So be careful on updates of the wordfiles. When you modify any of the standard wordfiles or a color setting, it is good advice to copy the modified wordfiles into a different directory and specify this directory in the syntax highlighting configuration dialog instead of using standard %APPDATA%\IDMComp\UltraEdit\wordfiles or %APPDATA%\IDMComp\UEStudio\wordfiles to avoid unwanted changes during a wordfiles update in future as written above.

      UltraEdit for MAC (UEM) and UltraEdit for Linux (UEX) use both by default since v2.2.0.4 also a wordfiles directory with an unlimited number of *.uew files instead of a single wordfile with up to 20 languages. The directory with the wordfiles is by default ~/Library/Application Support/UltraEdit/wordfiles for UEM and ~/.idm/uex/wordfiles for UEX.
       
    • For UE v20.00 and UES v14.00 and later:

      The themes feature was introduced with UE v20.00 and UES v14.00. This resulted in several changes regarding management of the wordfiles.

      Color and font style settings are no longer stored in the *.uew files. They are stored now in the theme file. A customized theme file is stored by default in %APPDATA%\IDMComp\UltraEdit\themes or %APPDATA%\IDMComp\UEStudio\themes.

      The color and font style settings in the wordfiles stored in %APPDATA%\IDMComp\UltraEdit\wordfiles respectively %APPDATA%\IDMComp\UEStudio\wordfiles are automatically imported into the theme file on first start of UE/UES after an upgrade from a version prior UE v20.00 respectively prior UES v14.00. But no automatic import is done if the wordfiles directory was customized by the user and therefore the *.uew files are stored in a different directory than the default wordfiles directory. Also the automatic import of color and font style settings is done without removing them from the wordfiles although not further used by UE/UES.

      See forum post Extract color and font style settings from wordfiles and convert to theme format for more details on how to import manually with help of a script the color and font style settings from wordfiles in a custom wordfiles directory into the theme file.

      And macro SettingsDelAll also included in SyntaxTools package can be used to cleanup the wordfiles from color and font style settings.

      Further, the wordfiles are not really managed anymore with WordFile= in INI file. While several improvements were made on the wordfiles installed by the installer into the wordfiles subdirectory in program files directory of UE/UES, the wordfiles version is constant 1035 since UE v21.00 and UES v14.00.

      UE and UES check the wordfile version now only on first start after an upgrade. In case of wordfile version is not 1035 in INI file, a backup of existing %APPDATA%\IDMComp\UltraEdit\wordfiles or %APPDATA%\IDMComp\UEStudio\wordfiles is made silently and then the wordfiles directory in program files folder of UE/UES is copied to the application data directory of UltraEdit/UEStudio without any notification for the user.

      So there have been no automatic updates of standard wordfiles since UE v21.00 and UES v14.00 as a consequence of this modification in wordfiles management although in later versions of UE and UES further improvements have been made on the standard wordfiles. In other words the users have to update even the standard wordfiles now also manually.
    Latest syntax highlighting wordfiles:

    The standard wordfiles are currently syntax highlighting language definitions for C#, C/C++, CSS 1.0-2.1, HTML, Java, JavaScript (including the UE/UES script commands and properties), MySQL 5.1, Perl, PHP, Ruby, VBScript ASP, Visual Basic and XML.


    But that's not all. On the UltraEdit website there is a menu on top. Click on Downloads - Extras - Wordfiles. A page will be displayed which contains lots of user-submitted wordfiles for downloading and using it with UE/UES.

    How to add a language wordfile is explained in 2 power tips. Which one to use depends on your version of UltraEdit / UEStudio.

    For UE v15.00 and UES v9.10 and later see Adding a wordfile in UltraEdit v15.00 and greater.
    For UE v14.20 and UES v9.00 and previous see Adding a wordfile in UltraEdit prior v15.00.

    A similar power tip exists also for UEX prior v2.2.0.0, see Adding a wordfile to UltraEdit for Linux.


    Note: The wordfiles are written by users like you and are sent to IDM which host it without really testing it. Why? Because for testing/updating a wordfile big knowledge about the syntax of the highlighted language and good example files are necessary. You can't expect that IDM has really the knowledge and example files for all the languages for which wordfiles exist.

    As IDM writes at top of the wordfiles download page, IDM highly welcomes contributions from users. So if you have good knowledge about a language and lots of example files and you could improve a language definition for yourself, please help other users and send this improved version to IDM by email telling them briefly what you have modified and which file should be replaced with the new version. Because of such continuously improvements by users it is worth from time to time to look again on the user-submitted wordfiles download page and check if there is a newer version of a wordfile with a language definition which you use too.

    An alternate method to contribute an improved or new wordfile is using GitHub wordfiles repository. The commits page lists all updates to the wordfiles repository making it easier to check if one of the used wordfiles was updated by a user.


    3. How to add a new language definition to the current wordfile or wordfiles directory?

    Before you begin adding a wordfile, check if not already one of the existing syntax highlighting languages is suitable for the active file and therefore just the file extension must be added to an already installed language. Open submenu View as (Highlighting File Type) in menu View, look if a suitable language is listed, and select it for the active file.

    Does your file look fine with the selected language?

    Yes, then you just have to add the file extension of the active file to the language currently selected. Open now Advanced - Configuration - Editor Display - Syntax Highlighting. The active syntax highlighting language should be already preselected. Press the button Open to open the wordfile containing this language. Close the configuration dialog with button Cancel. If the opened wordfile contains only 1 language with the name of the language in double quotes at beginning of the first line, you just have to go now to end of first line containing the list of file extensions associated with that syntax highlighting language and append there the file extension of active file. But if the wordfile contains multiple languages, you have to search for the language definition line starting with /Lnn"language name" (nn is a number in range of 1 to 20). Go to end of this line and append the file extension. On Windows file system file names and their extensions are not case sensitive, so the case of the file extension you add does not matter. Save the wordfile and close it. On next opening of a file with the just added extension the file will be highlighted automatically with that language.

    If there is no suitable language already installed for the active file, you really have to add a downloaded wordfile or create one by yourself.

    There are the 2 power tips:
    I think, how to add a wordfile when using UE v15.00 or UES v9.10 or any later must not be explained additionally. Copying/saving a file into a directory should be no problem for anybody. Just open Advanced - Configuration - Editor Display - Syntax Highlighting to see the full path of the directory containing the wordfiles to make sure to save the downloaded or created wordfile in the correct directory. Usually this is the wordfiles directory in the application data directory of UltraEdit or UEStudio. The wordfiles directory in program files directory of UltraEdit or UEStudio is normally the wrong place.

    If the second one for UE v14.20 and UES v9.00 and previous versions is not detailed enough for you here is my version.

    First, you have to determine and open the wordfile you currently use. Depending on your version of UE/UES do following:
    • For UE up to v11.10c or UES up to v5.00b:

      In menu Advanced (Advanced menu profile) or File (Basic menu profile) click on item Configuration. Next click on tab Syntax Highlighting.
       
    • For UE since v11.20 or UES since v5.10:

      In menu Advanced (Advanced menu profile) or File (Basic menu profile for UE < v13.00) click on item Configuration. Next expand Editor Display in the tree and click on Syntax Highlighting.
    There is a text field with the caption Full path name for wordlist: and the buttons Browse and Open right to this text field. Click the button Open and close the configuration dialog with button Cancel.

    Note: For projects a project specific wordfile can be specified and used. If you have currently open a project and such an optional project wordfile is specified for this project, open the project settings dialog where you can see the full file name of the optional wordfile and open this wordfile or close the project to use default wordfile.

    If you use UE prior v14.00a or UES prior v6.50a and you have now open standard wordfile.txt in UE/UES program directory you best first save it with a new name into the same or a different directory or with the name wordfile.txt to a different directory using File - Save As. Especially if you are using a restricted user account you probably don't have write permissions on wordfile.txt in the program directory of UE/UES and therefore you must save the wordfile into a directory where you have write permissions. This is best practice to avoid problems when in future updating UE/UES (see above). Users with UE v14.00a or UES v6.50a or any later version don't need to change the name and location of the wordfile anymore. The default location is already in the user specific application data directory, or to be more precise, in the directory of the INI file currently used. But saving the standard wordfile with a different name before modifying it could be done nevertheless.

    Now move the cursor to bottom of the file for example by pressing Ctrl+End.

    Paste here the content of the wordfile you have downloaded or create here now your new language definition.

    Important is the language number at start of the first line of the language definition. In most cases your wordfile contains already several language definitions. For your new language definition you have to specify a language number which is not already used by any other language definition in this wordfile.

    Run a regular expression search from top of the wordfile with search option List Lines Containing String also checked to see all existing language definitions of the wordfile in a dialog. The search string is %/L[0-9]+ with UltraEdit regexp engine or ^/L[0-9]+ with Unix/Perl regexp engine. If you don't know which regexp engine is configured, try first the search string with UE syntax and if nothing is found the other search string.

    Up to 20 language definitions are possible in a wordfile since UE v9.00. Prior v9.00 UltraEdit supports only up to 10 language definitions in a wordfile. Give the new language definition now the next free number. For example if the list shows you 13 lines with /L1 ... /L13 then use /L14 (instead of /L20) for your new language definition.

    If you have copied the new language definition from a browser window make sure that in the line starting with /Delimiters = the tab character is also listed if the tab character is a word delimiter for this language. Browsers often replace the tab character in the text file by a space character and therefore the syntax highlighting will not work correct if in the delimiters line 2 spaces are defined instead of 1 space and 1 tab.

    Save now the modified wordfile by pressing Ctrl+S.

    If you have really saved the file with a new name and/or to a different directory, you need to specify this new wordfile in the configuration dialog. Special hint: use now Edit - Copy File Path/Name to copy full file name of the new wordfile to the clipboard. (Windows clipboard should be active.) Open again the syntax highlighting configuration dialog. Select the full file name in the text field and press Ctrl+V to replace it with the new full file name copied before or use button Browse to browse for the new wordfile. Close the configuration dialog with button OK.

    After adding a new language definition to the wordfile in use it is most often needed to customize now the colors and styles of the color groups for this language definition. Open an example file which is highlighted by the new language definition. Then open again the syntax highlighting configuration dialog. The correct Language should be already pre-selected from the list of languages according to active file. Customize the Color Groups to what you like. Press button Apply to see how the file below the dialog is highlighted with the new settings. When the file content looks fine for you close the dialog with button OK.

    Hint: The SyntaxTools package contains a macro file. The macro WordfilesMerger in this macro file and the documentation in file LanguageSettings.htm may be a big help for you if you have problems adding a downloaded wordfile manually to your wordfile.


    4. How to create a new language definition?

    With a little practice it is quite simple to create a language definition. But the first one is a hard work. Why? Because you have to READ, READ and ...... READ and you have to read CAREFULLY and MUCH.

    The first article you should read is the page Syntax Highlighting in help of UltraEdit/UEStudio. It explains most facts of the syntax highlighting feature. The page Syntax Highlighting in help of UE/UES contains the keywords that your version of UE/UES supports. But depending on your version of the help some facts are not 100% correct because the page was not always updated immediately when the developers have changed something for the syntax highlighting in the program code. You can use online version of the help page to cross-check it with the version in your UE/UES help and to get information about new capabilities for syntax highlighting which of course your version of UE/UES probably does not support.

    After reading this large help page it's time to open now your wordfile as described in the previous chapter above. Again I recommend not to modify standard wordfile.txt or wordfile.uew or any of the standard wordfiles. Work with a copy of it. Maybe an existing language definition in the already opened wordfile or on the download page is for a language which is similar to your language and which you can use as template.

    But if you can't find an existing suitable language definition Dalibor Jelinek and I have created a template. Copy this template and paste it at bottom of the wordfile or to a new file. It contains lots of comment lines which all start with # which hopefully helps you too. But don't forget to delete those comment lines while creating the language definition from top to bottom with this template.

    Also helpful could be to have the wordfile itself syntax highlighted. To get it highlighted you have to add the content of the file Wordfile Editing to your wordfile as described above in the previous chapter or save that wordfile into your wordfiles directory. But please note that the link references a ZIP file containing the wordfile and a readme file explaining how to use the wordfile depending on version of UltraEdit / UEStudio.

    Additional information for understanding how the syntax highlighting of UE/UES works can be found in the descriptions I have written for my SyntaxTools macro set with the 3 main macros SortLanguage, TestForDuplicate and TestForInvalid. These 3 macros in 1 macro file with their descriptions in HTML can be downloaded from the topic:

    The ultimate syntax highlighting tools

    After reading all those articles you should have the equipment to create the language definition for your language.

    Hint 1: Have the wordfile and a good example file open in the same instance of UE/UES arranged horizontally, for example with Window - Tile Horizontal. On every save of the wordfile UE/UES immediately re-reads the wordfile and applies the changes to the example file including the function list when the example file gets back the focus. So you can easily make a change in the wordfile and quickly check it's effect on the highlighting of your example file.

    Hint 2: Always use the same color group in all your language definitions for the same type of words. That makes it easier to apply always the same color to same type of words.


    5. Some special hints for advanced wordfile editors.

    5.1 Deleting of not needed language definitions.

    For UE v15.00 and UES v9.10 and later delete the wordfiles of the languages you don't need, or better, copy those wordfiles you need to a different directory and specify this directory in the configuration dialog. The wordfiles in a non standard wordfiles directory are never updated by UE/UES.

    The following paragraphs are for UE v14.20 and UES v9.00 and previous versions which use a single wordfile for several languages.

    After opening the wordfile and running a regular expression search with %/L[0-9]+ or ^/L[0-9]+ with search option List Lines Containing String you maybe see definitions in the dialog for languages you will never need. Do you want to remove them? Yes, no problem. Go to the first line of such a language definition and select everything from start of this line to start of the next language definition line (= next line starting with /Lnn"...") or end of file and delete that block. Work from bottom to top of the file (from higher to lower language number) because then you have not to re-run the search always again.

    After deleting all not needed language definitions you should re-number the remaining language definitions. Best use the regular expression search with List Lines Containing String option again. But re-number the remaining language definitions only if you have not already customized the colors and styles for the languages you have used. Otherwise let the language numbers unmodified and be careful when adding in future a new language definition. Insert it at a position between existing language definitions according to the language number. Or you re-number it and follow my next special hint.

    Why to do this? Smaller wordfiles are faster loaded by UE/UES. So deleting not needed language definitions improves start-up performance. Also you get a better overview in the View - View As menu and in the Language list in the syntax highlighting configuration dialog.


    5.2 Re-ordering or copying colors and other settings from one language to another.

    For UE v14.20 and UES v9.00 and previous versions all the language specific syntax highlighting settings like the colors and styles for the color groups are stored in uedit32.ini or uedit64.ini or uestudio.ini if you don't use the registry for settings. The INI file is by default stored at %APPDATA%\IDMComp\UltraEdit or %APPDATA%\IDMComp\UEStudio or %SystemRoot%. Just copy the string into the address bar of Windows Explorer and press RETURN to open that directory (if it exists).

    But don't edit the INI of UE/UES with UE/UES itself. Either use another text editor like Notepad while UE/UES is not running or create a copy of it, open and edit this copy with UE/UES and after saving the changes, close it, exit UE/UES and copy the modified version over the original INI file. Then restart UE/UES to see the changes.

    In the INI file you can easily find the settings for the languages. Look for the up to 20 groups [Language x Colors] with x is a number in the range of 1-20. The rest should be simple. Copy the lines as needed after re-numbering the language definitions in the wordfile or if you have found good color/style settings for a language and want to apply it also to all other languages you use. For example I have for myself years ago played with all the color settings to get a combination I like, copied that settings to all languages and adapted the language definitions in my wordfiles (standard and project wordfiles) to use always the same color group for the same type of words. I have never made any changes to the color and style settings since I have done this, just to the language definitions in the wordfiles.

    For UE v15.00 to v19.10 and UES v9.10 to v13.10 all the language specific syntax highlighting color and font style settings are stored in the wordfile(s) and not in the INI file or registry. If you want to copy color schemes from one language (wordfile) to another one, you must be very careful. I have needed 3 attempts for my main wordfile with 18 languages to get all settings in the wordfile correct. That was the reason why I have developed macros for managing wordfiles and their color and font style settings more easily because I also use project specific wordfiles and I wanted to avoid mistakes caused by manual modifications. I recommend to read the documentation LanguageSettings.htm in my SyntaxTools package and use the macros I have written for that purpose. They are a big help.


    5.3 Specifying a language for new files not saved once.

    Since UE v12.20 and UES v6.10 at Configuration - Editor Display - Syntax Highlighting there is a setting named Highlight new files as a language. Select the language you want as default for new files. But saving a new file as soon as possible should be done nevertheless because other settings like the file extension based word wrap / tab settings, auto-completion, ... can be applied only when the file is saved once with a known file extension.


    5.4 Specifying a default language for all unknown files.

    There are cases where it is useful to specify a language as default language for highlighting all files which have a file name or file extension not associated with any language definition in the wordfile or which do not have a file extension at all. This can be done by adding an asterisk * at the end of a File Extensions = list on one of the language definitions. Example:

    /L3"HTML" ... File Extensions = HTM HTML SHTML HTT HTA HTX CFM JSP PHP PHTML ASP *

    For that example the language definition for HTML will be used for all unknown files like when viewing the source code of an HTML file stored in the cache directory of Internet Explorer which does not have a file extension.

    With a manual language selection via View - View As (Highlighting File Type) the highlighting for the active file can be always chosen. It is also possible to assign hotkeys for the first 20 languages for fast switching - see Configuration - Key Mapping - ViewShowAsLanguagex.


    5.5 Auto indent based on syntax highlighting (file extension).

    At Configuration - Editor - Word Wrap/Tab Settings it is possible to specify individual tab and indent settings based on the extension of a file (see power tip Word wrap and tab settings for different file types). But the setting Auto indent new lines at Configuration - Editor Display - Formatting disables/enables auto indent for all files at once and this is for some file types not practical. But with the indent strings in the wordfile it is possible to configure the auto indent feature a little.

    Specifying indent/unindent strings which surely never occur in a file as for example

    /Indent Strings = "no_unindent"
    /Unindent Strings = "no_unindent"


    has the effect that the auto unindent feature is disabled, but auto indent still partly works and indents a new line after pressing RETURN to the column of first non whitespace character of the line above. But there is no automatic increase of indent anymore. Specifying empty indent/unindent strings "" would have the same effect. Also deleting those two lines from a wordfile disables automatic unindent and reduces automatic indent to just indent on line above. For some languages like HTML it is better to specify real strings which never occur to overwrite UE/UES internal default indent/unindent strings. I like this type of auto indent for HTML editing and assembler source files.

    It is currently not possible to completely disable the auto indent feature for some file types where at the same time it is enabled for other file types.


    5.6 Using code folding for non programming languages.

    The code folding feature introduced with UltraEdit v11.00 is a very useful feature mainly for programming languages. But it would be also fine to use it for other languages which have not a real good block based structure as programming languages often have. But many languages support comments. And since UltraEdit v12.00 respectively UEStudio v5.10 it is possible to specify open and close fold strings which are recognized inside a comment. This can be used now by you for easily fold/unfold (hide/unhide) a block where you specify with a special open and close fold string in a comment where such a block starts and where it ends. An example for batch files:

    rem >>> Some existence tests for needed environment variables.
    if "%appdata%"=="" goto err_appdata
    if "%username%"=="" goto err_username
    ...
    rem <<< Some existence tests for needed environment variables.

    An appropriate language definition for that example would be:

    /L1"Batch Files" Nocase Line Comment = rem String Chars = " DisableMLS Block Comment On Alt = echo File Extensions = BAT CMD
    /Delimiters = # $()*+,./:;<=>\
    /Indent Strings = ""
    /Unindent Strings = ""
    /Open Fold Strings = "openfoldnotused"
    /Close Fold Strings = "closefoldnotused"
    /Open Comment Fold Strings = ">>>"
    /Close Comment Fold Strings = "<<<"
    ...


    It is important to specify also normal open and close fold strings even if there are no such strings for that language because without normal open and close fold strings the code folding feature is disabled for that language. And the comment string itself should not be part of the open/close comment fold string.

    Starting with UE v18.10 and UES v12.10 another method for code folding is supported: code folding based on indent level for Python files and all other files syntax highlighted with a language containing EnableCFByIndent in first line. But please note that usage of code folding by indent disables code folding by strings.


    5.7 How to outwit the auto correction feature?

    If setting Auto-correct keywords at Advanced - Configuration - Editor Display - Syntax Highlighting (for UE prior v15.00 and UES prior v9.10) or Advanced - Configuration - Editor Display - Miscellaneous (for UE v15.00 and UES v9.10 and later) is enabled, it could happen for case sensitive languages that when you enter a word the case of some letters of the word automatically changes to something you don't want. You can do now following:
    1. Turn off Auto-correct keywords which is a global setting for all languages.
    2. Remove the word from the color group of the appropriate language definition.
    3. Add also the word with other case of some (all) letters to the wordfile for that language.
      Note: That does not work for UE v15.00.0.1043 to v15.10.0.1018 because of a bug in these versions.
    4. Make the language in the wordfile not case sensitive by adding Nocase to the language definition line.
      Attention: You need to re-sort the words and remove duplicates when adding Nocase. And Nocase has an effect also on other features like auto-completion and other strings like the brace and fold strings. So do this only if the language is really not case sensitive.
    5. Correct the keyword in the syntax highlighting wordfile if it is simply written wrong. In case sensitive languages this requires also often moving the keyword to another line, especially if first letter of the keyword is changed. For example Links is written wrong in many old syntax highlighting wordfiles for JavaScript. Correct would be links. But correcting the case of the first letter requires moving the keyword down to the line with the words starting with lower case L.
    6. Or best simply do not use keywords of the case sensitive language for your own symbols (variables, function names, definitions, etc.) which differ from a keyword only by the case of 1 or more letters.
    See also power tip Autocorrect keywords in UltraEdit/UEStudio.

    But if you like the auto correction feature and only want to outwit it once for example to add a word like string to a color group of a language definition while syntax highlighting for wordfiles is also enabled you can do following:
    1. Select View - View As - No Highlighting, enter the word, move the cursor away from the word and enable syntax highlighting again by selecting correct language in the menu.
    2. Re-select the corrected word or only the letter(s) in wrong case and use Format - To Upper Case / To Lower Case / Capitalize / Invert Case to change the case of the selected letter(s) without triggering the auto correction.

    6. Which are the most often made mistakes when creating a language definition?

    6.1 Tab character is not specified as delimiter.

    Very often the highlighting of a word is not correct because it follows a tab character and the tab is not specified as delimiter in the wordfile for that language at /Delimiters =.

    That happens very often when copying a language definition from the browser window because according to HTML standard the browsers must display a tab as single space or in preformatted text as sequence of spaces and so a space is copied instead of a tab.

    Also possible is that the tab settings are set to insert 1 or more spaces instead of a real horizontal tab character when editing the wordfile.

    And you could have setting Trim trailing spaces on file save enabled in the configuration and you have added the tab at end of the /Delimiters = which is automatically removed when saving the wordfile.

    So you should always make sure that 1 space and 1 tab character exists in the list of delimiters, best anywhere in the middle of it. You can use View - ASCII Table, select character with name HT (decimal code 09) and press the button Insert Char to insert a real horizontal tab character at current cursor position. With View - Show Spaces/Tabs or with Search - Character Properties or in Hex Edit mode you can verify if the current whitespace character is a tab or a space.


    6.2 Words in a color group are not correct sorted.

    If some words are correct highlighted and others not although all of them are specified in the wordfile for the current language then the words are often not correct sorted according to existence of Nocase in the language definition line as described in help page of UE/UES for Syntax Highlighting.

    Best download the SyntaxTools macro set, unpack the ZIP archive, load the macro file and run the 3 macros SortLanguage, TestForDuplicate and TestForInvalid one after the other and make the maybe required corrections on the list of words until none of the 3 macros reports a mistake anymore.


    6.3 Strings highlighted with marker characters are highlighted with random colors.

    If you use /Marker Characters = "??" you must specify each marker pair also in one of the 8 color groups like a word.


    6.4 Wordfile is not saved in correct format.

    The wordfile must be an ASCII/ANSI file with DOS line terminators. Unicode encoding (UTF-8 or UTF-16) is not supported for wordfiles. Also wordfiles with only UNIX or MAC line terminators are not supported. The status bar at bottom of the application window must display DOS in the box right the box with the line, column and clipboard number if the created wordfile is opened and is the active file.


    7. What are the most often asked syntax highlighting questions?

    7.1 Can regular expressions be used for highlighting words?

    NO! Regular expression strings can be only used for /Function Strings, for /Member String and for /Variable String. Member and variable strings are undocumented definitions for the IntelliTips feature of UEStudio and are ignored by UltraEdit. The function strings are only for the function list view (and auto-completion / IntelliTips) but not for syntax highlighting.


    7.2 Can a term/phrase with a space or delimiter character be highlighted?

    NO! The space character is used as word delimiter in the wordfile and therefore it is not possible to highlight strings with a space. Except for the starting character of a word it is also not possible to specify words with delimiter characters. Read the article about the ultimate test for invalid words macro to understand the working mechanism of the syntax highlighting engine and why this is not possible. Sometimes block comments, marker characters or strings can be used as workaround to highlight everything between two characters or two short words.


    7.3 Is indenting or code folding only when a character is at end/start of a line possible?

    It is not possible to add extra rules or line ending characters to the indent/unindent, open/close (comment) fold or the block comment on/off strings. So it is not possible to specify that the string should be interpreted as specified only when it exists at a specified position on a line. For line comments such extra rules can be specified.


    7.4 Can the same word be highlighted with 2 different colors?

    In some languages a word has a different meaning according to where it is used. For a general text editor with a general syntax highlighting engine it is not possible to understand such special meanings. UE/UES are not interpreters for a special language only. It is not possible to add rules like:

    IF wordx FOLLOWS wordy THEN highlight it with color 1
    ELSE IF wordx FOLLOWS wordz THEN highlight it with color 2


    7.5 Can negative numbers also be highlighted as numbers?

    YES! Add to one of the up to 8 color groups the following substring definition:

    ** -0 -1 -2 -3 -4 -5 -6 -7 -8 -9

    and set for this color group the same color as for the positive numbers (or a different color when you want negative numbers highlighted different).


    7.6 How to copy a block with syntax highlighting?

    This is possible since UE v19.00 and UES v13.00 using one of the commands in submenu Copy Special in menu Edit as explained in power tip Copy and paste syntax highlighting as RTF or HTML.


    7.7 An entered word was changed suddenly by UltraEdit/UEStudio, why?

    One of the features of UltraEdit/UEStudio which can modify words entered by the user is the Auto Correct Keywords feature. See above 5.7 How to outwit the auto correction feature? for more details.


    8. Do you still need help?

    There are several power tips and tutorials by IDM on this website related to syntax highlighting:
    If you still don't have success to find an answer for your question by yourself, use the forum search to maybe find a topic which helps you on your specific syntax highlighting problem.

    The forum search option Search for all terms or use query as entered is selected by default which combines your entered words with a logical AND. With that search option you can also run a search with your own logical rules as described left to the edit field. The option Search for any terms combines the entered words with a logical OR.

    You should also select the Syntax Highlighting forum at Search in forums: before you start your search to focus the search on topics of this forum.

    If you can't find a topic which helps you in this forum, select UltraEdit at Search in forums: and run the search(es) again. Maybe your task cannot be done with syntax highlighting features and so a macro or script solution is required and maybe the macro or script solution you also need is posted already.

    I'm pretty sure that 99% of all general syntax highlighting questions are answered already in the forum. So try to find the answer for a general question by yourself.

    We expect you to "look it up"... if you can't find what you were looking for let us know (include your search criteria) and we'll try to improve the hits if your search should have found it...

    If you still need help read forum topic "Help for new forum members - read this before post anywhere!" which tells you how to best add a new post or topic so we can quickly help you.

    Thanks for saving your and the (power) forum members' time by reading and using this readme article!